generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
155 lines (153 loc) · 3.8 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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// SPDX-FileCopyrightText: 2024 Telefónica Innovación Digital
// SPDX-License-Identifier: MIT
import json from "@eslint/json";
import markdown from "@eslint/markdown";
import prettier from "eslint-plugin-prettier";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import eslintConfigPrettier from "eslint-config-prettier";
import js from "@eslint/js";
import globals from "globals";
// eslint-disable-next-line import/no-unresolved
import typescriptParser from "@typescript-eslint/parser";
// eslint-disable-next-line import/no-unresolved
import typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
import pluginJest from "eslint-plugin-jest";
import importPlugin from "eslint-plugin-import";
export default [
{
ignores: ["node_modules/**", ".husky/**", "package-lock.json", "dist/**"],
},
{
files: ["**/*.json"],
ignores: ["nx.json", "**/project.json"],
language: "json/json",
plugins: {
json,
},
rules: {
"json/no-duplicate-keys": "error",
"json/no-empty-keys": "error",
},
},
{
files: ["**/*.jsonc", "nx.json", "**/project.json"],
language: "json/jsonc",
plugins: {
json,
},
rules: {
"json/no-duplicate-keys": "error",
"json/no-empty-keys": "error",
},
},
{
files: ["**/*.md"],
plugins: {
markdown,
},
language: "markdown/commonmark",
rules: {
"markdown/no-html": [0],
},
},
{
files: [
"**/*.js",
"**/*.cjs",
"**/*.mjs",
"**/*.jsx",
"**/*.ts",
"**/*.tsx",
],
plugins: {
prettier,
import: importPlugin,
},
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.node,
},
},
rules: {
...importPlugin.flatConfigs.recommended.rules,
...js.configs.recommended.rules,
...eslintConfigPrettier.rules,
...eslintPluginPrettierRecommended.rules,
camelcase: [2, { properties: "never" }],
"no-console": [2, { allow: ["warn", "error"] }],
"no-shadow": [2, { builtinGlobals: true, hoist: "all" }],
"no-undef": [2],
"no-unused-vars": [
2,
{ vars: "all", args: "after-used", ignoreRestSiblings: false },
],
},
},
{
files: ["**/*.cjs"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "commonjs",
},
},
{
files: ["**/*.ts"],
languageOptions: {
parser: typescriptParser,
parserOptions: {
projectService: true,
},
},
plugins: {
"@typescript-eslint": typescriptEslintPlugin,
},
rules: {
...typescriptEslintPlugin.configs.recommended.rules,
},
settings: {
"import/resolver": {
typescript: {
extensions: [".ts", ".tsx"],
alwaysTryTypes: true,
},
node: true,
},
},
},
{
files: ["test/**/*.ts"],
plugins: {
jest: pluginJest,
},
...pluginJest.configs["flat/recommended"],
languageOptions: {
globals: pluginJest.environments.globals.globals,
},
settings: {
"import/resolver": {
typescript: {
extensions: [".ts", ".tsx"],
alwaysTryTypes: true,
project: ["./test/tsconfig.json"],
},
node: true,
},
},
rules: {
...pluginJest.configs["flat/all"].rules,
"jest/no-disabled-tests": "error",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "error",
"jest/valid-expect": "error",
"jest/prefer-strict-equal": [0],
"jest/prefer-importing-jest-globals": [0],
"jest/prefer-expect-assertions": [0],
"jest/no-hooks": [0],
"jest/prefer-called-with": [0],
"jest/require-to-throw-message": [0],
},
},
];