-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
121 lines (114 loc) · 5.33 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import esJs from "@eslint/js";
import globals from 'globals';
import esTs from "@typescript-eslint/eslint-plugin";
import typescriptParser from '@typescript-eslint/parser';
import imports from 'eslint-plugin-import';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import stylistic from '@stylistic/eslint-plugin'
import reactCompiler from 'eslint-plugin-react-compiler'
export default [
{
files: ["**/*.ts", "**/*.js", "**/*.tsx"],
languageOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
parser: typescriptParser,
globals: {
...globals.browser,
"process": true // both browser & node ... especially now weve implemented server actions
},
},
linterOptions: {
noInlineConfig: false,
reportUnusedDisableDirectives: true,
},
plugins: {
"@typescript-eslint": esTs,
"react": react,
"react-hooks": reactHooks,
import: imports,
'react-compiler': reactCompiler,
'@stylistic': stylistic
},
rules: {
"react-compiler/react-compiler": "error",
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
...esJs.configs.recommended.rules,
...esTs.configs.recommended.rules,
...stylistic.configs["recommended-flat"].rules,
"@stylistic/quotes": ["error", "single", { avoidEscape: true, allowTemplateLiterals: true }], // Strings must use singlequote @stylistic/quotes
//'@stylistic/indent': ['error', 4],
'import/order': [
'error',
{
pathGroups: [
{
pattern: "react",
group: "builtin"
},
{
pattern: "@raiz/**",
group: "external",
position: "before"
},
{
pattern: "*.scss",// https://github.com/import-js/eslint-plugin-import/issues/1639#issuecomment-580862011
group: "index",
patternOptions: { matchBase: true },
position: "after"
}
],
pathGroupsExcludedImportTypes: ["builtin"], // @NK we neeed to unlock the ordering of "builtin" ... otherwise the above rules have no effect
groups: [
'builtin', // Built-in imports (come from NodeJS native) go first
'external', // <- External imports
'internal', // <- Absolute imports
['sibling', 'parent'], // <- Relative imports, the sibling and parent types they can be mingled together
'index', // <- index imports
'unknown', // <- unknown
],
// 'newlines-between': 'always',
alphabetize: {
/* sort in ascending order. Options: ["ignore", "asc", "desc"] */
order: 'asc',
/* ignore case. Options: [true, false] */
caseInsensitive: true,
},
},
],
// 'no-extra-parens': 'off',
// 'no-unused-vars': 'off',
// 'no-extra-semi': 'off',
// 'no-unused-vars': 'off',
// 'no-empty-function': 'off',
// 'react/prop-types': 'off',
// 'react/react-in-jsx-scope': 'off',
// '@typescript-eslint/no-extra-parens': 'off',
// '@typescript-eslint/no-unused-vars': 'error',
// '@typescript-eslint/adjacent-overload-signatures': 'error',
// '@typescript-eslint/ban-ts-comment': 'error',
// '@typescript-eslint/ban-types': 'error',
// '@typescript-eslint/no-array-constructor': 'error',
// '@typescript-eslint/no-empty-function': 'error',
// '@typescript-eslint/no-empty-interface': 'error',
// '@typescript-eslint/no-explicit-any': 'warn',
// '@typescript-eslint/no-extra-non-null-assertion': 'error',
// '@typescript-eslint/no-extra-semi': 'error',
// '@typescript-eslint/no-inferrable-types': 'error',
// '@typescript-eslint/no-loss-of-precision': 'error',
// '@typescript-eslint/no-misused-new': 'error',
// '@typescript-eslint/no-namespace': 'error',
// '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
// '@typescript-eslint/no-non-null-assertion': 'warn',
// '@typescript-eslint/no-this-alias': 'error',
// '@typescript-eslint/no-unnecessary-type-constraint': 'error',
// '@typescript-eslint/no-unused-vars': 'warn',
// '@typescript-eslint/no-var-requires': 'error',
// '@typescript-eslint/prefer-as-const': 'error',
// '@typescript-eslint/prefer-namespace-keyword': 'error',
// '@typescript-eslint/triple-slash-reference': 'error',
},
}
]