-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.ts
More file actions
94 lines (90 loc) · 2.34 KB
/
eslint.config.ts
File metadata and controls
94 lines (90 loc) · 2.34 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
import js from "@eslint/js"
import tseslint from "typescript-eslint"
import prettier from "eslint-plugin-prettier"
import prettierConfig from "eslint-config-prettier"
import globals from "globals"
import { Linter } from "eslint"
export default [
{
ignores: ["dist/", "node_modules/", "eslint.config.ts", "tsup.config.ts", "src/parser/cst-types.d.ts"],
},
{
files: ["**/*.{js,ts}"],
languageOptions: {
globals: {
...globals.node,
...globals.es2020,
},
ecmaVersion: 2020,
sourceType: "module",
},
plugins: {
prettier,
},
rules: {
"prettier/prettier": "warn",
},
},
{
files: ["src/**/*.ts", "tests/**/*.ts"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
"@typescript-eslint": tseslint.plugin,
},
rules: {
...js.configs.recommended.rules,
...tseslint.configs.recommended.reduce(
(acc, config) => ({ ...acc, ...config.rules }),
{} as Linter.RulesRecord,
),
...tseslint.configs.recommendedTypeChecked.reduce(
(acc, config) => ({ ...acc, ...config.rules }),
{} as Linter.RulesRecord,
),
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
caughtErrors: "none",
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: false,
},
],
"quote-props": ["error", "as-needed"],
"object-shorthand": ["error", "always"],
"no-unused-vars": "off",
"no-var": ["error"],
"no-console": [
"warn",
{
allow: ["warn", "error", "info"],
},
],
// NaN is used as a Chevrotain token name (SQL NaN keyword)
"no-shadow-restricted-names": "off",
},
},
{
files: ["tests/**/*.ts"],
languageOptions: {
globals: {
...globals.vitest,
},
},
},
prettierConfig,
] satisfies Linter.Config[]