-
Notifications
You must be signed in to change notification settings - Fork 9
/
eslint.config.mjs
74 lines (73 loc) · 2.39 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
import eslint from "@eslint/js";
import tsParser from "@typescript-eslint/parser";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginImportX from "eslint-plugin-import-x";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import globals from "globals";
import tseslint from "typescript-eslint";
// eslint-disable-next-line import-x/no-default-export
export default tseslint.config(
{ ignores: ["dist/", "docs/", "examples/"] },
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{
languageOptions: {
parser: tsParser,
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
globals: { ...globals.browser, ...globals.node },
},
},
eslint.configs.recommended,
tseslint.configs.recommended,
{
plugins: {
"import-x": eslintPluginImportX,
unicorn: eslintPluginUnicorn,
},
rules: {
"import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
"import-x/no-cycle": "warn",
"import-x/no-default-export": "error",
"import-x/no-duplicates": ["error"],
"import-x/no-named-as-default": "off",
"import-x/no-unresolved": "error",
"import-x/order": [
"error",
{
groups: ["builtin", "external", "internal", "parent", "sibling", "index", "type"],
"newlines-between": "always",
alphabetize: { order: "asc" },
},
],
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
"@typescript-eslint/switch-exhaustiveness-check": "error",
"unicorn/better-regex": "error",
"unicorn/consistent-function-scoping": "error",
"unicorn/expiring-todo-comments": "error",
"unicorn/filename-case": ["error", { case: "kebabCase" }],
"unicorn/no-array-for-each": "error",
"unicorn/no-for-loop": "error",
},
},
{
files: ["**/*?(.c|.m)js"],
...tseslint.configs.disableTypeChecked,
},
{
settings: {
"import-x/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import-x/resolver": {
typescript: true,
node: true,
},
},
},
{ linterOptions: { reportUnusedDisableDirectives: true } },
eslintConfigPrettier,
);