-
-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy patheslint.config.mjs
More file actions
81 lines (79 loc) · 2.19 KB
/
Copy patheslint.config.mjs
File metadata and controls
81 lines (79 loc) · 2.19 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
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import eslintConfigPrettier from "eslint-config-prettier";
import globals from "globals";
// Stylistic rules shared by JS and TS sources.
const sharedRules = {
"no-var": "error",
"no-prototype-builtins": "error",
"no-empty": "error",
"no-inner-declarations": "error",
"no-fallthrough": "error",
"no-useless-escape": "error",
"no-constant-condition": "error",
"no-unreachable": "error",
"no-duplicate-case": "error",
"no-dupe-keys": "error",
"no-irregular-whitespace": "error",
"no-case-declarations": "error",
eqeqeq: ["error", "smart"],
"prefer-const": "error",
"prefer-template": "error",
radix: "error",
"comma-dangle": ["error", "always-multiline"],
semi: ["error", "always"],
};
export default [
{
ignores: ["src/vendor/", "dist/", "public/", "test/"],
},
js.configs.recommended,
// typescript-eslint scoped to TS sources only — JS keeps the core ruleset below.
...tseslint.config({
files: ["src/**/*.ts"],
extends: [tseslint.configs.recommended],
}),
eslintConfigPrettier,
{
files: ["src/**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.browser,
THREE: "readonly", // vendored three.min.js (r70, loaded via <script>)
L: "readonly", // Leaflet (loaded via <script>)
chrome: "readonly", // Chrome/Electron extension APIs (pref_storage.js)
__APP_VERSION__: "readonly", // Vite define
},
},
rules: {
...sharedRules,
"no-undef": "error",
"no-redeclare": "error",
"no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
},
},
{
files: ["src/**/*.ts"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.browser,
},
},
rules: {
...sharedRules,
// TypeScript's own checker handles undefined references and redeclarations.
"no-undef": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
},
},
];