-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.mjs
More file actions
99 lines (97 loc) · 2.88 KB
/
eslint.config.mjs
File metadata and controls
99 lines (97 loc) · 2.88 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import { fileURLToPath, URL } from "node:url";
import { includeIgnoreFile } from "@eslint/compat";
import { defineConfig } from "eslint/config";
import importPlugin from "eslint-plugin-import";
import tseslint from "typescript-eslint";
export default defineConfig(
includeIgnoreFile(fileURLToPath(new URL(".gitignore", import.meta.url))),
{
rules: {
"object-shorthand": ["error", "always"],
},
},
{
extends: [
// Base recommended rules from @typescript-eslint.
tseslint.configs.recommendedTypeChecked,
// In the future, we might want to switch to more strict configs.
// tseslint.configs.strictTypeChecked,
// tseslint.configs.stylisticTypeChecked,
],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// Covered by biome.
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
// Covered by @typescript-eslint/no-floating-promises.
"@typescript-eslint/require-await": "warn",
// Customize @typescript-eslint/no-floating-promises.
"@typescript-eslint/no-floating-promises": [
"warn",
{ checkThenables: true },
],
},
},
{
extends: [
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
"import/extensions": ["error", "ignorePackages"],
"import/enforce-node-protocol-usage": ["error", "always"],
"import/newline-after-import": ["error", { considerComments: true }],
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
"import/exports-last": "off",
"import/first": "error",
"import/no-absolute-path": "error",
"import/no-amd": "error",
"import/no-commonjs": "error",
"import/no-cycle": "error",
"import/no-deprecated": "error",
"import/no-dynamic-require": "error",
"import/no-empty-named-blocks": "error",
"import/no-extraneous-dependencies": "error",
"import/no-mutable-exports": "error",
"import/no-relative-packages": "error",
"import/no-relative-parent-imports": "off",
"import/no-self-import": "error",
"import/no-unassigned-import": ["error", { allow: ["**/*.css"] }],
"import/no-unused-modules": "warn",
"import/no-unresolved": [
"off", // fs-extra/esm fails to import types in compliance with this rule - app works but eslint doesn't understand what is going on
{ ignore: ["^vscode$", "^typescript-eslint$"] },
],
"import/no-useless-path-segments": "error",
"import/no-webpack-loader-syntax": "error",
"import/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
],
alphabetize: {
order: "asc",
caseInsensitive: true,
},
"newlines-between": "always",
warnOnUnassignedImports: true,
},
],
},
},
);