generated from nihalgonsalves/node-typescript-eslint-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
95 lines (92 loc) · 2.42 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
import tseslint from "typescript-eslint";
import unusedImports from "eslint-plugin-unused-imports";
import storybook from "eslint-plugin-storybook";
import reactCompiler from "eslint-plugin-react-compiler";
import sharedConfig from "@nihalgonsalves/esconfig/eslint.config.react-shared.js";
export default tseslint.config(
{
ignores: [
"**/build",
"**/coverage",
"**/dist",
"!packages/frontend/.storybook",
"packages/e2e/playwright-report",
"packages/e2e/test-results",
// Not part of any tsc project and tseslint's new project service does not support multiple tsconfigs for a directory, e.g. a root tsconfig.tools.json
"vitest.workspace.ts",
"eslint.config.js",
".prettierrc.js",
],
},
...sharedConfig,
{
plugins: {
"unused-imports": unusedImports,
"react-compiler": reactCompiler,
},
rules: {
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
},
},
{
files: ["**/*.test.ts", "packages/*/test/**/*", "packages/e2e/**/*"],
rules: {
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
},
},
{
files: ["packages/e2e/**/*"],
rules: {
// false positive with Playwright's `use`
"react-hooks/rules-of-hooks": "off",
},
},
{
plugins: {
storybook,
},
files: ["**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)", "**/.storybook/**/*"],
rules: {
"import/no-default-export": "off",
},
},
...storybook.configs.recommended.overrides,
{
files: ["packages/frontend/**/*"],
rules: {
"react-compiler/react-compiler": "error",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: {
attributes: false,
},
},
],
},
},
{
files: ["packages/*/bin/**/*"],
rules: {
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
},
},
{
files: ["packages/frontend/src/pages/**/*", "**/*.config.*"],
rules: {
"import/no-default-export": "off",
},
},
);