-
Notifications
You must be signed in to change notification settings - Fork 89
/
eslint.config.js
65 lines (64 loc) · 2.3 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
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const tsdoc = require("eslint-plugin-tsdoc");
const vitest = require("@vitest/eslint-plugin");
const globals = require("globals");
const prettier = require("eslint-config-prettier");
module.exports = tseslint.config([
{ ignores: ["dist/", "tests/env/", "coverage/", "playgrounds/", "docs/"] },
eslint.configs.recommended,
{
files: ["**/*.js"],
languageOptions: { sourceType: "commonjs", globals: globals.node },
},
// TSDoc
{
files: ["src/**/*.ts"],
plugins: { tsdoc },
rules: { "tsdoc/syntax": "error" },
},
// TypeScript
{
files: ["**/*.ts"],
extends: [tseslint.configs.recommendedTypeChecked],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
},
},
rules: {
// TODO: Remove the ones between "~~", adapt code
// ~~
"@typescript-eslint/prefer-as-const": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-floating-promises": "off",
// ~~
"@typescript-eslint/array-type": ["warn", { default: "array-simple" }],
// TODO: Should be careful with this rule, should leave it be and disable
// it within files where necessary with explanations
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error",
// argsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#argsignorepattern
// varsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#varsignorepattern
{ args: "all", argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
// TODO: Not recommended to disable rule, should instead disable locally
// with explanation
"@typescript-eslint/ban-ts-ignore": "off",
},
},
// Vitest
{
files: ["tests/**/*.test.ts"],
extends: [vitest.configs.recommended],
},
// Disable any style linting, as prettier takes care of that separately
prettier,
]);