-
Notifications
You must be signed in to change notification settings - Fork 8
/
eslint.config.js
146 lines (144 loc) · 4.64 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
import eslintJs from "@eslint/js";
import eslintPluginComments from "@eslint-community/eslint-plugin-eslint-comments/configs";
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 * as eslintPluginMdx from "eslint-plugin-mdx";
import eslintPluginNoSecrets from "eslint-plugin-no-secrets";
import eslintPluginNoUnsanitized from "eslint-plugin-no-unsanitized";
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_RECOMMENDED = "flat/recommended";
export default [
{
ignores: [
"!.circleci",
"**/__pycache__/",
"**/*min.css",
"**/*min.js",
"**/*.json",
"*~",
".git/",
".mypy_cache/",
".pytest_cache/",
".ruff_cache/",
".venv/",
"bin/docker/registry.yaml", // breaks prettier plugin idk why
"codex/_vendor/",
"codex/static_build/",
"codex/static_root/",
"codex/templates/*.html", // Handled by djlint
"codex/templates/**/*.html", // Handled by djlint
"codex/templates/pwa/serviceworker-register.js", // removes eslint-disable that it then complains about
"comics/",
"config/",
"dist/",
"frontend/",
"node_modules/",
"package-lock.json",
"poetry.lock",
"test-results/",
"typings/",
],
},
eslintJs.configs.recommended,
eslintPluginArrayFunc.configs.all,
eslintPluginComments.recommended,
eslintPluginCompat.configs[FLAT_RECOMMENDED],
eslintPluginDepend.configs[FLAT_RECOMMENDED],
eslintPluginImport.flatConfigs.recommended,
eslintPluginMdx.flat,
eslintPluginMdx.flatCodeBlocks,
eslintPluginNoUnsanitized.configs.recommended,
eslintPluginPromise.configs[FLAT_RECOMMENDED],
eslintPluginRegexp.configs[FLAT_RECOMMENDED],
eslintPluginSecurity.configs.recommended,
eslintPluginSonarjs.configs.recommended,
...eslintPluginToml.configs[FLAT_RECOMMENDED],
eslintPluginUnicorn.configs[FLAT_RECOMMENDED],
...eslintPluginYml.configs[FLAT_RECOMMENDED],
...eslintPluginYml.configs["flat/prettier"],
eslintPluginPrettierRecommended,
{
languageOptions: {
// eslint-plugin-import sets this to 2018.
ecmaVersion: "latest",
globals: {
...globals.node,
...globals.browser,
},
},
linterOptions: {
reportUnusedDisableDirectives: "warn",
},
plugins: {
"no-secrets": eslintPluginNoSecrets,
"simple-import-sort": eslintPluginSimpleImportSort,
},
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"] },
],
"unicorn/prefer-node-protocol": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/switch-case-braces": ["warn", "avoid"],
},
},
{
files: ["**/.{md,mdx}"],
processor: eslintPluginMdx.createRemarkProcessor({
lintCodeBlocks: true,
}),
},
{
files: ["**/*.toml", "**/*.md/*.toml"],
rules: {
"prettier/prettier": ["error", { parser: "toml" }],
},
},
{
files: ["**/*.yaml", "**/*.yml", "**/*.md/*.yaml"],
rules: {
"prettier/prettier": ["error", { parser: "yaml" }],
},
},
{
files: [
"**/certbot.yaml",
"**/docker-compose*.yaml",
"**/.*_treestamps.yaml",
],
rules: {
"yml/no-empty-mapping-value": "off",
},
},
eslintConfigPrettier, // Best if last
];