-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
170 lines (167 loc) · 5.08 KB
/
eslint.config.js
File metadata and controls
170 lines (167 loc) · 5.08 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import eslintJs from "@eslint/js";
import eslintJson from "@eslint/json";
import eslintPluginComments from "@eslint-community/eslint-plugin-eslint-comments/configs";
import eslintPluginStylistic from "@stylistic/eslint-plugin";
import { defineConfig } from "eslint/config";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginArrayFunc from "eslint-plugin-array-func";
import eslintPluginCompat from "eslint-plugin-compat";
import eslintPluginDeMorgan from "eslint-plugin-de-morgan";
import eslintPluginDepend from "eslint-plugin-depend";
import eslintPluginHtml from "eslint-plugin-html";
import eslintPluginImport from "eslint-plugin-import-x";
import eslintPluginMath from "eslint-plugin-math";
import * as eslintPluginMdx from "eslint-plugin-mdx";
import eslintPluginNoSecrets from "eslint-plugin-no-secrets";
import eslintPluginNoUnsanitized from "eslint-plugin-no-unsanitized";
import eslintPluginNoUseExtendNative from "eslint-plugin-no-use-extend-native";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import eslintPluginPromise from "eslint-plugin-promise";
import eslintPluginRegexp from "eslint-plugin-regexp";
import eslintPluginSecurity from "eslint-plugin-security";
import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort";
import eslintPluginSonarjs from "eslint-plugin-sonarjs";
import eslintPluginToml from "eslint-plugin-toml";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import eslintPluginYml from "eslint-plugin-yml";
import globals from "globals";
export const FLAT_ALL = "flat/all";
export const FLAT_RECOMMENDED = "flat/recommended";
export const CONFIGS = {
js: {
...eslintJs.configs.recommended,
...eslintPluginArrayFunc.configs.all,
...eslintPluginComments.recommended,
...eslintPluginCompat.configs[FLAT_RECOMMENDED],
...eslintPluginDeMorgan.configs.recommended,
...eslintPluginDepend.configs[FLAT_RECOMMENDED],
...eslintPluginImport.flatConfigs.all,
...eslintPluginMath.configs.recommended,
...eslintPluginNoUnsanitized.configs.recommended,
...eslintPluginPromise.configs[FLAT_ALL],
...eslintPluginRegexp.configs.all,
...eslintPluginSonarjs.configs.all,
...eslintPluginUnicorn.configs.all,
plugins: {
depend: eslintPluginDepend,
"no-secrets": eslintPluginNoSecrets,
"simple-import-sort": eslintPluginSimpleImportSort,
sonarjs: eslintPluginSonarjs,
unicorn: eslintPluginUnicorn,
},
languageOptions: {
// eslint-plugin-import sets this to 2018.
ecmaVersion: "latest",
},
rules: {
"@stylistic/multiline-comment-style": "off", // Multiple bugs with this rule
"max-params": ["warn", 4],
"no-console": "warn",
"no-debugger": "warn",
"no-secrets/no-secrets": "error",
"security/detect-object-injection": "off",
"simple-import-sort/exports": "warn",
"simple-import-sort/imports": "warn",
},
},
};
Object.freeze(CONFIGS);
export default defineConfig([
{
name: "globalIgnores",
ignores: [
"!.circleci",
"**/*min.css",
"**/*min.js",
"**/__pycache__/",
"**/node_modules/",
"**/package-lock.json",
"*~",
".git/",
".*cache/",
".venv/",
"dist/",
"uv.lock",
"test-results/",
"typings/",
],
},
eslintPluginNoUseExtendNative.configs.recommended,
eslintPluginSecurity.configs.recommended,
eslintPluginStylistic.configs.all,
eslintPluginPrettierRecommended,
{
languageOptions: {
globals: {
...globals.node,
},
},
linterOptions: {
reportUnusedDisableDirectives: "warn",
},
rules: {
"prettier/prettier": "warn",
},
},
{
files: ["**/*.html"],
plugins: { html: eslintPluginHtml },
},
{
files: ["**/*.js"],
...CONFIGS.js,
},
{
files: ["**/*.json", "**/*.md/*.json"],
plugins: {
json: eslintJson,
},
...eslintJson.configs.recommended,
language: "json/json",
},
{
files: ["package.json"],
languageOptions: {
parser: "jsonc-eslint-parser",
},
plugins: { depend: eslintPluginDepend },
rules: {
"depend/ban-dependencies": "error",
},
},
{
files: ["**/*.{md,mdx}"],
...eslintPluginMdx.flat,
...eslintPluginMdx.flatCodeBlocks,
processor: eslintPluginMdx.createRemarkProcessor({
lintCodeBlocks: true,
}),
rules: {
"no-undef": "off",
"no-unused-vars": "off",
"prettier/prettier": ["warn", { parser: "markdown" }],
},
},
...eslintPluginToml.configs.recommended,
{
files: ["**/*.toml", "**/*.md/*.toml"],
rules: {
"prettier/prettier": ["error", { parser: "toml" }],
},
},
...eslintPluginYml.configs.standard,
...eslintPluginYml.configs.prettier,
{
files: ["**/*.yaml", "**/*.yml", "**/*.md/*.yaml", "**/*.md/*.yml"],
rules: {
"prettier/prettier": ["error", { parser: "yaml" }],
},
},
{
files: ["**/certbot.yaml", "**/compose*.yaml", "**/.*_treestamps.yaml"],
rules: {
"yml/no-empty-mapping-value": "off",
},
},
eslintConfigPrettier, // Best if last
]);