-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheslint.base.mjs
More file actions
68 lines (67 loc) · 2.51 KB
/
Copy patheslint.base.mjs
File metadata and controls
68 lines (67 loc) · 2.51 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
// Shared ESLint flat-config base for all workspace packages.
// Uses the unified `typescript-eslint` package (replaces the legacy
// `@typescript-eslint/*` + `FlatCompat` shim setup). Package configs extend
// this and layer on framework-specific plugins (React, Next) as needed.
//
// NOTE: `js.configs.recommended` (eslint:recommended) is intentionally NOT
// enabled here to preserve the prior effective rule set. It can be layered on
// later together with an `eslint --fix` pass (surfaces no-useless-escape etc.).
// Formatting rules (semi/quotes/etc.) are intentionally NOT enforced here —
// Prettier owns formatting; each package appends `eslint-config-prettier`.
//
// Unused imports/vars are handled by `eslint-plugin-unused-imports`:
// `no-unused-imports` is an auto-fixable error (dead imports are stripped by
// `--fix`), while `no-unused-vars` stays a warning with `^_` ignore patterns.
import tseslint from "typescript-eslint";
import unusedImports from "eslint-plugin-unused-imports";
export default tseslint.config(
...tseslint.configs.recommended,
{
plugins: {
"unused-imports": unusedImports,
},
languageOptions: {
ecmaVersion: 2024,
sourceType: "module",
},
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-inferrable-types": [
"warn",
{ ignoreParameters: true },
],
// Delegate unused-import/var handling to eslint-plugin-unused-imports so
// dead imports can be auto-removed with `--fix`.
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-unused-expressions": [
"error",
{ allowShortCircuit: true, allowTernary: true },
],
"@typescript-eslint/no-empty-object-type": [
"error",
{ allowInterfaces: "with-single-extends" },
],
"@typescript-eslint/consistent-type-imports": "error",
},
},
{
// Ambient declaration files (`*.d.ts`) legitimately declare types/members
// that are never referenced from within the file itself; don't flag them.
files: ["**/*.d.ts"],
rules: {
"unused-imports/no-unused-vars": "off",
},
},
);