-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslint.config.mjs
More file actions
67 lines (64 loc) · 1.97 KB
/
eslint.config.mjs
File metadata and controls
67 lines (64 loc) · 1.97 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
import eslint from "@eslint/js"
import ava from "eslint-plugin-ava"
import github from "eslint-plugin-github"
import simpleImportSort from "eslint-plugin-simple-import-sort"
import tseslint from "typescript-eslint"
import globals from "globals"
export default tseslint.config(
{
ignores: ["dist/**", "lib/**"]
},
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
github.getFlatConfigs().recommended,
{
files: ["test/**/*.ts"],
plugins: {
ava: ava
},
rules: {
// Apply AVA rules except no-ignored-test-files
...ava.configs["flat/recommended"].rules,
// Disable this rule because we run AVA on compiled JS files (lib/test/**/*.js)
// while ESLint analyzes the source TypeScript files (test/**/*.ts)
"ava/no-ignored-test-files": "off"
}
},
{
files: ["src/**/*.ts", "test/**/*.ts"],
plugins: {
"simple-import-sort": simpleImportSort
},
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname
},
globals: globals.node
},
rules: {
// Disable conflicting rules from plugins
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"import/no-unresolved": "off",
camelcase: "off",
semi: "off",
"sort-imports": "off",
// Custom overrides
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/explicit-function-return-type": [
"error",
{ allowExpressions: true }
],
// Import sorting
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error"
}
}
)