...
 
Commits (5)
# html-validate changelog
# [2.15.0](https://gitlab.com/html-validate/html-validate/compare/v2.14.0...v2.15.0) (2020-02-09)
### Features
- **plugin:** load `default` transformer if loading named transformer without name ([efb0eb9](https://gitlab.com/html-validate/html-validate/commit/efb0eb9de250ad80f812bd2a0d6bd6c96d21a41a))
# [2.14.0](https://gitlab.com/html-validate/html-validate/compare/v2.13.0...v2.14.0) (2020-02-06)
### Features
......
......@@ -223,6 +223,8 @@ Users may then extend the preset using `plugin:name`, e.g.:
}
```
If you expose a transformer named `default` it will be loaded when using the plugin as name, i.e. `my-plugin` and `my-plugin:default` is equivalent.
## Extend metadata
Plugins can extend the available [element metadata](/usage/elements.html) by
......
{
"name": "html-validate",
"version": "2.14.0",
"version": "2.15.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -3976,9 +3976,9 @@
}
},
"@types/jest": {
"version": "25.1.1",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.1.tgz",
"integrity": "sha512-bKSZJYZJLzwaoVYNN4W3A0RvKNYsrLm5tsuXaMlfYDxKf4gY2sFrMYneCugNQWGg1gjPW+FHBwNrwPzEi4sIsw==",
"version": "25.1.2",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.2.tgz",
"integrity": "sha512-EsPIgEsonlXmYV7GzUqcvORsSS9Gqxw/OvkGwHfAdpjduNRxMlhsav0O5Kb0zijc/eXSO/uW6SJt9nwull8AUQ==",
"dev": true,
"requires": {
"jest-diff": "^25.1.0",
......@@ -3998,9 +3998,9 @@
}
},
"@types/yargs": {
"version": "15.0.2",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.2.tgz",
"integrity": "sha512-hFkuAp58M2xOc1QgJhkFrLMnqa8KWTFRTnzrI1zlEcOfg3DZ0eH3aPAo/N6QlVVu8E4KS4xD1jtEG3rdQYFmIg==",
"version": "15.0.3",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.3.tgz",
"integrity": "sha512-XCMQRK6kfpNBixHLyHUsGmXrpEmFFxzMrcnSXFMziHd8CoNJo8l16FkHyQq4x+xbM7E2XL83/O78OD8u+iZTdQ==",
"dev": true,
"requires": {
"@types/yargs-parser": "*"
......@@ -4287,13 +4287,13 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.15.0.tgz",
"integrity": "sha512-Qkxu5zndY5hqlcQkmA88gfLvqQulMpX/TN91XC7OuXsRf4XG5xLGie0sbpX97o/oeccjeZYRMipIsjKk/tjDHA==",
"version": "2.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.19.0.tgz",
"integrity": "sha512-zwpg6zEOPbhB3+GaQfufzlMUOO6GXCNZq6skk+b2ZkZAIoBhVoanWK255BS1g5x9bMwHpLhX0Rpn5Fc3NdCZdg==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.15.0",
"@typescript-eslint/typescript-estree": "2.19.0",
"eslint-scope": "^5.0.0"
},
"dependencies": {
......@@ -4401,16 +4401,16 @@
}
},
"@typescript-eslint/typescript-estree": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.15.0.tgz",
"integrity": "sha512-L6Pog+w3VZzXkAdyqA0VlwybF8WcwZX+mufso86CMxSdWmcizJ38lgBdpqTbc9bo92iyi0rOvmATKiwl+amjxg==",
"version": "2.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.19.0.tgz",
"integrity": "sha512-n6/Xa37k0jQdwpUszffi19AlNbVCR0sdvCs3DmSKMD7wBttKY31lhD2fug5kMD91B2qW4mQldaTEc1PEzvGu8w==",
"dev": true,
"requires": {
"debug": "^4.1.1",
"eslint-visitor-keys": "^1.1.0",
"glob": "^7.1.6",
"is-glob": "^4.0.1",
"lodash.unescape": "4.0.1",
"lodash": "^4.17.15",
"semver": "^6.3.0",
"tsutils": "^3.17.1"
},
......@@ -9089,58 +9089,12 @@
}
},
"eslint-plugin-jest": {
"version": "23.6.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.6.0.tgz",
"integrity": "sha512-GH8AhcFXspOLqak7fqnddLXEJsrFyvgO8Bm60SexvKSn1+3rWYESnCiWUOCUcBTprNSDSE4CtAZdM4EyV6gPPw==",
"version": "23.7.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.7.0.tgz",
"integrity": "sha512-zkiyGlvJeHNjAEz8FaIxTXNblJJ/zj3waNbYbgflK7K6uy0cpE5zJBt/JpJtOBGM/UGkC6BqsQ4n0y7kQ2HA8w==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "^2.5.0",
"micromatch": "^4.0.2"
},
"dependencies": {
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"requires": {
"fill-range": "^7.0.1"
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"requires": {
"to-regex-range": "^5.0.1"
}
},
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"micromatch": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
"dev": true,
"requires": {
"braces": "^3.0.1",
"picomatch": "^2.0.5"
}
},
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"requires": {
"is-number": "^7.0.0"
}
}
"@typescript-eslint/experimental-utils": "^2.5.0"
}
},
"eslint-plugin-node": {
......@@ -15626,12 +15580,6 @@
"integrity": "sha1-JMS/zWsvuji/0FlNsRedjptlZWE=",
"dev": true
},
"lodash.unescape": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz",
"integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=",
"dev": true
},
"lodash.uniq": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
......
{
"name": "html-validate",
"version": "2.14.0",
"version": "2.15.0",
"description": "html linter",
"keywords": [
"html",
......@@ -105,7 +105,7 @@
"@types/estree": "0.0.42",
"@types/glob": "7.1.1",
"@types/inquirer": "6.5.0",
"@types/jest": "25.1.1",
"@types/jest": "25.1.2",
"@types/json-merge-patch": "0.0.4",
"@types/minimist": "1.2.0",
"@types/node": "11.15.5",
......@@ -119,7 +119,7 @@
"dgeni-packages": "0.28.2",
"eslint-plugin-array-func": "3.1.3",
"eslint-plugin-import": "2.20.1",
"eslint-plugin-jest": "23.6.0",
"eslint-plugin-jest": "23.7.0",
"eslint-plugin-node": "11.0.0",
"eslint-plugin-security": "1.4.0",
"eslint-plugin-sonarjs": "0.5.0",
......
......@@ -400,6 +400,7 @@ describe("config", () => {
"mock-plugin-named",
() => ({
transformer: {
default: transform as Transformer,
foobar: transform as Transformer,
},
}),
......@@ -409,6 +410,7 @@ describe("config", () => {
plugins: ["mock-plugin-unnamed", "mock-plugin-named"],
transform: {
"\\.unnamed$": "mock-plugin-unnamed",
"\\.default$": "mock-plugin-named",
"\\.named$": "mock-plugin-named:foobar",
"\\.nonplugin$": "mock-transform",
},
......@@ -454,6 +456,25 @@ describe("config", () => {
`);
});
it("unnamed default", () => {
expect.assertions(1);
source.filename = "bar.default";
expect(config.transformSource(source)).toMatchInlineSnapshot(`
Array [
Object {
"column": 3,
"data": "transformed from bar.default",
"filename": "bar.default",
"line": 2,
"offset": 4,
"transformedBy": Array [
"mock-plugin-named",
],
},
]
`);
});
it("non-plugin (regression test issue 54)", () => {
expect.assertions(1);
source.filename = "bar.nonplugin";
......
......@@ -601,6 +601,9 @@ export class Config {
}
if (typeof plugin.transformer !== "function") {
if (plugin.transformer.default) {
return plugin.transformer.default;
}
throw new ConfigError(
`Transformer "${name}" refers to unnamed transformer but plugin exposes only named.`
);
......