-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
153 lines (151 loc) · 4.68 KB
/
eslint.config.js
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
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginArrayFunc from "eslint-plugin-array-func";
import eslintPluginCompat from "eslint-plugin-compat";
import eslintPluginDepend from "eslint-plugin-depend";
import eslintPluginImport from "eslint-plugin-import";
import eslintPluginJsonc from "eslint-plugin-jsonc";
import eslintPluginMarkdown from "eslint-plugin-markdown";
import eslintPluginNoSecrets from "eslint-plugin-no-secrets";
import eslintPluginNoUnsanitized from "eslint-plugin-no-unsanitized";
import eslintPluginPrettier from "eslint-plugin-prettier";
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";
const FLAT_RECOMMENDED = "flat/recommended";
Object.freeze(FLAT_RECOMMENDED);
export default [
{
ignores: [
"!.circleci",
"**/__pycache__/",
"**/*min.css",
"**/*min.js",
"*~",
".git/",
"**/.mypy_cache/",
".pytest_cache/",
".ruff_cache/",
".venv/",
"dist/",
"node_modules/",
"package-lock.json",
"poetry.lock",
"test-results/",
"typings/",
],
},
js.configs.recommended,
eslintPluginArrayFunc.configs.all,
eslintPluginCompat.configs[FLAT_RECOMMENDED],
eslintPluginDepend.configs[FLAT_RECOMMENDED],
eslintPluginImport.flatConfigs.recommended,
...eslintPluginJsonc.configs["flat/recommended-with-jsonc"],
...eslintPluginMarkdown.configs.recommended,
eslintPluginNoUnsanitized.configs.recommended,
eslintPluginPrettierRecommended,
eslintPluginPromise.configs[FLAT_RECOMMENDED],
eslintPluginRegexp.configs[FLAT_RECOMMENDED],
eslintPluginSecurity.configs.recommended,
eslintPluginSonarjs.configs.recommended,
...eslintPluginToml.configs[FLAT_RECOMMENDED],
...eslintPluginYml.configs["flat/standard"],
...eslintPluginYml.configs["flat/prettier"],
eslintConfigPrettier, // Best if last
{
languageOptions: {
// eslint-plugin-import sets this to 2018.
ecmaVersion: "latest",
globals: {
...globals.node,
},
},
linterOptions: {
reportUnusedDisableDirectives: "warn",
},
plugins: {
arrayFunc: eslintPluginArrayFunc,
jsonc: eslintPluginJsonc,
markdown: eslintPluginMarkdown,
"no-secrets": eslintPluginNoSecrets,
prettier: eslintPluginPrettier,
promise: eslintPluginPromise,
security: eslintPluginSecurity,
"simple-import-sort": eslintPluginSimpleImportSort,
toml: eslintPluginToml,
unicorn: eslintPluginUnicorn,
yml: eslintPluginYml,
},
rules: {
"array-func/prefer-array-from": "off", // for modern browsers the spread operator, as preferred by unicorn, works fine.
"depend/ban-dependencies": [
"error",
{
// import-x doesn't work with eslint 9 yet
allowed: ["eslint-plugin-import"],
},
],
"max-params": ["warn", 4],
"no-console": "warn",
"no-debugger": "warn",
"no-secrets/no-secrets": "error",
"prettier/prettier": "warn",
"security/detect-object-injection": "off",
"simple-import-sort/exports": "warn",
"simple-import-sort/imports": "warn",
"space-before-function-paren": "off",
"unicorn/filename-case": [
"error",
{ case: "kebabCase", ignore: [".*.md", "config_default.yaml"] },
],
"unicorn/prefer-node-protocol": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/switch-case-braces": ["warn", "avoid"],
},
},
{
files: ["**/*.md"],
processor: "markdown/markdown",
rules: {
"prettier/prettier": ["warn", { parser: "markdown" }],
},
},
{
files: ["**/*.md/*.js"], // Will match js code inside *.md files
rules: {
"no-undef": "off",
"no-unused-vars": "off",
},
},
{
files: ["**/*.md/*.sh"],
rules: {
"prettier/prettier": ["error", { parser: "sh" }],
},
},
{
files: ["**/*.toml"],
rules: {
"prettier/prettier": ["error", { parser: "toml" }],
},
},
{
files: ["**/docker-compose*.yaml"],
rules: {
"yml/no-empty-mapping-value": "off",
},
},
{
files: ["tests/**/*.json"],
rules: {
"no-secrets/no-secrets": "off",
},
},
];