Repository: baianat/vee-validate (js)

Issue:
validator.reset() doesn't respect vmId when clearing errors
**Versions**

- vee-validate: 2.1.2
- vue: 2.5.17

**Describe the bug**
validator.reset() correctly filters fields by vmId (or specified matcher) when resetting field flags, but does not when clearing errors. See https://github.com/baianat/vee-validate/blob/master/src/core/validator.js#L224. I believe the solution would be as simple as filtering `this.errors` by the matcher as is done on L221 for `this.fields`; I'd be happy to submit a PR for this.

**To reproduce**
Steps to reproduce the behavior:
1. Define a component with some validation rules
2. Include the component multiple times
3. Trigger a validation error on one component
4. Call `this.$validator.reset()` on the other component (doesn't matter whether `{ vmId: this.$validator.id }` is passed as the matcher since this is the default behavior)
5. The validation errors on the first component are cleared

**Expected behavior**
The validation errors on other components should not be cleared when reset() is called


Pull request description:
Fix validator.reset not respecting vmId when clearing errors (#1714)
🔎 __Overview__

Explain the premise for adding this PR and why is it important.

> This PR fixes the bug #1714.

✔ __Issues affected__

list of issues formatted like this:

> fixes #1714


Patch:
diff --git a/src/core/validator.js b/src/core/validator.js
index 2ec857ce..6496d190 100644
--- a/src/core/validator.js
+++ b/src/core/validator.js
@@ -221,7 +221,7 @@ export default class Validator {
       this.fields.filter(matcher).forEach(field => {
         field.waitFor(null);
         field.reset(); // reset field flags.
-        this.errors.remove(field.name, field.scope);
+        this.errors.remove(field.name, field.scope, matcher && matcher.vmId);
       });
     });
   }


Test patch:
diff --git a/tests/unit/validator.js b/tests/unit/validator.js
index 4865752f..0ba49256 100644
--- a/tests/unit/validator.js
+++ b/tests/unit/validator.js
@@ -741,6 +741,18 @@ test('resets fields matching the matcher options', async () => {
   expect(v.errors.count()).toBe(0);
 });
 
+test('resets errors scoped by vmId', async () => {
+  const v = new Validator();
+  v.attach({ name: 'field', vmId: 123 });
+  v.attach({ name: 'field', vmId: 456 });
+
+  v.errors.add({ field: 'field', msg: 'oops', vmId: 123 });
+  v.errors.add({ field: 'field', msg: 'oops', vmId: 456 });
+
+  await v.reset({ name: 'field', vmId: 123 });
+  expect(v.errors.count()).toBe(1);
+});
+
 test('resets all fields', async () => {
   const v = new Validator();
   v.attach({ name: 'field' });