-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy patheslint.config.mjs
More file actions
104 lines (100 loc) · 3.15 KB
/
eslint.config.mjs
File metadata and controls
104 lines (100 loc) · 3.15 KB
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
// @ts-check
import eslint from "@eslint/js";
import jsdoc from "eslint-plugin-jsdoc";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";
export default defineConfig(
{
ignores: [
"**/.next/",
"**/.svelte-kit/",
"**/.turbo/",
"**/dist/",
"**/*.d.ts",
// TODO: Consider enabling linting for scripts and examples later.
"scripts/**",
// To validate examples, uncomment apps/** and packages/** otherwise
// FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
"examples/**",
// "apps/**",
// "packages/**",
],
},
eslint.configs.recommended,
{
files: ["**/*.ts", "**/*.tsx"],
extends: [
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
jsdoc.configs["flat/recommended"],
reactHooksPlugin.configs.flat.recommended,
],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"no-console": "error",
"@typescript-eslint/array-type": ["error", { default: "generic" }],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "error",
// https://github.com/typescript-eslint/typescript-eslint/issues/8113#issuecomment-2334943836
"@typescript-eslint/no-invalid-void-type": "off",
// It seems its buggy, disable it for now.
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"jsdoc/require-jsdoc": "off",
"jsdoc/require-param": "off",
"jsdoc/require-returns": "off",
"jsdoc/tag-lines": [
"error",
"any",
{
startLines: 1,
tags: { param: { lines: "never" } },
},
],
"jsdoc/check-tag-names": [
"error",
{ definedTags: ["category", "experimental"] },
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
},
},
{
// https://github.com/vitest-dev/vitest/issues/4543#issuecomment-1824881253
files: ["**/*.test.ts", "**/*.test.tsx"],
rules: {
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off",
},
},
{
files: ["packages/vue/**/*.ts"],
rules: {
"react-hooks/rules-of-hooks": "off",
"react-hooks/exhaustive-deps": "off",
},
},
);