2017-06-09 19:31:03 +03:00
|
|
|
module.exports = {
|
2021-10-25 10:17:54 +03:00
|
|
|
// Use `airbnb`, which includes `airbnb:base` and the React-related configs.
|
|
|
|
extends: ['airbnb', 'amo/base'],
|
2017-06-09 22:21:00 +03:00
|
|
|
rules: {
|
2018-01-18 14:01:43 +03:00
|
|
|
// Turn down warnings for our custom Link component.
|
2020-12-11 14:35:33 +03:00
|
|
|
'jsx-a11y/anchor-is-valid': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
components: [],
|
|
|
|
specialLink: ['to'],
|
|
|
|
aspects: ['noHref', 'invalidHref', 'preferButton'],
|
|
|
|
},
|
|
|
|
],
|
2018-01-18 14:01:43 +03:00
|
|
|
|
2018-01-18 14:18:58 +03:00
|
|
|
// Don't require validation of nesting just id + for attribute.
|
2020-12-11 14:35:33 +03:00
|
|
|
'jsx-a11y/label-has-for': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
components: ['Label'],
|
|
|
|
required: {
|
|
|
|
every: ['id'],
|
|
|
|
},
|
|
|
|
allowChildren: false,
|
2018-01-18 14:18:58 +03:00
|
|
|
},
|
2020-12-11 14:35:33 +03:00
|
|
|
],
|
2018-01-18 14:18:58 +03:00
|
|
|
|
2018-08-15 05:06:13 +03:00
|
|
|
// Airbnb has turned this rule on again but we don't want that yet.
|
|
|
|
'react/destructuring-assignment': ['off', 'always'],
|
|
|
|
|
2017-06-09 19:31:03 +03:00
|
|
|
// The airbnb default of this rule mainly encourages `shape` over `object`
|
|
|
|
// but there are too many bugs in the linter to use `shape` accurately.
|
2017-06-09 22:21:00 +03:00
|
|
|
'react/forbid-prop-types': 'off',
|
2017-06-09 19:31:03 +03:00
|
|
|
|
2017-06-09 22:21:00 +03:00
|
|
|
'react/prefer-stateless-function': 'off',
|
2017-06-30 23:18:05 +03:00
|
|
|
'react/require-default-props': 'off',
|
|
|
|
|
2018-08-15 05:16:18 +03:00
|
|
|
// See: https://github.com/mozilla/eslint-config-amo/issues/63
|
|
|
|
'react/sort-comp': 'off',
|
|
|
|
|
2017-07-03 15:46:08 +03:00
|
|
|
// Use a 2 space indent for jsx props.
|
|
|
|
'react/jsx-indent-props': ['error', 2],
|
|
|
|
|
2017-07-03 18:13:53 +03:00
|
|
|
// Aligns closing brackets in jsx with the opening line.
|
|
|
|
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
|
2020-12-11 14:35:33 +03:00
|
|
|
'react/jsx-filename-extension': [
|
|
|
|
'warn',
|
|
|
|
{
|
|
|
|
extensions: ['.js', '.jsx'],
|
|
|
|
},
|
|
|
|
],
|
2017-06-30 21:05:08 +03:00
|
|
|
|
|
|
|
// Allow more than one prop when the jsx is confined to a single line.
|
|
|
|
// Defaults to 1 prop per line when the jsx spans multiple lines.
|
|
|
|
'react/jsx-max-props-per-line': ['error', { when: 'multiline' }],
|
|
|
|
|
2017-07-03 15:46:08 +03:00
|
|
|
// Make sure the first prop is on a new line for multiline props.
|
|
|
|
'react/jsx-first-prop-new-line': ['error', 'multiline'],
|
2017-06-09 22:21:00 +03:00
|
|
|
'react/jsx-key': 'error',
|
|
|
|
'react/no-string-refs': 'error',
|
2019-08-19 11:30:34 +03:00
|
|
|
|
|
|
|
// Enforces where React component static properties should be positioned.
|
|
|
|
// We want them in the class body.
|
|
|
|
'react/static-property-placement': ['error', 'static public field'],
|
|
|
|
|
|
|
|
// Airbnb enforces this but we use this feature a lot!
|
|
|
|
'react/jsx-props-no-spreading': 'off',
|
2017-06-09 22:21:00 +03:00
|
|
|
},
|
2017-06-09 19:31:03 +03:00
|
|
|
};
|