-
Notifications
You must be signed in to change notification settings - Fork 1
/
eslint.config.js
57 lines (54 loc) · 1.69 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
const path = require("node:path")
const fs = require("node:fs")
const eslint = require("@eslint/js")
const globals = require("globals")
const prettier = require("eslint-config-prettier")
const typescriptParser = require("@typescript-eslint/parser")
const typescriptPlugin = require("@typescript-eslint/eslint-plugin")
const tsdocPlugin = require("eslint-plugin-tsdoc")
const importsPlugin = require("eslint-plugin-simple-import-sort")
const headerPlugin = require("eslint-plugin-header")
const license = fs.readFileSync(path.join(__dirname, "LICENSE"), "utf8")
module.exports = [
{ ignores: ["dist/**"] },
eslint.configs.recommended,
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: 11,
globals: { ...globals.es2020, ...globals.commonjs, ...globals.node },
},
},
{
files: ["**/*.ts"],
languageOptions: {
parser: typescriptParser,
parserOptions: { project: true },
},
plugins: {
"@typescript-eslint": typescriptPlugin,
tsdoc: tsdocPlugin,
imports: importsPlugin,
},
rules: {
...typescriptPlugin.configs["eslint-recommended"].overrides[0].rules,
...typescriptPlugin.configs["strict-type-checked"].rules,
...typescriptPlugin.configs["stylistic-type-checked"].rules,
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/consistent-type-imports": [
"warn",
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
],
"tsdoc/syntax": "warn",
"imports/imports": "warn",
},
},
{
files: ["src/**"],
plugins: { header: headerPlugin },
rules: {
"header/header": ["error", "block", `\n${license.trim()}\n`],
},
},
prettier,
]