-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
101 lines (97 loc) · 2.55 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
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
import eslintJs from "@eslint/js";
import stylisticJs from "@stylistic/eslint-plugin-js";
import pluginJson from "eslint-plugin-json";
import eslintPluginPrettier from "eslint-plugin-prettier/recommended";
import pluginSonarJs from "eslint-plugin-sonarjs";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import globals from "globals";
import eslintTs from "typescript-eslint";
const pluginUnicorn = {
configs: {
recommended: eslintPluginUnicorn.configs["flat/recommended"],
},
};
const pluginPrettier = {
configs: {
recommended: eslintPluginPrettier,
},
};
const config = [
eslintJs.configs.recommended,
pluginUnicorn.configs.recommended,
pluginSonarJs.configs.recommended,
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: 2024,
sourceType: "module",
globals: {
...globals.builtin,
...globals.browser,
...globals.webextensions,
...globals.es2024,
chrome: "readonly",
},
},
rules: {
semi: ["error", "always"],
quotes: ["error", "double"],
"class-methods-use-this": [
"error",
{ exceptMethods: [], enforceForClassFields: false },
],
"no-unused-vars": ["error", { argsIgnorePattern: "_", args: "all" }],
"sonarjs/no-commented-code": "off",
"sonarjs/todo-tag": "off",
"sonarjs/public-static-readonly": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/better-regex": "error",
},
},
{
files: ["**/*.ts"],
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
...eslintTs.configs.recommendedTypeChecked,
...eslintTs.configs.stylisticTypeChecked,
},
{
files: ["**/*.json"],
...pluginJson.configs.recommended,
},
{
ignores: [
"**/dist/**/*",
"**/build/**",
"**/*.min.js",
"**/.vscode/**/*",
"eslint.config.mjs",
],
},
{
plugins: {
"@stylistic/js": stylisticJs,
},
rules: {
indent: ["error", 2],
"@stylistic/js/indent": ["error", 2, { SwitchCase: 1 }],
"@stylistic/js/comma-dangle": ["error", "always-multiline"],
"@stylistic/js/lines-between-class-members": [
"error",
{
enforce: [
{ blankLine: "always", prev: "*", next: "method" },
{ blankLine: "always", prev: "method", next: "field" },
{ blankLine: "never", prev: "field", next: "field" },
],
},
],
},
},
pluginPrettier.configs.recommended,
];
export default config;