forked from ansible/vscode-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
111 lines (109 loc) · 4 KB
/
eslint.config.mjs
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// @ts-check
// cspell: ignore tseslint
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import tsParser from "@typescript-eslint/parser";
import ts from "@typescript-eslint/eslint-plugin";
import tsdocPlugin from "eslint-plugin-tsdoc";
import prettierRecommendedConfig from "eslint-plugin-prettier/recommended";
import pluginChaiFriendly from "eslint-plugin-chai-friendly";
import globals from "globals";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory
export default tseslint.config(
{
ignores: [
"**/out/",
".vscode-test/*",
".yarn/*",
"media/*",
"site/*",
"commitlint.config.js",
],
},
{
extends: [
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
prettierRecommendedConfig,
],
files: [
"**/*.{js,ts,tsx}",
"packages/**/*.{js,ts,tsx}",
"test/**/*.{js,ts,tsx}",
],
languageOptions: {
globals: {
...globals.node,
...globals.mocha,
...globals.commonjs,
...globals.es2017,
},
parser: tsParser,
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
},
plugins: {
// loaded implicitly, will trigger 'Cannot redefine plugin' if enabled:
// "@typescript-eslint": ts,
tsdoc: tsdocPlugin,
},
rules: {
eqeqeq: ["error", "smart"],
// Needed for tseslint.configs.strictTypeChecked
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unnecessary-condition": "off",
"@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/prefer-promise-reject-errors": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/no-dynamic-delete": "off",
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/prefer-literal-enum-member": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/await-thenable": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/only-throw-error": "off",
"no-case-declarations": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-empty-function": "error",
"no-prototype-builtins": "error",
"tsdoc/syntax": "error",
// "@typescript-eslint/require-await": "error",
// "@typescript-eslint/await-thenable": "error",
"@typescript-eslint/unbound-method": "error",
// "@typescript-eslint/no-unsafe-member-access": "error",
// "@typescript-eslint/no-floating-promises": "error",
// "@typescript-eslint/restrict-template-expressions": "error",
// "@typescript-eslint/no-unsafe-argument": "error",
// "@typescript-eslint/no-unsafe-return": "error",
},
},
{
plugins: { "chai-friendly": pluginChaiFriendly },
files: ["**/test/**/*.{js,ts,tsx}"],
rules: {
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-require-imports": "off",
"chai-friendly/no-unused-expressions": "error",
},
},
);