Commit 8deb03a2 authored by David Sveningsson's avatar David Sveningsson

fix(htmlvalidate): prefer html-validate:recommended

parent 9e7ea3e2
......@@ -26,7 +26,7 @@ markup["frontpage-components"] = `<my-inline>
describe("docs/index.md", () => {
it("inline validation: frontpage-contentmodel", () => {
const htmlvalidate = new HtmlValidate({"extends":["htmlvalidate:recommended"]});
const htmlvalidate = new HtmlValidate({"extends":["html-validate:recommended"]});
const report = htmlvalidate.validateString(markup["frontpage-contentmodel"]);
expect(report.results).toMatchSnapshot();
});
......@@ -36,7 +36,7 @@ describe("docs/index.md", () => {
expect(report.results).toMatchSnapshot();
});
it("inline validation: frontpage-components", () => {
const htmlvalidate = new HtmlValidate({"elements":["html5",{"my-inline":{"phrasing":true,"permittedContent":["@phrasing"]},"my-block":{"flow":true},"my-deprecated":{"phrasing":true,"deprecated":"replaced with <my-other>"}}],"extends":["htmlvalidate:recommended"]});
const htmlvalidate = new HtmlValidate({"elements":["html5",{"my-inline":{"phrasing":true,"permittedContent":["@phrasing"]},"my-block":{"flow":true},"my-deprecated":{"phrasing":true,"deprecated":"replaced with <my-other>"}}],"extends":["html-validate:recommended"]});
const report = htmlvalidate.validateString(markup["frontpage-components"]);
expect(report.results).toMatchSnapshot();
});
......
......@@ -28,7 +28,7 @@ constructor:
```typescript
const htmlvalidate = new HtmlValidate({
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
});
```
......
......@@ -106,7 +106,7 @@ module.exports = function parseValidatesProcessor(
return dst;
}, {});
} else {
config.extends = ["htmlvalidate:recommended"];
config.extends = ["html-validate:recommended"];
}
return config;
}
......
{
"extends": ["htmlvalidate:recommended", "htmlvalidate:document"],
"extends": ["html-validate:recommended", "html-validate:document"],
"rules": {
"no-trailing-whitespace": "off",
"require-sri": "off"
......
{
"extends": ["htmlvalidate:recommended"]
"extends": ["html-validate:recommended"]
}
......@@ -4,6 +4,6 @@
@description
Rules with <span class="fa fa-check"></span> are enabled by
`htmlvalidate:recommended`.<br>
`html-validate:recommended`.<br>
Rules with <span class="fa fa-file-text-o"></span> are enabled by
`htmlvalidate:document`.
`html-validate:document`.
......@@ -18,7 +18,7 @@ Create `.htmlvalidate.json`:
```js
{
"extends": [
"htmlvalidate:recommended"
"html-validate:recommended"
],
}
```
......
......@@ -102,7 +102,7 @@ textual description of the content. E.g. it cannot suggest to use `<abbr>` or
</tr>
<tr>
<td class="table-right">H44</td>
<td>Using label elements to associate text labels with form controls.<em>Use {@link rule:input-missing-label} to validate. Rule is only enabled by default in document mode (<code>htmlvalidate:document</code>).</em></td>
<td>Using label elements to associate text labels with form controls.<em>Use {@link rule:input-missing-label} to validate. Rule is only enabled by default in document mode (<code>html-validate:document</code>).</em></td>
<td class="support-yes">Yes</td>
</tr>
<tr>
......
......@@ -143,7 +143,7 @@ const tagNames = [
describe("HTML elements", () => {
const htmlvalidate = new HtmlValidate({
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
elements: [
"html5",
{
......
......@@ -6,7 +6,7 @@ exports[`should generate configuration for angularjs 1`] = `
\\"html5\\"
],
\\"extends\\": [
\\"htmlvalidate:recommended\\"
\\"html-validate:recommended\\"
],
\\"transform\\": {
\\"^.*\\\\\\\\.js$\\": \\"html-validate-angular/js\\",
......@@ -21,7 +21,7 @@ exports[`should generate configuration for combined 1`] = `
\\"html5\\"
],
\\"extends\\": [
\\"htmlvalidate:recommended\\",
\\"html-validate:recommended\\",
\\"html-valudate-vue:recommended\\"
],
\\"transform\\": {
......@@ -42,7 +42,7 @@ exports[`should generate configuration for default 1`] = `
\\"html5\\"
],
\\"extends\\": [
\\"htmlvalidate:recommended\\"
\\"html-validate:recommended\\"
]
}"
`;
......@@ -53,7 +53,7 @@ exports[`should generate configuration for markdown 1`] = `
\\"html5\\"
],
\\"extends\\": [
\\"htmlvalidate:recommended\\"
\\"html-validate:recommended\\"
],
\\"transform\\": {
\\"^.*\\\\\\\\.md$\\": \\"html-validate-markdown\\"
......@@ -67,7 +67,7 @@ exports[`should generate configuration for vuejs 1`] = `
\\"html5\\"
],
\\"extends\\": [
\\"htmlvalidate:recommended\\",
\\"html-validate:recommended\\",
\\"html-valudate-vue:recommended\\"
],
\\"plugins\\": [
......
......@@ -16,7 +16,7 @@ describe("CLI", () => {
const cli = new CLI();
const htmlvalidate = cli.getValidator();
expect(HtmlValidate).toHaveBeenCalledWith({
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
});
expect(htmlvalidate).toBeDefined();
});
......
......@@ -56,7 +56,7 @@ export async function init(cwd: string): Promise<InitResult> {
const exists = fs.existsSync(filename);
const initialConfig: ConfigData = {
elements: ["html5"],
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
};
const when = /* istanbul ignore next */ (answers: any): boolean => {
return !exists || answers.write;
......
......@@ -3,7 +3,7 @@
exports[`ConfigLoader smoketest test-files/config/directive/disable.html 1`] = `
Object {
"extends": Array [
"htmlvalidate:recommended",
"html-validate:recommended",
],
"plugins": Array [],
"rules": Object {
......@@ -59,7 +59,7 @@ Array [
exports[`ConfigLoader smoketest test-files/config/directive/disable-block.html 1`] = `
Object {
"extends": Array [
"htmlvalidate:recommended",
"html-validate:recommended",
],
"plugins": Array [],
"rules": Object {
......@@ -146,7 +146,7 @@ Should handle when root element is parent but no children
exports[`ConfigLoader smoketest test-files/config/directive/disable-multiple.html 1`] = `
Object {
"extends": Array [
"htmlvalidate:recommended",
"html-validate:recommended",
],
"plugins": Array [],
"rules": Object {
......@@ -199,7 +199,7 @@ Array [
exports[`ConfigLoader smoketest test-files/config/directive/disable-next.html 1`] = `
Object {
"extends": Array [
"htmlvalidate:recommended",
"html-validate:recommended",
],
"plugins": Array [],
"rules": Object {
......@@ -256,7 +256,7 @@ Object {
"<rootDir>/test-files/config/elements/elements.json",
],
"extends": Array [
"htmlvalidate:recommended",
"html-validate:recommended",
],
"plugins": Array [],
"rules": Object {
......@@ -312,7 +312,7 @@ Array [
exports[`ConfigLoader smoketest test-files/config/file.html 1`] = `
Object {
"extends": Array [
"htmlvalidate:recommended",
"html-validate:recommended",
],
"plugins": Array [],
"rules": Object {
......@@ -352,7 +352,7 @@ Array [
exports[`ConfigLoader smoketest test-files/config/off/error/file.html 1`] = `
Object {
"extends": Array [
"htmlvalidate:recommended",
"html-validate:recommended",
],
"plugins": Array [],
"rules": Object {
......@@ -392,7 +392,7 @@ Array [
exports[`ConfigLoader smoketest test-files/config/off/file.html 1`] = `
Object {
"extends": Array [
"htmlvalidate:recommended",
"html-validate:recommended",
],
"plugins": Array [],
"rules": Object {
......@@ -409,7 +409,7 @@ exports[`ConfigLoader smoketest test-files/config/off/file.html 2`] = `Array []`
exports[`ConfigLoader smoketest test-files/config/warn/file.html 1`] = `
Object {
"extends": Array [
"htmlvalidate:recommended",
"html-validate:recommended",
],
"plugins": Array [],
"rules": Object {
......
......@@ -66,7 +66,7 @@ describe("config", () => {
it("defaultConfig() should load defaults", () => {
const config = Config.defaultConfig();
expect(config.get()).toEqual({
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
rules: expect.any(Object),
plugins: [],
transform: {},
......@@ -212,6 +212,13 @@ describe("config", () => {
);
});
it("should support html-validate:recommended", () => {
const config = Config.fromObject({
extends: ["html-validate:recommended"],
});
expect(config.getRules()).toBeDefined();
});
it("should support htmlvalidate:recommended", () => {
const config = Config.fromObject({
extends: ["htmlvalidate:recommended"],
......@@ -219,6 +226,13 @@ describe("config", () => {
expect(config.getRules()).toBeDefined();
});
it("should support html-validate:document", () => {
const config = Config.fromObject({
extends: ["html-validate:document"],
});
expect(config.getRules()).toBeDefined();
});
it("should support htmlvalidate:document", () => {
const config = Config.fromObject({
extends: ["htmlvalidate:document"],
......
......@@ -117,7 +117,7 @@ export class Config {
* configuration for a file to validate use `ConfigLoader.fromTarget()`.
*
* @param filename - The file to read from or one of the presets such as
* `htmlvalidate:recommended`.
* `html-validate:recommended`.
*/
public static fromFile(filename: string): Config {
const configdata = loadFromFile(filename);
......@@ -343,6 +343,10 @@ export class Config {
const configs: Map<string, ConfigData> = new Map();
/* builtin presets */
configs.set("html-validate:recommended", recommended);
configs.set("html-validate:document", document);
/* aliases for convenience */
configs.set("htmlvalidate:recommended", recommended);
configs.set("htmlvalidate:document", document);
......
export default {
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
};
......@@ -74,7 +74,7 @@ describe("Engine", () => {
beforeEach(() => {
config = Config.fromObject({
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
rules: {
deprecated: "off",
},
......
......@@ -43,7 +43,7 @@ describe("HtmlValidate", () => {
const htmlvalidate = new HtmlValidate();
expect((htmlvalidate as any).globalConfig.config).toEqual(
expect.objectContaining({
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
})
);
});
......
......@@ -117,7 +117,7 @@ it("should handle source missing properties", () => {
};
const htmlvalidate = new HtmlValidate({
root: true,
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
});
const report = htmlvalidate.validateSource(source as Source);
expect(report).toBeInvalid();
......
......@@ -1006,7 +1006,7 @@ describe("parser", () => {
beforeEach(() => {
htmlvalidate = new HtmlValidate({
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
});
});
......
......@@ -34,7 +34,7 @@ describe("regression tests", () => {
for (const filename of glob.sync("test-files/issues/**/*.html")) {
it(filename, () => {
const htmlvalidate = new HtmlValidate({
extends: ["htmlvalidate:recommended"],
extends: ["html-validate:recommended"],
transform: {
".*": "mock-transformer",
},
......
Markdown is supported
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