Skip to content

Commit cb36ed9

Browse files
committed
[eslint config] [deps] [breaking] update eslint to v3, eslint-config-airbnb-base to v5, eslint-find-rules, eslint-plugin-import, eslint-plugin-jsx-a11y to v2, eslint-plugin-react to v6, tape.
- drop node < 4 support
1 parent 75c961a commit cb36ed9

File tree

4 files changed

+79
-21
lines changed

4 files changed

+79
-21
lines changed

packages/eslint-config-airbnb/package.json

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,27 @@
4545
},
4646
"homepage": "https://github.com/airbnb/javascript",
4747
"dependencies": {
48-
"eslint-config-airbnb-base": "^3.0.1"
48+
"eslint-config-airbnb-base": "^5.0.1"
4949
},
5050
"devDependencies": {
5151
"babel-preset-airbnb": "^2.0.0",
5252
"babel-tape-runner": "^2.0.1",
53-
"eslint": "^2.10.2",
54-
"eslint-find-rules": "^1.9.2",
55-
"eslint-plugin-import": "^1.8.0",
56-
"eslint-plugin-jsx-a11y": "^1.2.2",
57-
"eslint-plugin-react": "^5.1.1",
53+
"eslint": "^3.2.2",
54+
"eslint-find-rules": "^1.11.1",
55+
"eslint-plugin-import": "^1.12.0",
56+
"eslint-plugin-jsx-a11y": "^2.0.1",
57+
"eslint-plugin-react": "^6.0.0",
5858
"in-publish": "^2.0.0",
5959
"react": ">= 0.13.0",
60-
"tape": "^4.5.1"
60+
"tape": "^4.6.0"
6161
},
6262
"peerDependencies": {
63-
"eslint": "^2.10.2",
64-
"eslint-plugin-jsx-a11y": "^1.2.2",
65-
"eslint-plugin-import": "^1.8.0",
66-
"eslint-plugin-react": "^5.1.1"
63+
"eslint": "^3.2.2",
64+
"eslint-plugin-jsx-a11y": "^2.0.1",
65+
"eslint-plugin-import": "^1.12.0",
66+
"eslint-plugin-react": "^6.0.0"
67+
},
68+
"engines": {
69+
"node": ">= 4"
6770
}
6871
}

