-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
84 lines (82 loc) · 2.21 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
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
import typescriptParser from "@typescript-eslint/parser";
import mochaPlugin from "eslint-plugin-mocha";
export default [
// Base configuration for all files
{
files: ["**/*.{js,ts,jsx,tsx}"],
ignores: ["out/", "dist/", "node_modules/"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
parser: typescriptParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
// Browser globals
window: "readonly",
document: "readonly",
navigator: "readonly",
// Node.js globals
process: "readonly",
module: "readonly",
require: "readonly",
// Mocha globals
describe: "readonly",
it: "readonly",
before: "readonly",
after: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
},
},
plugins: {
"@typescript-eslint": typescriptPlugin,
"mocha": mochaPlugin,
},
rules: {
...typescriptPlugin.configs["recommended"].rules,
...mochaPlugin.configs["recommended"].rules,
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn", {
'varsIgnorePattern': '^__webpack_',
'argsIgnorePattern': '^__webpack_'
}],
// Add any other custom rules here
},
},
// Rules specific to certain files
{
"files": ["src/linterTest.ts"],
"rules": {
"no-var": "error"
}
},
// Backend-specific configuration
{
files: ["src/server/**/*.{js,ts}", "webpack.config.js"],
rules: {
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-var-requires": "off",
},
},
// Frontend-specific configuration
{
files: ["src/webview/**/*.{js,ts,jsx,tsx}"],
rules: {
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-var-requires": "error", // Disallow `var require = ...`
},
},
// Test file configuration
{
files: ["**/*.test.{js,ts,jsx,tsx}", "**/*.spec.{js,ts,jsx,tsx}"],
rules: {
"mocha/no-mocha-arrows": "error",
// Any other specific rules for test files
},
},
];