-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
73 lines (66 loc) · 2.06 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
import { fixupPluginRules } from "@eslint/compat";
import eslint from "@eslint/js";
import tsEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
// @ts-expect-error - no types available
import pluginCypress from "eslint-plugin-cypress";
// @ts-expect-error - no types available
import jsonEslint from "@eslint/json";
// @ts-expect-error - no types available
import pluginCypressFlat from "eslint-plugin-cypress/flat";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import testingLibrary from "eslint-plugin-testing-library";
import globals from "globals";
export default [
// recommended config
{ files: ["**/*.{,c,m}{t,j}s{,x}"], ...eslint.configs.recommended },
// nodejs
{
languageOptions: {
globals: {
...globals.nodeBuiltin,
},
},
},
// TypeScript configuration
{
files: ["**/*.{,c,m}{t,j}s{,x}"],
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.lint.json",
},
},
plugins: {
"@typescript-eslint": tsEslint,
},
rules: {
...tsEslint.configs.recommended?.rules,
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
},
},
// tests config
// - cypress
// - testing-library (not yet compatible with eslint flat config)
{
files: ["packages/e2e-tests/**/*.*s"],
...pluginCypressFlat.configs.recommended,
plugins: {
cypress: fixupPluginRules(pluginCypress),
"testing-library": fixupPluginRules({
rules: testingLibrary.rules,
}),
},
rules: {
...testingLibrary.configs.dom.rules,
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
},
},
// lint JSON files
{ files: ["**/*.json"], language: "json/json", ...jsonEslint.configs.recommended },
{ files: ["**/*tsconfig*.json"], language: "json/jsonc" },
// ignore generated files
{ ignores: ["packages/app/dist", "packages/lit-ssr-demo/lib"] },
// Prettier configuration, should be last
eslintPluginPrettierRecommended,
];