diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json
index 0d7f6f3d..dccb7d05 100644
--- a/packages/eslint-config-airbnb/package.json
+++ b/packages/eslint-config-airbnb/package.json
@@ -45,24 +45,27 @@
},
"homepage": "https://github.com/airbnb/javascript",
"dependencies": {
- "eslint-config-airbnb-base": "^3.0.1"
+ "eslint-config-airbnb-base": "^5.0.1"
},
"devDependencies": {
"babel-preset-airbnb": "^2.0.0",
"babel-tape-runner": "^2.0.1",
- "eslint": "^2.10.2",
- "eslint-find-rules": "^1.9.2",
- "eslint-plugin-import": "^1.8.0",
- "eslint-plugin-jsx-a11y": "^1.2.2",
- "eslint-plugin-react": "^5.1.1",
+ "eslint": "^3.2.2",
+ "eslint-find-rules": "^1.11.1",
+ "eslint-plugin-import": "^1.12.0",
+ "eslint-plugin-jsx-a11y": "^2.0.1",
+ "eslint-plugin-react": "^6.0.0",
"in-publish": "^2.0.0",
"react": ">= 0.13.0",
- "tape": "^4.5.1"
+ "tape": "^4.6.0"
},
"peerDependencies": {
- "eslint": "^2.10.2",
- "eslint-plugin-jsx-a11y": "^1.2.2",
- "eslint-plugin-import": "^1.8.0",
- "eslint-plugin-react": "^5.1.1"
+ "eslint": "^3.2.2",
+ "eslint-plugin-jsx-a11y": "^2.0.1",
+ "eslint-plugin-import": "^1.12.0",
+ "eslint-plugin-react": "^6.0.0"
+ },
+ "engines": {
+ "node": ">= 4"
}
}
diff --git a/packages/eslint-config-airbnb/rules/react-a11y.js b/packages/eslint-config-airbnb/rules/react-a11y.js
index 6ba17e8e..4b19fd07 100644
--- a/packages/eslint-config-airbnb/rules/react-a11y.js
+++ b/packages/eslint-config-airbnb/rules/react-a11y.js
@@ -30,7 +30,7 @@ module.exports = {
// disallow href "#"
// TODO: enable
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/href-no-hash.md
- 'jsx-a11y/href-no-hash': 0,
+ 'jsx-a11y/href-no-hash': [0, ['a']],
// Require
to have a non-empty `alt` prop, or role="presentation"
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-has-alt.md
@@ -43,7 +43,7 @@ module.exports = {
// require that JSX labels use "htmlFor"
// TODO: enable
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md
- 'jsx-a11y/label-has-for': 0,
+ 'jsx-a11y/label-has-for': [0, ['label']],
// require that mouseover/out come with focus/blur, for keyboard-only users
// TODO: enable?
@@ -83,5 +83,30 @@ module.exports = {
// TODO: evaluate
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md
'jsx-a11y/tabindex-no-positive': 0,
+
+ // ensure tags have content and are not aria-hidden
+ // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
+ // TODO: enable
+ 'jsx-a11y/heading-has-content': [0, ['']],
+
+ // require HTML elements to have a "lang" prop
+ // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
+ // TODO: enable
+ 'jsx-a11y/html-has-lang': 0,
+
+ // require HTML element's lang prop to be valid
+ // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
+ // TODO: enable
+ 'jsx-a11y/lang': 0,
+
+ // prevent marquee elements
+ // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-marquee.md
+ // TODO: enable, pardner
+ 'jsx-a11y/no-marquee': 0,
+
+ // only allow to have the "scope" attr
+ // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
+ // TODO: enable
+ 'jsx-a11y/scope': 0,
},
};
diff --git a/packages/eslint-config-airbnb/rules/react.js b/packages/eslint-config-airbnb/rules/react.js
index 57884823..f0fd07d8 100644
--- a/packages/eslint-config-airbnb/rules/react.js
+++ b/packages/eslint-config-airbnb/rules/react.js
@@ -89,6 +89,7 @@ module.exports = {
'react/sort-prop-types': [0, {
ignoreCase: false,
callbacksLast: false,
+ requiredFirst: false,
}],
// Deprecated in favor of react/jsx-sort-props
@@ -99,11 +100,13 @@ module.exports = {
'react/jsx-sort-props': [0, {
ignoreCase: false,
callbacksLast: false,
+ shorthandFirst: false,
+ shorthandLast: false,
}],
// Prevent React to be incorrectly marked as unused
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
- 'react/jsx-uses-react': [2, { pragma: 'React' }],
+ 'react/jsx-uses-react': [2],
// Prevent variables used in JSX to be incorrectly marked as unused
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
@@ -115,15 +118,15 @@ module.exports = {
// Prevent usage of deprecated methods
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
- 'react/no-deprecated': [1, { react: '0.14.0' }],
+ 'react/no-deprecated': [1],
// Prevent usage of setState in componentDidMount
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
- 'react/no-did-mount-set-state': [2, 'allow-in-func'],
+ 'react/no-did-mount-set-state': [2],
// Prevent usage of setState in componentDidUpdate
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
- 'react/no-did-update-set-state': [2, 'allow-in-func'],
+ 'react/no-did-update-set-state': [2],
// Prevent direct mutation of this.state
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
@@ -167,7 +170,7 @@ module.exports = {
// Restrict file extensions that may be required
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-extension.md
- 'react/require-extension': [0, { extensions: ['.jsx'] }],
+ 'react/require-extension': [0, { extensions: ['.jsx', '.js'] }],
// Require render() methods to return something
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
@@ -196,12 +199,13 @@ module.exports = {
}],
// Prevent missing parentheses around multilines JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
- 'react/wrap-multilines': [2, {
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
+ 'react/jsx-wrap-multilines': [2, {
declaration: true,
assignment: true,
return: true
}],
+ 'react/wrap-multilines': 0, // deprecated version
// Require that the first prop in a JSX element be on a new line when the element is multiline
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
@@ -218,7 +222,32 @@ module.exports = {
// Disallow target="_blank" on links
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
// TODO: enable
- 'react/jsx-no-target-blank': 0
+ 'react/jsx-no-target-blank': 0,
+
+ // only .jsx files may have JSX
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
+ // TODO: enable
+ 'react/jsx-filename-extension': [0, { extensions: ['.jsx'] }],
+
+ // prevent accidental JS comments from being injected into JSX as text
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
+ // TODO: enable
+ 'react/jsx-no-comment-textnodes': 0,
+ 'react/no-comment-textnodes': 0, // deprecated version
+
+ // disallow using React.render/ReactDOM.render's return value
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
+ // TODO: enable
+ 'react/no-render-return-value': 0,
+
+ // require a shouldComponentUpdate method, or PureRenderMixin
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
+ 'react/require-optimization': [0, { allowDecorators: [] }],
+
+ // warn against using findDOMNode()
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
+ // TODO: enable
+ 'react/no-find-dom-node': 0,
},
settings: {
diff --git a/packages/eslint-config-airbnb/test/test-react-order.js b/packages/eslint-config-airbnb/test/test-react-order.js
index 016fef9d..5fd4f3b8 100644
--- a/packages/eslint-config-airbnb/test/test-react-order.js
+++ b/packages/eslint-config-airbnb/test/test-react-order.js
@@ -27,6 +27,7 @@ function lint(text) {
function wrapComponent(body) {
return `
import React from 'react';
+
export default class MyComponent extends React.Component {
/* eslint no-empty-function: 0 */
${body}
|