-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
89 lines (87 loc) · 2.77 KB
/
.eslintrc.cjs
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
// module.exports = {
// env: { browser: true, es2020: true },
// extends: [
// 'eslint:recommended',
// 'plugin:@typescript-eslint/recommended',
// 'plugin:react-hooks/recommended',
// ],
// parser: '@typescript-eslint/parser',
// parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
// plugins: ['react-refresh'],
// rules: {
// 'react-refresh/only-export-components': 'warn',
// },
// }
module.exports = {
node: true,
root: true,
extends: [
// By extending from a plugin config, we can get recommended rules without having to add them manually.
'eslint:recommended',
'plugin:react/recommended',
'plugin:import/recommended',
'plugin:jsx-a11y/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
// This disables the formatting rules in ESLint that Prettier is going to be responsible for handling.
// Make sure it's always the last config, so it gets the chance to override other configs.
'eslint-config-prettier',
],
settings: {
react: {
// Tells eslint-plugin-react to automatically detect the version of React to use.
version: 'detect',
},
// Tells eslint how to resolve imports
'import/resolver': {
typescript: {},
alias: {
map: [['@', './web/src']],
},
node: {
paths: ['src', 'web/src', 'server/src'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
// Add your own rules here to override ones from the extended configs.
// Not needed for React v17+
'react/react-in-jsx-scope': 0,
'react/self-closing-comp': [
2,
{
component: true,
html: true,
},
],
'react/jsx-closing-bracket-location': [2, 'line-aligned'],
'react/jsx-curly-spacing': [1, { when: 'never' }],
'react/jsx-first-prop-new-line': [2, 'multiline-multiprop'],
'react/jsx-indent': [2, 2, { checkAttributes: true }],
'react/jsx-indent-props': [2, 2],
'react/jsx-sort-props': [1, { reservedFirst: true }],
'comma-spacing': ['error', { before: false, after: true }],
semi: ['error', 'always'],
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 1 }],
'object-curly-spacing': ['error', 'always'],
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': [
'error',
{
groups: [
// Side effects
['^\\u0000'],
// React imports, npm imports, then novaleap imports
['^react$', '^react', '^@?\\w', '^@nl.*'],
// Parent imports
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Relative imports
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$', '^\\.'],
],
},
],
'sort-imports': 0,
},
plugins: ['simple-import-sort'],
};