forked from vscode-neovim/vscode-neovim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.cjs
97 lines (95 loc) · 3.83 KB
/
eslint.config.cjs
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
95
96
97
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended");
const importsPlugin = require("eslint-plugin-import");
const globals = require("globals");
module.exports = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
plugins: {
import: importsPlugin,
},
ignores: ["eslint.config.cjs"],
languageOptions: {
ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features
sourceType: "module", // Allows for the use of imports
globals: {
...globals.node,
...globals.es6,
},
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
},
linterOptions: {
reportUnusedDisableDirectives: "error",
},
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
quotes: ["error", "double", { avoidEscape: true, allowTemplateLiterals: false }],
eqeqeq: ["error", "smart"],
"no-unused-vars": [
"error",
{
vars: "all",
args: "after-used",
ignoreRestSiblings: false,
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"require-atomic-updates": "off", // many false positives, boring for nonsense
// these are don't work with TS and TS already checks imports
"import/default": "off",
"import/no-unresolved": "off",
"import/named": "off",
// boring
"import/no-named-as-default": "off",
"import/no-duplicates": "warn",
"import/no-extraneous-dependencies": "warn",
"import/order": ["warn", { "newlines-between": "always" }],
"import/newline-after-import": "warn",
},
},
{
files: ["src/**/*.ts"],
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
vars: "all",
args: "after-used",
ignoreRestSiblings: true,
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/restrict-template-expressions": "off", // too jumpy
"@typescript-eslint/no-misused-promises": "off", // too jumpy
"@typescript-eslint/no-floating-promises": "off", // jumpy; would be nice to turn on, but we have a lot of these
"@typescript-eslint/unbound-method": "off", // jumpy, given how vscode's API binds this. Would be good to remove.
// This codebase interacts with `any` a lot, so for now, all no-unsafe-* we violate are currently disabled
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
},
},
{
files: ["src/test/**/*.test.ts"],
languageOptions: {
globals: {
...globals.mocha,
},
},
},
// Must be the last configuration item per project README
eslintPluginPrettierRecommended,
);