-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patheslint.config.mjs
105 lines (98 loc) · 3.89 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
import path from "node:path"
import url from "node:url"
import eslintPluginTS from "@typescript-eslint/eslint-plugin"
import tsParser from "@typescript-eslint/parser"
import unusedImports from "eslint-plugin-unused-imports"
import unicornPlugin from "eslint-plugin-unicorn"
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
export default [
// register plugins
{
plugins: {
"@typescript-eslint": eslintPluginTS,
"@unused-imports": unusedImports,
},
},
// add files and folders to be ignored
{
ignores: [
"node_modules/*",
"eslint.config.mjs",
".github/*",
".yarn/*",
"dist/*",
"src/output/*",
],
},
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
},
},
rules: {
// override typescript-eslint
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/consistent-generic-constructors": ["error", "type-annotation"],
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"spaced-comment": ["error", "always"],
"prefer-const": [
"error",
{
destructuring: "all",
ignoreReadBeforeAssign: false,
},
],
"@typescript-eslint/prefer-optional-chain": "off",
"@typescript-eslint/no-extraneous-class": "off",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-unsafe-type-assertion": "off",
"@typescript-eslint/prefer-readonly-parameter-types": "off",
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/parameter-properties": "off",
"@typescript-eslint/method-signature-style": "off",
"@typescript-eslint/prefer-destructuring": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/class-methods-use-this": "off",
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/max-params": "off",
"@typescript-eslint/no-invalid-this": "off",
"@typescript-eslint/init-declarations": "off",
"@typescript-eslint/dot-notation": "off",
"@unused-imports/no-unused-imports": "error",
"no-duplicate-imports": "error",
// override unicorn
"unicorn/no-null": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/no-array-for-each": "off",
"unicorn/import-style": "off",
"unicorn/filename-case": "off",
"unicorn/consistent-function-scoping": "off",
"unicorn/no-nested-ternary": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/no-process-exit": "off",
"unicorn/number-literal-case": "off", // prettier changes to lowercase
"unicorn/no-lonely-if": "off",
"unicorn/prefer-top-level-await": "off",
"unicorn/no-static-only-class": "off",
"unicorn/no-keyword-prefix": "off",
"unicorn/prefer-json-parse-buffer": "off",
"unicorn/no-array-reduce": "off",
},
},
]