mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 15:37:55 -05:00
Compare commits
5 Commits
eslint-con
...
es5-deprec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4d8543f12 | ||
|
|
a6da4bb5b2 | ||
|
|
6857f7af97 | ||
|
|
cb36ed90c3 | ||
|
|
75c961a43f |
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,25 +12,21 @@ module.exports = {
|
||||
'jsx-a11y/aria-role': 2,
|
||||
|
||||
// Enforce all aria-* props are valid.
|
||||
// TODO: enable
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md
|
||||
'jsx-a11y/aria-props': 0,
|
||||
'jsx-a11y/aria-props': 2,
|
||||
|
||||
// Enforce ARIA state and property values are valid.
|
||||
// TODO: enable
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md
|
||||
'jsx-a11y/aria-proptypes': 0,
|
||||
'jsx-a11y/aria-proptypes': 2,
|
||||
|
||||
// Enforce that elements that do not support ARIA roles, states, and
|
||||
// properties do not have those attributes.
|
||||
// TODO: enable
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md
|
||||
'jsx-a11y/aria-unsupported-elements': 0,
|
||||
'jsx-a11y/aria-unsupported-elements': 2,
|
||||
|
||||
// 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': [2, ['a']],
|
||||
|
||||
// Require <img> 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
|
||||
@@ -41,12 +37,11 @@ module.exports = {
|
||||
'jsx-a11y/img-redundant-alt': 2,
|
||||
|
||||
// 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': [2, ['label']],
|
||||
|
||||
// require that mouseover/out come with focus/blur, for keyboard-only users
|
||||
// TODO: enable?
|
||||
// TODO: evaluate
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md
|
||||
'jsx-a11y/mouse-events-have-key-events': 0,
|
||||
|
||||
@@ -69,19 +64,37 @@ module.exports = {
|
||||
|
||||
// Enforce that elements with ARIA roles must have all required attributes
|
||||
// for that role.
|
||||
// TODO: enable
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md
|
||||
'jsx-a11y/role-has-required-aria-props': 0,
|
||||
'jsx-a11y/role-has-required-aria-props': 2,
|
||||
|
||||
// Enforce that elements with explicit or implicit roles defined contain
|
||||
// only aria-* properties supported by that role.
|
||||
// TODO: enable
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md
|
||||
'jsx-a11y/role-supports-aria-props': 0,
|
||||
'jsx-a11y/role-supports-aria-props': 2,
|
||||
|
||||
// Enforce tabIndex value is not greater than zero.
|
||||
// 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 <hX> tags have content and are not aria-hidden
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
|
||||
'jsx-a11y/heading-has-content': [2, ['']],
|
||||
|
||||
// require HTML elements to have a "lang" prop
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
|
||||
'jsx-a11y/html-has-lang': 2,
|
||||
|
||||
// require HTML element's lang prop to be valid
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
|
||||
'jsx-a11y/lang': 2,
|
||||
|
||||
// prevent marquee elements
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-marquee.md
|
||||
'jsx-a11y/no-marquee': 2,
|
||||
|
||||
// only allow <th> to have the "scope" attr
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
|
||||
'jsx-a11y/scope': 2,
|
||||
},
|
||||
};
|
||||
|
||||
42
packages/eslint-config-airbnb/rules/react.js
vendored
42
packages/eslint-config-airbnb/rules/react.js
vendored
@@ -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': [2],
|
||||
|
||||
// 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': [2, { 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
|
||||
@@ -217,8 +221,28 @@ 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': 2,
|
||||
|
||||
// only .jsx files may have JSX
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
||||
'react/jsx-filename-extension': [2, { 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
|
||||
'react/jsx-no-comment-textnodes': 2,
|
||||
'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
|
||||
'react/no-render-return-value': 2,
|
||||
|
||||
// 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
|
||||
'react/no-find-dom-node': 2,
|
||||
},
|
||||
|
||||
settings: {
|
||||
|
||||
@@ -9,9 +9,6 @@ const cli = new CLIEngine({
|
||||
baseConfig: eslintrc,
|
||||
|
||||
rules: {
|
||||
// This rule fails when executing on text.
|
||||
indent: 0,
|
||||
|
||||
// It is okay to import devDependencies in tests.
|
||||
'import/no-extraneous-dependencies': [2, { devDependencies: true }],
|
||||
},
|
||||
@@ -27,6 +24,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}
|
||||
|
||||
@@ -574,6 +574,6 @@
|
||||
-  **Chinese (Simplified)**: [JasonBoy/javascript](https://github.com/JasonBoy/javascript/tree/master/react)
|
||||
-  **Polish**: [pietraszekl/javascript](https://github.com/pietraszekl/javascript/tree/master/react)
|
||||
-  **Korean**: [apple77y/javascript](https://github.com/apple77y/javascript/tree/master/react)
|
||||
-  **Brazilian**: [ronal2do/javascript](https://github.com/ronal2do/airbnb-react-styleguide)
|
||||
-  **Portuguese**: [ronal2do/javascript](https://github.com/ronal2do/airbnb-react-styleguide)
|
||||
|
||||
**[⬆ back to top](#table-of-contents)**
|
||||
|
||||
Reference in New Issue
Block a user