packages/eslint-config-airbnb/rules/react-a11y.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = {
3030
// disallow href "#"
3131
// TODO: enable
3232
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/href-no-hash.md
33-
'jsx-a11y/href-no-hash': 0,
33+
'jsx-a11y/href-no-hash': [0, ['a']],
3434

3535
// Require <img> to have a non-empty `alt` prop, or role="presentation"
3636
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-has-alt.md
@@ -43,7 +43,7 @@ module.exports = {
4343
// require that JSX labels use "htmlFor"
4444
// TODO: enable
4545
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md
46-
'jsx-a11y/label-has-for': 0,
46+
'jsx-a11y/label-has-for': [0, ['label']],
4747

4848
// require that mouseover/out come with focus/blur, for keyboard-only users
4949
// TODO: enable?
@@ -83,5 +83,30 @@ module.exports = {
8383
// TODO: evaluate
8484
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md
8585
'jsx-a11y/tabindex-no-positive': 0,
86+
87+
// ensure <hX> tags have content and are not aria-hidden
88+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
89+
// TODO: enable
90+
'jsx-a11y/heading-has-content': [0, ['']],
91+
92+
// require HTML elements to have a "lang" prop
93+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
94+
// TODO: enable
95+
'jsx-a11y/html-has-lang': 0,
96+
97+
// require HTML element's lang prop to be valid
98+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
99+
// TODO: enable
100+
'jsx-a11y/lang': 0,
101+
102+
// prevent marquee elements
103+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-marquee.md
104+
// TODO: enable, pardner
105+
'jsx-a11y/no-marquee': 0,
106+
107+
// only allow <th> to have the "scope" attr
108+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
109+
// TODO: enable
110+
'jsx-a11y/scope': 0,
86111
},
87112
};

packages/eslint-config-airbnb/rules/react.js

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ module.exports = {
8989
'react/sort-prop-types': [0, {
9090
ignoreCase: false,
9191
callbacksLast: false,
92+
requiredFirst: false,
9293
}],
9394

9495
// Deprecated in favor of react/jsx-sort-props
@@ -99,11 +100,13 @@ module.exports = {
99100
'react/jsx-sort-props': [0, {
100101
ignoreCase: false,
101102
callbacksLast: false,
103+
shorthandFirst: false,
104+
shorthandLast: false,
102105
}],
103106

104107
// Prevent React to be incorrectly marked as unused
105108
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
106-
'react/jsx-uses-react': [2, { pragma: 'React' }],
109+
'react/jsx-uses-react': [2],
107110

108111
// Prevent variables used in JSX to be incorrectly marked as unused
109112
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
@@ -115,15 +118,15 @@ module.exports = {
115118

116119
// Prevent usage of deprecated methods
117120
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
118-
'react/no-deprecated': [1, { react: '0.14.0' }],
121+
'react/no-deprecated': [1],
119122

120123
// Prevent usage of setState in componentDidMount
121124
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
122-
'react/no-did-mount-set-state': [2, 'allow-in-func'],
125+
'react/no-did-mount-set-state': [2],
123126

124127
// Prevent usage of setState in componentDidUpdate
125128
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
126-
'react/no-did-update-set-state': [2, 'allow-in-func'],
129+
'react/no-did-update-set-state': [2],
127130

128131
// Prevent direct mutation of this.state
129132
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
@@ -167,7 +170,7 @@ module.exports = {
167170

168171
// Restrict file extensions that may be required
169172
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-extension.md
170-
'react/require-extension': [0, { extensions: ['.jsx'] }],
173+
'react/require-extension': [0, { extensions: ['.jsx', '.js'] }],
171174

172175
// Require render() methods to return something
173176
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
@@ -196,12 +199,13 @@ module.exports = {
196199
}],
197200

198201
// Prevent missing parentheses around multilines JSX
199-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
200-
'react/wrap-multilines': [2, {
202+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
203+
'react/jsx-wrap-multilines': [2, {
201204
declaration: true,
202205
assignment: true,
203206
return: true
204207
}],
208+
'react/wrap-multilines': 0, // deprecated version
205209

206210
// Require that the first prop in a JSX element be on a new line when the element is multiline
207211
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
@@ -218,7 +222,32 @@ module.exports = {
218222
// Disallow target="_blank" on links
219223
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
220224
// TODO: enable
221-
'react/jsx-no-target-blank': 0
225+
'react/jsx-no-target-blank': 0,
226+
227+
// only .jsx files may have JSX
228+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
229+
// TODO: enable
230+
'react/jsx-filename-extension': [0, { extensions: ['.jsx'] }],
231+
232+
// prevent accidental JS comments from being injected into JSX as text
233+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
234+
// TODO: enable
235+
'react/jsx-no-comment-textnodes': 0,
236+
'react/no-comment-textnodes': 0, // deprecated version
237+
238+
// disallow using React.render/ReactDOM.render's return value
239+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
240+
// TODO: enable
241+
'react/no-render-return-value': 0,
242+
243+
// require a shouldComponentUpdate method, or PureRenderMixin
244+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
245+
'react/require-optimization': [0, { allowDecorators: [] }],
246+
247+
// warn against using findDOMNode()
248+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
249+
// TODO: enable
250+
'react/no-find-dom-node': 0,
222251
},
223252

224253
settings: {

packages/eslint-config-airbnb/test/test-react-order.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function lint(text) {
2727
function wrapComponent(body) {
2828
return `
2929
import React from 'react';
30+
3031
export default class MyComponent extends React.Component {
3132
/* eslint no-empty-function: 0 */
3233
${body}

0 commit comments

Comments
 (0)