-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy patheslint.config.mjs
More file actions
133 lines (131 loc) · 3.28 KB
/
eslint.config.mjs
File metadata and controls
133 lines (131 loc) · 3.28 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// @ts-check
import stylisticJs from "@stylistic/eslint-plugin-js";
import stylisticTs from "@stylistic/eslint-plugin-ts";
import html from "eslint-plugin-html";
import jsdoc from "eslint-plugin-jsdoc";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import unusedImports from "eslint-plugin-unused-imports";
import tseslint from "typescript-eslint";
/** @type {import("typescript-eslint").ConfigWithExtends} */
const customConfig = {
files: ["**/*.js", "**/*.cjs", "**/*.mjs", "**/*.ts", "**/*.html"],
plugins: {
"@stylistic/js": stylisticJs,
"@stylistic/ts": stylisticTs,
jsdoc,
html,
"simple-import-sort": simpleImportSort,
"unused-imports": unusedImports,
},
rules: {
"@typescript-eslint/array-type": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"jsdoc/check-alignment": 1,
"jsdoc/check-indentation": [
"error",
{
excludeTags: ["example", "param"],
},
],
"jsdoc/check-param-names": ["error"],
curly: ["error", "all"],
"@stylistic/js/dot-location": ["error", "property"],
"dot-notation": ["error"],
"@stylistic/js/eol-last": ["error", "always"],
eqeqeq: ["error"],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@stylistic/js/linebreak-style": ["error", "unix"],
"no-cond-assign": ["error", "always"],
"no-console": [
"error",
{
allow: ["warn"],
},
],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-object-type": [
"error",
{
allowInterfaces: "always",
},
],
"@typescript-eslint/no-explicit-any": "off",
"no-lonely-if": ["error"],
"@typescript-eslint/no-object-literal-type-assertion": "off",
"no-shadow": "error",
"no-throw-literal": ["error"],
"no-unmodified-loop-condition": ["error"],
"no-unneeded-ternary": ["error"],
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-use-before-define": "off",
"no-useless-call": ["error"],
"no-var": "error",
"prefer-arrow-callback": "error",
"prefer-rest-params": "off",
"@stylistic/ts/quote-props": ["error", "as-needed"],
"@stylistic/ts/quotes": [
"error",
"double",
{
avoidEscape: true,
},
],
"sort-imports": "off",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"@stylistic/js/spaced-comment": [
"error",
"always",
{
line: {
exceptions: ["-"],
},
block: {
balanced: true,
},
},
],
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
},
};
export default tseslint.config(
tseslint.configs.recommended,
customConfig,
{
files: ["**/*.test.ts", "./test/**/*.ts"],
rules: {
"@typescript-eslint/no-unused-expressions": "off",
"unused-imports/no-unused-vars": "off",
},
},
{
files: ["**/*.cjs", "**/*.mjs"],
rules: {
"no-console": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unused-expressions": "off",
},
},
{
name: "globally-ignored-files",
ignores: [
"**/node_modules",
"build/**",
"coverage/**",
"**/dist/**",
"docs/**",
"examples/**/*.js",
],
}
);