-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
86 lines (85 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
const getImportGroups = () => {
const external = ['react', 'react-router-dom', '@linaria/+(core|react)'];
const internal = ['pages/**', 'components/**', 'context/**', 'utils/**', 'theme/**', 'constants/**', 'assets/**'];
return external
.map(pattern => ({ pattern, group: 'external', position: 'before' }))
.concat(internal.map(pattern => ({ pattern, group: 'internal', position: 'before' })));
};
module.exports = {
root: true,
env: {
es2022: true,
browser: true,
node: true,
},
extends: ['airbnb', 'airbnb/hooks', 'plugin:react/jsx-runtime', 'plugin:sonarjs/recommended', 'plugin:promise/recommended', 'prettier'],
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
'global-require': 'off',
'no-restricted-exports': 'off',
'sonarjs/no-duplicate-string': 'off',
'no-console': 'off',
'import/no-extraneous-dependencies': 'off',
'import/prefer-default-export': 'off',
'func-names': 'off',
'no-param-reassign': 'off',
'sonarjs/cognitive-complexity': 'off',
'react/jsx-no-useless-fragment': 'off',
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'sort-imports': 'off', // turned off in favour of import/order rule
'import/no-unresolved': ['error', { ignore: ['^virtual:'] }],
'import/order': [
'error',
{
'newlines-between': 'ignore',
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
pathGroups: getImportGroups(),
pathGroupsExcludedImportTypes: ['react'],
},
],
'react/function-component-definition': ['error', { namedComponents: 'arrow-function' }],
},
plugins: ['only-warn', 'react', 'sonarjs', 'promise', 'html', '@html-eslint'],
overrides: [
{
files: ['*.html'],
parser: '@html-eslint/parser',
extends: ['plugin:@html-eslint/recommended'],
rules: {
'spaced-comment': 'off',
'@html-eslint/indent': 'off',
'@html-eslint/require-meta-charset': 'error',
'@html-eslint/require-meta-viewport': 'error',
'@html-eslint/require-meta-description': 'off',
'@html-eslint/require-button-type': 'error',
'@html-eslint/element-newline': 'off',
'@html-eslint/no-target-blank': 'error',
'@html-eslint/no-duplicate-id': 'error',
'@html-eslint/no-extra-spacing-attrs': ['error', { enforceBeforeSelfClose: true }],
'@html-eslint/require-closing-tags': ['error', { selfClosing: 'always' }],
'@html-eslint/id-naming-convention': ['error', 'camelCase'],
},
},
],
settings: {
'import/resolver': {
alias: {
map: [
['pages', './src/pages'],
['components', './src/components'],
['assets', './src/assets'],
['theme', './src/theme'],
['constants', './src/constants'],
['context', './src/context'],
['utils', './src/utils'],
['appConfig', './appConfig'],
],
extensions: ['.js', '.jsx', '.json'],
},
},
},
};