-
Notifications
You must be signed in to change notification settings - Fork 26.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[react] Including missing defaults to the react eslint #618
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,44 +7,70 @@ module.exports = { | |
}, | ||
'rules': { | ||
// Prevent missing displayName in a React component definition | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md | ||
'react/display-name': 0, | ||
// Enforce boolean attributes notation in JSX | ||
'react/jsx-boolean-value': 2, | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md | ||
'react/jsx-boolean-value': [2, 'never'], | ||
// Validate closing bracket location in JSX | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md | ||
'react/jsx-closing-bracket-location': [2, 'line-aligned'], | ||
// Enforce or disallow spaces inside of curly braces in JSX attributes | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md | ||
'react/jsx-curly-spacing': 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wow how was this one off‽ thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah a fellow interrobanger! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
// Validate props indentation in JSX | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md | ||
'react/jsx-indent-props': [2, 2], | ||
// Prevent duplicate props in JSX | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md | ||
'react/jsx-no-duplicate-props': 0, | ||
// Disallow undeclared variables in JSX | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md | ||
'react/jsx-no-undef': 2, | ||
// Enforce quote style for JSX attributes | ||
'react/jsx-quotes': 0, | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-quote.md | ||
'react/jsx-quotes': [2, 'double'], | ||
// Enforce propTypes declarations alphabetical sorting | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md | ||
'react/jsx-sort-prop-types': 0, | ||
// Enforce props alphabetical sorting | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md | ||
'react/jsx-sort-props': 0, | ||
// 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, | ||
// 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 | ||
'react/jsx-uses-vars': 2, | ||
// Prevent usage of dangerous JSX properties | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md | ||
'react/no-danger': 0, | ||
// 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'], | ||
// Prevent usage of setState in componentDidUpdate | ||
'react/no-did-update-set-state': 2, | ||
// 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'], | ||
// Prevent multiple component definition per file | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md | ||
'react/no-multi-comp': 2, | ||
// Prevent usage of unknown DOM property | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md | ||
'react/no-unknown-property': 2, | ||
// Prevent missing props validation in a React component definition | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md | ||
'react/prop-types': 2, | ||
// Prevent missing React when using JSX | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md | ||
'react/react-in-jsx-scope': 2, | ||
// 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, | ||
// Prevent extra closing tags for components without children | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md | ||
'react/self-closing-comp': 2, | ||
// Enforce component methods order | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md | ||
'react/sort-comp': [2, { | ||
'order': [ | ||
'lifecycle', | ||
|
@@ -56,6 +82,11 @@ module.exports = { | |
] | ||
}], | ||
// Prevent missing parentheses around multilines JSX | ||
'react/wrap-multilines': 2 | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md | ||
'react/wrap-multilines': [2, { | ||
declaration: true, | ||
assignment: true, | ||
return: true | ||
}] | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we also add in a comment the URL of each of the rules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was literally just about to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JORDAN SYNERGYYYYYYY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those changes are great but i also meant URLs in comments inline in
react.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the classic Double-J communication breakdown.
https://www.youtube.com/watch?v=f6WQLvRvtjs