-
Notifications
You must be signed in to change notification settings - Fork 1
/
react-hooks.js
91 lines (90 loc) · 2.29 KB
/
react-hooks.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
/**
* The eslint `extends` loads plugins from a unique location in order to identify plugins by name, while parsers, shared configs, etc. need to have a fully
* resolved filepath to be included relative to the project.
* @see https://github.com/eslint/eslint/issues/12450#issuecomment-542988227
*/
module.exports = {
extends: [
require.resolve('eslint-config-airbnb'),
require.resolve('eslint-config-airbnb/rules/react-hooks'),
'plugin:storybook/recommended',
],
overrides: [
{
files: ['*.jsx', '*.js', '*.tsx', '*.ts'],
},
{
// or whatever matches stories specified in .storybook/main.js
files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)'],
rules: {
'import/no-extraneous-dependencies': 'off',
'react/jsx-props-no-spreading': 'off',
}
}
],
globals: {
globalThis: false // means it is not writeable
},
env: {
es6: true,
browser: true,
jest: true,
node: true
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
modules: true
}
},
settings: {
react: {
version: 'detect'
},
'import/resolver': {
node: {
paths: ['src'],
extensions: ['.jsx', '.js', '.tsx', '.ts']
}
}
},
rules: {
'class-methods-use-this': 'error',
'import/extensions': ['error', 'ignorePackages', {
mjs: 'never',
js: 'never',
ts: 'never',
jsx: 'never',
tsx: 'never'
}],
'import/prefer-default-export': 'off',
'max-len': ['warn', {
code: 160,
tabWidth: 2,
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreTrailingComments: true,
}],
'no-unused-vars': ['error', {
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
destructuredArrayIgnorePattern: '^_',
}],
'react/react-in-jsx-scope': 'off',
'react/jsx-uses-react': 'off',
'react/function-component-definition': 'off',
'react/jsx-boolean-value': 'off',
'react/jsx-props-no-spreading': 'warn',
'react/require-default-props': ['warn', {
classes: 'defaultProps',
functions: 'defaultArguments',
forbidDefaultForRequired: true,
}],
}
};