-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
97 lines (94 loc) · 2.73 KB
/
eslint.config.mjs
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
import { createRequire } from 'module';
import importPlugin from 'eslint-plugin-import';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import reactRefreshPlugin from 'eslint-plugin-react-refresh';
const require = createRequire(import.meta.url);
const nx = require('@nx/eslint-plugin');
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
export default [
eslintPluginPrettierRecommended,
...nx.configs['flat/base'],
...nx.configs['flat/typescript'],
...nx.configs['flat/javascript'],
{
ignores: ['**/dist'],
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'],
plugins: {
import: importPlugin,
},
rules: {
'no-unreachable': 'error',
'no-empty': ['error', { allowEmptyCatch: true }],
'import/order': [
'error',
{
groups: ['type', 'builtin', 'external', 'internal', ['parent', 'sibling', 'index']],
pathGroups: [
{
pattern: '*.scss',
group: 'index',
patternOptions: {
matchBase: true,
},
position: 'after',
},
],
pathGroupsExcludedImportTypes: ['type', 'builtin'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: false,
},
warnOnUnassignedImports: true,
},
],
},
},
...nx.configs['flat/react'],
reactRefreshPlugin.configs.recommended,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
plugins: {
'react-hooks': reactHooksPlugin,
},
rules: {
'react-hooks/exhaustive-deps': [
'warn',
{
additionalHooks: '(useIsomorphicLayoutEffect)',
},
],
},
},
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/method-signature-style': 'error',
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'@typescript-eslint/no-inferrable-types': [
'error',
{
ignoreParameters: true,
ignoreProperties: true,
},
],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
caughtErrors: 'none',
ignoreRestSiblings: false,
},
],
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': ['error'],
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
},
},
];