forked from Amsterdam/mijn-amsterdam-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
94 lines (93 loc) · 2.36 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
import pluginJs from '@eslint/js';
import importPlugin from 'eslint-plugin-import';
import pluginReact from 'eslint-plugin-react';
import pluginUnusedImports from 'eslint-plugin-unused-imports';
import globals from 'globals';
import tseslint from 'typescript-eslint';
// eslint-disable-next-line import/no-default-export
export default [
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
plugins: {
'unused-imports': pluginUnusedImports,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'no-console': 'warn',
'dot-notation': 'error',
'no-else-return': 'error',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'react/jsx-curly-brace-presence': 'error',
'react/function-component-definition': [
'warn',
{
namedComponents: 'function-declaration',
},
],
'import/no-default-export': 'warn',
'unused-imports/no-unused-imports': 'error',
'@typescript-eslint/no-require-imports': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'no-lonely-if': 'error',
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'no-magic-numbers': [
'error',
{
ignore: [-1, 0, 1, 2, 24, 60],
ignoreArrayIndexes: true,
enforceConst: true,
detectObjects: false,
},
],
'no-undef': 'off',
},
},
{
plugins: {
import: importPlugin,
},
rules: {
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal'],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['react'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
},
},
{
files: ['**/*.test.{ts,tsx}'],
rules: {
'no-magic-numbers': 'off',
},
},
];