forked from tobspr-games/shapez.io
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy patheslint.config.js
65 lines (61 loc) · 1.7 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
import eslint from "@eslint/js";
import globals from "globals";
import path from "path";
import tseslint from "typescript-eslint";
import { fileURLToPath } from "url";
const baseConfig = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
// Enable type-aware linting
{
languageOptions: {
parserOptions: {
project: true,
// FIXME: Node.js 21.2.0 introduced import.meta.dirname
tsconfigRootDir: path.dirname(fileURLToPath(import.meta.url)),
},
},
},
// Disable type-aware linting for JS files as it causes issues
{
files: ["*.js"],
...tseslint.configs.disableTypeChecked,
}
);
const nodeConfig = tseslint.config(...baseConfig, {
languageOptions: {
sourceType: "module",
globals: {
...globals.node,
},
},
});
const runtimeConfig = tseslint.config(...baseConfig, {
languageOptions: {
sourceType: "module",
globals: {
...globals.browser,
},
},
rules: {
// Mostly caused by JSDoc imports, disable for now
"@typescript-eslint/no-unused-vars": "off",
// FIXME: enforce when we're ready to
"prefer-const": "warn",
},
});
// I don't know what the ESLint devs were thinking about. This is just horrible
export default [
{
ignores: ["build/*"],
},
...nodeConfig.map(config => ({
...config,
files: ["*.{ts,js}", "{gulp,electron}/**/*.{ts,js}"],
ignores: ["gulp/preloader/*.js"],
})),
...runtimeConfig.map(config => ({
...config,
files: ["src/**/*.{ts,js,tsx,jsx}"],
})),
];