-
Notifications
You must be signed in to change notification settings - Fork 5
/
eslint.config.mjs
92 lines (90 loc) · 2.55 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
// @ts-check
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks'
import {fixupPluginRules} from '@eslint/compat'
import ImportRules from 'eslint-plugin-import'
import i18nJson from 'eslint-plugin-i18n-json'
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
// Override for some typescript we actuall kinda like
rules: {
"@typescript-eslint/no-explicit-any": "off"
}
},
{
files: ["**/i18n/translations.*.json"],
plugins: {
"i18n-json": i18nJson
},
rules: {
...i18nJson.configs.recommended.rules,
"i18n-json/valid-message-syntax": "off",
"i18n-json/identical-keys": [
1,
{
"filePath": "../../../../src/i18n/translations.en.json"
}
],
"@typescript-eslint/no-unused-expressions": "off"
}
},
{
// Override for config js files
files: ['**/*.config.js'],
extends: [tseslint.configs.disableTypeChecked],
rules: {
"no-undef": "off",
"@typescript-eslint/no-require-imports": "off"
}
},
{
// override for testing related stuff
files: ["**/setupTests.js"],
extends: [tseslint.configs.disableTypeChecked],
rules: {
"no-undef": "off"
}
},
{
// Handle react
files: ["**/*.tsx", "**/*.jsx"],
plugins: {
react: react,
"react-hooks": fixupPluginRules(reactHooks)
},
settings: {
react: {
version: "18"
}
},
rules: {
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react/display-name": "off"
}
},
{
// Enfore importing rules
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
plugins: {
"import": fixupPluginRules(ImportRules)
},
settings: {
"import/resolver": {
typescript: true
}
},
rules: {
...ImportRules.configs.recommended.rules,
"import/no-unresolved": "off",
"import/imports-first": "warn",
"import/order": "warn"
}
}
);