Commit cccb73ad authored by David Sveningsson's avatar David Sveningsson
Browse files

fix(deps): update dependency ajv to v8


Signed-off-by: HTML-validate's avatarHTML-validate <gitlab@html-validate.org>
parent 09a1a289
Pipeline #327622020 passed with stages
in 9 minutes and 38 seconds
......@@ -12,7 +12,7 @@
"@html-validate/stylish": "^1.0.0",
"@sidvind/better-ajv-errors": "^0.9.0",
"acorn-walk": "^8.0.0",
"ajv": "^7.0.0",
"ajv": "^8.0.0",
"deepmerge": "^4.2.0",
"espree": "^7.3.0",
"glob": "^7.1.0",
......@@ -4548,9 +4548,9 @@
}
},
"node_modules/ajv": {
"version": "7.2.4",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-7.2.4.tgz",
"integrity": "sha512-nBeQgg/ZZA3u3SYxyaDvpvDtgZ/EZPF547ARgZBrG9Bhu1vKDwAIjtIf+sDtJUKa2zOcEbmRLBRSyMraS/Oy1A==",
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.0.tgz",
"integrity": "sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ==",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
......@@ -19688,22 +19688,6 @@
"node": ">=10.0.0"
}
},
"node_modules/table/node_modules/ajv": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.5.0.tgz",
"integrity": "sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ==",
"dev": true,
"dependencies": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/tar": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz",
......@@ -24270,9 +24254,9 @@
}
},
"ajv": {
"version": "7.2.4",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-7.2.4.tgz",
"integrity": "sha512-nBeQgg/ZZA3u3SYxyaDvpvDtgZ/EZPF547ARgZBrG9Bhu1vKDwAIjtIf+sDtJUKa2zOcEbmRLBRSyMraS/Oy1A==",
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.0.tgz",
"integrity": "sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ==",
"requires": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
......@@ -35749,20 +35733,6 @@
"slice-ansi": "^4.0.0",
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0"
},
"dependencies": {
"ajv": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.5.0.tgz",
"integrity": "sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
}
}
}
},
"tar": {
......@@ -92,7 +92,7 @@ describe("config", () => {
Config.fromObject({
rules: "spam",
} as any)
).toThrow("Invalid configuration: /rules: type should be object");
).toThrow("Invalid configuration: /rules: type must be object");
expect(() => Config.fromFile("invalid-file.json")).toThrow(
'Failed to read configuration from "invalid-file.json"'
);
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SchemaValidationError should pretty-print validation errors 1`] = `
"TYPE should be boolean
"TYPE must be boolean
1 | {
2 | \\"foo\\": {
> 3 | \\"flow\\": \\"spam\\"
| ^^^^^^ 👈🏽 type should be boolean
| ^^^^^^ 👈🏽 type must be boolean
4 | }
5 | }
TYPE should be array
TYPE must be array
1 | {
2 | \\"foo\\": {
> 3 | \\"flow\\": \\"spam\\"
| ^^^^^^ 👈🏽 type should be array
| ^^^^^^ 👈🏽 type must be array
4 | }
5 | }
ANYOF should match some schema in anyOf
ANYOF must match a schema in anyOf
1 | {
2 | \\"foo\\": {
> 3 | \\"flow\\": \\"spam\\"
| ^^^^^^ 👈🏽 anyOf should match some schema in anyOf
| ^^^^^^ 👈🏽 anyOf must match a schema in anyOf
4 | }
5 | }"
`;
......@@ -45,67 +45,67 @@ describe("prettyError()", () => {
expect.assertions(1);
const error = new SchemaValidationError(filename, "Mock error", data, schema, errors);
expect(stripAnsi(error.prettyError())).toMatchInlineSnapshot(`
"TYPE should be string
"TYPE must be string
> 1 | {
| ^
> 2 | \\"foo\\": [1, 2, 3],
| ^^^^^^^^^^^^^^^^^^^
> 3 | \\"bar\\": \\"baz\\"
| ^^^^^^^^^^^^^^^^^^^
> 4 | }
| ^^ 👈🏽 type should be string
5 |"
`);
> 1 | {
| ^
> 2 | \\"foo\\": [1, 2, 3],
| ^^^^^^^^^^^^^^^^^^^
> 3 | \\"bar\\": \\"baz\\"
| ^^^^^^^^^^^^^^^^^^^
> 4 | }
| ^^ 👈🏽 type must be string
5 |"
`);
});
it("should handle invalid file", () => {
expect.assertions(1);
const error = new SchemaValidationError("invalid-file", "Mock error", data, schema, errors);
expect(stripAnsi(error.prettyError())).toMatchInlineSnapshot(`
"TYPE should be string
"TYPE must be string
> 1 | {
| ^
> 2 | \\"foo\\": [
| ^^^^^^^^^^
> 3 | 1,
| ^^^^^^^^^^
> 4 | 2,
| ^^^^^^^^^^
> 5 | 3
| ^^^^^^^^^^
> 6 | ],
| ^^^^^^^^^^
> 7 | \\"bar\\": \\"baz\\"
| ^^^^^^^^^^
> 8 | }
| ^^ 👈🏽 type should be string"
`);
> 1 | {
| ^
> 2 | \\"foo\\": [
| ^^^^^^^^^^
> 3 | 1,
| ^^^^^^^^^^
> 4 | 2,
| ^^^^^^^^^^
> 5 | 3
| ^^^^^^^^^^
> 6 | ],
| ^^^^^^^^^^
> 7 | \\"bar\\": \\"baz\\"
| ^^^^^^^^^^
> 8 | }
| ^^ 👈🏽 type must be string"
`);
});
it("should handle missing filename", () => {
expect.assertions(1);
const error = new SchemaValidationError(null, "Mock error", data, schema, errors);
expect(stripAnsi(error.prettyError())).toMatchInlineSnapshot(`
"TYPE should be string
"TYPE must be string
> 1 | {
| ^
> 2 | \\"foo\\": [
| ^^^^^^^^^^
> 3 | 1,
| ^^^^^^^^^^
> 4 | 2,
| ^^^^^^^^^^
> 5 | 3
| ^^^^^^^^^^
> 6 | ],
| ^^^^^^^^^^
> 7 | \\"bar\\": \\"baz\\"
| ^^^^^^^^^^
> 8 | }
| ^^ 👈🏽 type should be string"
`);
> 1 | {
| ^
> 2 | \\"foo\\": [
| ^^^^^^^^^^
> 3 | 1,
| ^^^^^^^^^^
> 4 | 2,
| ^^^^^^^^^^
> 5 | 3
| ^^^^^^^^^^
> 6 | ],
| ^^^^^^^^^^
> 7 | \\"bar\\": \\"baz\\"
| ^^^^^^^^^^
> 8 | }
| ^^ 👈🏽 type must be string"
`);
});
});
......@@ -56,7 +56,7 @@ const ajvRegexpValidate: DataValidateFunction = function (
if (!valid) {
ajvRegexpValidate.errors = [
{
dataPath: dataCxt?.dataPath,
instancePath: dataCxt?.instancePath,
schemaPath: undefined,
keyword: "type",
message: "should be regexp",
......
......@@ -407,7 +407,7 @@ describe("validateOptions()", () => {
config
);
}).toThrowErrorMatchingInlineSnapshot(
`"Rule configuration error: /rules/mock-rule-invalid/1/foo: type should be number"`
`"Rule configuration error: /rules/mock-rule-invalid/1/foo: type must be number"`
);
});
......
......@@ -324,7 +324,7 @@ export abstract class Rule<ContextType = void, OptionsType = void> {
/* istanbul ignore next: it is always set when validation fails */
const errors = isValid.errors ?? [];
const mapped = errors.map((error: ErrorObject) => {
error.dataPath = `${jsonPath}${error.dataPath}`;
error.instancePath = `${jsonPath}${error.instancePath}`;
return error;
});
throw new SchemaValidationError(filename, `Rule configuration error`, config, schema, mapped);
......
......@@ -242,7 +242,7 @@ describe("rule attr-case", () => {
rules: { "attr-case": ["error", { style: "foobar" }] },
});
}).toThrowErrorMatchingInlineSnapshot(
`"Rule configuration error: /rules/attr-case/1/style should be equal to one of the allowed values: lowercase, uppercase, pascalcase, camelcase"`
`"Rule configuration error: /rules/attr-case/1/style must be equal to one of the allowed values: lowercase, uppercase, pascalcase, camelcase"`
);
});
......
......@@ -182,7 +182,7 @@ describe("rule attr-pattern", () => {
rules: { "attr-pattern": ["error", { pattern: [] }] },
});
}).toThrowErrorMatchingInlineSnapshot(
`"Rule configuration error: /rules/attr-pattern/1/pattern: minItems should NOT have fewer than 1 items"`
`"Rule configuration error: /rules/attr-pattern/1/pattern: minItems must NOT have fewer than 1 items"`
);
});
......
......@@ -131,7 +131,7 @@ describe("rule attr-quotes", () => {
rules: { "attr-quotes": ["error", { style: "foobar" }] },
});
}).toThrowErrorMatchingInlineSnapshot(
`"Rule configuration error: /rules/attr-quotes/1/style should be equal to one of the allowed values: auto, double, single"`
`"Rule configuration error: /rules/attr-quotes/1/style must be equal to one of the allowed values: auto, double, single"`
);
});
......
......@@ -217,7 +217,7 @@ describe("rule attribute-boolean-style", () => {
rules: { "attribute-boolean-style": ["error", { style: "foobar" }] },
});
}).toThrowErrorMatchingInlineSnapshot(
`"Rule configuration error: /rules/attribute-boolean-style/1/style should be equal to one of the allowed values: empty, name, omit"`
`"Rule configuration error: /rules/attribute-boolean-style/1/style must be equal to one of the allowed values: empty, name, omit"`
);
});
......
......@@ -131,7 +131,7 @@ describe("rule attribute-empty-style", () => {
rules: { "attribute-empty-style": ["error", { style: "foobar" }] },
});
}).toThrowErrorMatchingInlineSnapshot(
`"Rule configuration error: /rules/attribute-empty-style/1/style should be equal to one of the allowed values: empty, omit"`
`"Rule configuration error: /rules/attribute-empty-style/1/style must be equal to one of the allowed values: empty, omit"`
);
});
......
......@@ -154,7 +154,7 @@ describe("rule element-case", () => {
rules: { "element-case": ["error", { style: "foobar" }] },
});
}).toThrowErrorMatchingInlineSnapshot(
`"Rule configuration error: /rules/element-case/1/style should be equal to one of the allowed values: lowercase, uppercase, pascalcase, camelcase"`
`"Rule configuration error: /rules/element-case/1/style must be equal to one of the allowed values: lowercase, uppercase, pascalcase, camelcase"`
);
});
......
......@@ -101,7 +101,7 @@ describe("rule void-style", () => {
rules: { "void-style": ["error", { style: "foobar" }] },
});
}).toThrowErrorMatchingInlineSnapshot(
`"Rule configuration error: /rules/void-style/1/style should be equal to one of the allowed values: omit, selfclose, selfclosing"`
`"Rule configuration error: /rules/void-style/1/style must be equal to one of the allowed values: omit, selfclose, selfclosing"`
);
});
......
......@@ -168,7 +168,7 @@ describe("rule void", () => {
rules: { void: ["error", { style: "foobar" }] },
});
}).toThrowErrorMatchingInlineSnapshot(
`"Rule configuration error: /rules/void/1/style should be equal to one of the allowed values: any, omit, selfclose, selfclosing"`
`"Rule configuration error: /rules/void/1/style must be equal to one of the allowed values: any, omit, selfclose, selfclosing"`
);
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment