@scm-manager/eslint-config
Advanced tools
{ | ||
"name": "@scm-manager/eslint-config", | ||
"version": "2.12.0", | ||
"version": "2.13.0", | ||
"description": "ESLint configuration for scm-manager and its plugins", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -52,2 +52,15 @@ /* | ||
"jsx-a11y/href-no-hash": "off", | ||
"jsx-a11y/alt-text": [ 2, { | ||
"elements": [ "img", "area", "input[type=\"image\"]" ] | ||
}], | ||
"jsx-a11y/aria-role": [ 2, { | ||
"ignoreNonDOM": true | ||
}], | ||
"jsx-a11y/aria-unsupported-elements": 2, | ||
"jsx-a11y/html-has-lang": 2, | ||
"jsx-a11y/autocomplete-valid": 2, | ||
"jsx-a11y/heading-has-content": 2, | ||
"jsx-a11y/img-redundant-alt": [ 2, { | ||
"words": [ "image", "photo", "picture" ], | ||
}], | ||
"no-restricted-imports": ["error", restrictImportConfig], | ||
@@ -54,0 +67,0 @@ ...rules, |
@@ -27,3 +27,3 @@ /* | ||
const path = require("path"); | ||
const config = require("./index") | ||
const config = require("./index"); | ||
@@ -83,2 +83,50 @@ const eslint = new ESLint({ | ||
}); | ||
it("should return errors for image without alt", async () => { | ||
const { errors, warnings } = await lint("WithoutAlt.tsx"); | ||
expect(errors).toEqual(["jsx-a11y/alt-text"]); | ||
expect(warnings).toEqual([]); | ||
}); | ||
it("should return errors for invalid image alt", async () => { | ||
const { errors, warnings } = await lint("WrongImageAlt.tsx"); | ||
expect(errors).toEqual(["jsx-a11y/img-redundant-alt"]); | ||
expect(warnings).toEqual([]); | ||
}); | ||
it("should return no errors for elements with alt", async () => { | ||
const { errors, warnings } = await lint("WithAlt.tsx"); | ||
expect(errors).toEqual([]); | ||
expect(warnings).toEqual([]); | ||
}); | ||
it("should return errors for header without content", async () => { | ||
const { errors, warnings } = await lint("HeaderWithoutContent.tsx"); | ||
expect(errors).toEqual(["jsx-a11y/heading-has-content"]); | ||
expect(warnings).toEqual([]); | ||
}); | ||
it("should return errors for wrong autocomplete", async () => { | ||
const { errors, warnings } = await lint("AutoComplete.tsx"); | ||
expect(errors).toEqual(["jsx-a11y/autocomplete-valid"]); | ||
expect(warnings).toEqual([]); | ||
}); | ||
it("should return errors for html without lang", async () => { | ||
const { errors, warnings } = await lint("HtmlWithoutLang.tsx"); | ||
expect(errors).toEqual(["jsx-a11y/html-has-lang"]); | ||
expect(warnings).toEqual([]); | ||
}); | ||
it("should return errors for invalid aria role", async () => { | ||
const { errors, warnings } = await lint("InvalidAriaRole.tsx"); | ||
expect(errors).toEqual(["jsx-a11y/aria-role"]); | ||
expect(warnings).toEqual([]); | ||
}); | ||
it("should return errors for empty aria role", async () => { | ||
const { errors, warnings } = await lint("EmptyAriaRole.tsx"); | ||
expect(errors).toEqual(["jsx-a11y/aria-role"]); | ||
expect(warnings).toEqual([]); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
31965
89.44%20
66.67%562
83.66%