Skip to content

Commit 90d49f8

Browse files
beefancohengaearon
authored andcommitted
[dependency] - Add select eslint-plugin-jsx-a11y rules to lint config. (#175)
This project is a really good use case to apply some accessibility rules to the lint config. For beginners getting started with React, we can also teach/enforce basic accessibility rules in the web at author time. For now, I’ve just applied to the rules that are listed in `eslint-config-airbnb` because these are most real-world tested, and we can continue to add. Happy to help if there are any questions/issues/concerns about the plugin!
1 parent 9dc23a3 commit 90d49f8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

config/eslint.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
parser: 'babel-eslint',
2525

2626
// import plugin is termporarily disabled, scroll below to see why
27-
plugins: ['react'/*, 'import'*/],
27+
plugins: ['react'/*, 'import'*/, 'jsx-a11y'],
2828

2929
env: {
3030
es6: true,
@@ -191,6 +191,12 @@ module.exports = {
191191
'react/no-direct-mutation-state': WARNING,
192192
'react/no-is-mounted': WARNING,
193193
'react/react-in-jsx-scope': WARNING,
194-
'react/require-render-return': WARNING
194+
'react/require-render-return': WARNING,
195+
196+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
197+
'jsx-a11y/aria-role': WARNING,
198+
'jsx-a11y/img-has-alt': WARNING,
199+
'jsx-a11y/img-redundant-alt': WARNING,
200+
'jsx-a11y/no-access-key': WARNING
195201
}
196202
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"eslint": "3.1.1",
4545
"eslint-loader": "1.4.1",
4646
"eslint-plugin-import": "1.10.3",
47+
"eslint-plugin-jsx-a11y": "2.0.1",
4748
"eslint-plugin-react": "5.2.2",
4849
"extract-text-webpack-plugin": "1.0.1",
4950
"file-loader": "0.9.0",

0 commit comments

Comments
 (0)