forked from ansible/vscode-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
71 lines (69 loc) · 2.37 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
// @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 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.recommended, // TODO: switch to 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"],
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-unused-vars": "error",
"no-case-declarations": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-empty-function": "error",
"no-prototype-builtins": "error",
"tsdoc/syntax": "error",
// Needed for tseslint.configs.strictTypeChecked
// "@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",
},
},
);