forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
98 lines (91 loc) · 3.03 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
const path = require('path');
module.exports = {
root: true, // So parent files don't get applied
globals: {
preval: false, // Used in the documentation
},
env: {
es6: true,
browser: true,
node: true,
mocha: true,
},
extends: ['plugin:import/recommended', 'airbnb', 'prettier', 'prettier/react'],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 7,
sourceType: 'module',
},
plugins: ['babel', 'mocha', 'material-ui', 'react-hooks'],
settings: {
'import/resolver': {
webpack: {
config: path.join(__dirname, './docs/webpackBaseConfig.js'),
},
},
},
/**
* Sorted alphanumerically within each group. built-in and each plugin form
* their own groups.
*/
rules: {
'consistent-this': ['error', 'self'],
'linebreak-style': 'off', // Doesn't play nicely with Windows
'no-alert': 'error',
// Strict, airbnb is using warn
'no-console': 'error',
'no-constant-condition': 'error',
// Airbnb use error
'no-param-reassign': 'off',
'no-prototype-builtins': 'off',
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
'prefer-destructuring': 'off', // Destructuring harm grep potential.
'jsx-a11y/label-has-associated-control': 'off',
'jsx-a11y/label-has-for': 'off', // deprecated
'jsx-a11y/no-autofocus': 'off', // We are a library, people do what they want.
'material-ui/docgen-ignore-before-comment': 'error',
'material-ui/restricted-path-imports': 'error',
'mocha/handle-done-callback': 'error',
'mocha/no-exclusive-tests': 'error',
'mocha/no-global-tests': 'error',
'mocha/no-identical-title': 'error',
'mocha/no-nested-tests': 'error',
'mocha/no-pending-tests': 'error',
'mocha/no-return-and-callback': 'error',
'mocha/no-sibling-hooks': 'error',
'mocha/no-skipped-tests': 'error',
'mocha/no-top-level-hooks': 'error',
'mocha/valid-suite-description': 'error',
'react/destructuring-assignment': 'off',
// It's buggy
'react/forbid-prop-types': 'off',
'react/jsx-curly-brace-presence': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.js'] }], // airbnb is using .jsx
'react/jsx-handler-names': [
'error',
{
// airbnb is disabling this rule
eventHandlerPrefix: 'handle',
eventHandlerPropPrefix: 'on',
},
],
'react/no-danger': 'error',
// Strict, airbnb is using off
'react/no-direct-mutation-state': 'error',
'react/no-find-dom-node': 'off',
'react/no-multi-comp': 'off',
'react/require-default-props': 'off',
'react/sort-prop-types': 'error',
'import/no-extraneous-dependencies': 'off', // It would be better to enable this rule.
'import/namespace': ['error', { allowComputed: true }],
'import/order': [
'error',
{
groups: [['index', 'sibling', 'parent', 'internal', 'external', 'builtin']],
'newlines-between': 'never',
},
],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
},
};