diff --git a/CHANGELOG.md b/CHANGELOG.md index 05d2d37e78..c65ae2fbec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v.5.1.0 (28.12.2016) +* (feature) Include rules for eslint-plugin-jsx-a11y. Consumers must explicit included the rules. + ## v.5.0.1 (18.10.2016) * (patch) Remove eslint-plugin-import from peerDependencies, we get that from eslint-config-ffe-base. To avoid having to maintain the version number in two places. diff --git a/README.md b/README.md index 7b860bac6c..db763d1b34 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,23 @@ Create .eslintsrc and extend this config. } ``` -if you are not using react see eslint-config-ffe-base +If you are not using React see eslint-config-ffe-base. + +### jsx-a11y-plugin + +Additionally install the a11y-plugin: + +```bash +npm i -D eslint-plugin-jsx-a11y +``` + +Include the rules in .eslintsrc: + +```json +{ + "extends": [ + "ffe", + "ffe/rules/jsx-a11y" + ] +} +``` diff --git a/package.json b/package.json index 816e096b95..57fe44e529 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-ffe", - "version": "5.0.1", + "version": "5.1.2", "description": "", "main": "index.js", "scripts": { diff --git a/rules/jsx-a11y.js b/rules/jsx-a11y.js new file mode 100644 index 0000000000..4e2ed31fab --- /dev/null +++ b/rules/jsx-a11y.js @@ -0,0 +1,70 @@ +module.exports = { + plugins: [ + 'jsx-a11y' + ], + rules: { + // Enforce all anchors to contain accessible content. + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md + "jsx-a11y/aria-props": 2, + + // Enforce all aria-* props are valid. + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md + "jsx-a11y/aria-proptypes": 2, + + // Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role. + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md + "jsx-a11y/aria-role": 2, + + // Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes. + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md + "jsx-a11y/aria-unsupported-elements": 2, + + // Enforce an anchor element's href prop value is not just #. + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/href-no-hash.md + "jsx-a11y/href-no-hash": 2, + + // Enforce that JSX elements use the alt prop. + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-has-alt.md + "jsx-a11y/img-has-alt": 2, + + // Enforce alt prop does not contain the word "image", "picture", or "photo". + // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md + "jsx-a11y/img-redundant-alt": 2, + + // Enforce that