Closed Bug 1442485 Opened 7 years ago Closed 7 years ago

Enable more React ESLint rules

Categories

(Tree Management :: Treeherder: Frontend, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

At the moment a number of the AirBnb ESLint rules relating to React are disabled. Before we add too much more React code, it would be good to enable the low hanging fruit, to reduce the amount we have to fix up were we to wait longer before doing so.
Attachment #8955376 - Flags: review?(cdawson)
Attachment #8955376 - Flags: review?(cdawson) → review+
Commits pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/aca725e534c41a0519de08bd25d4d8f6f89738fe Bug 1442485 - Don't use arrow functions for stateless components Since otherwise it's an anonymous function where the name has to be inferred, which doesn't work in all cases: https://github.com/airbnb/javascript/blob/master/react/README.md#class-vs-reactcreateclass-vs-stateless Unfortunately there is not yet an ESLint rule to enforce this: https://github.com/yannickcr/eslint-plugin-react/issues/690 https://github.com/mozilla/treeherder/commit/d0fd089073922c0930bd9903cf9a606ef322ae60 Bug 1442485 - Fix/enable eslint 'react/prefer-stateless-function' https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md https://github.com/mozilla/treeherder/commit/f268d9e721ba7a8152c0b6d0aa1a3d8ad052ef46 Bug 1442485 - Fix/enable eslint 'react/jsx-indent{,-props}' https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md Changes made via eslint's `--fix` feature. I also included fixes to the JS content within JSX files (by enabling the generic `indent` rule locally when running `--fix`), to reduce the churn that will be seen in these files when we fix JS indentation for the whole codebase. https://github.com/mozilla/treeherder/commit/3964dac1b630dc2e19136af93bd05b7aa529781d Bug 1442485 - Fix/enable eslint 'react/jsx-first-prop-new-line' https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md Changes made via eslint's `--fix` feature. https://github.com/mozilla/treeherder/commit/e1e8199785f285619ff2d28eb3521db2b0e7a5af Bug 1442485 - Fix/enable eslint 'react/jsx-max-props-per-line' https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md Changes made via eslint's `--fix` feature. https://github.com/mozilla/treeherder/commit/1053a8d5ee31a83767f4eb6e15baef4c565ccff0 Bug 1442485 - Fix/enable eslint 'object-property-newline' https://eslint.org/docs/rules/object-property-newline Not a React-specific rule, but the react-codemod rulesets were constantly trying to alter it when making changes in other files, so would rather fix it now. https://github.com/mozilla/treeherder/commit/b51909d45ad3cc94978026e54614ee0e564c8773 Bug 1442485 - Enable already-passing eslint 'lines-around-directive' https://eslint.org/docs/rules/object-property-newline This was fixed as part of #3198.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: