-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy patheslint.config.js
More file actions
89 lines (80 loc) · 2.27 KB
/
Copy patheslint.config.js
File metadata and controls
89 lines (80 loc) · 2.27 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
import { common, edge, next, node, prettier, react, typescript } from "eslint-config-neon";
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
import reactCompiler from "eslint-plugin-react-compiler";
import merge from "lodash.merge";
import tseslint from "typescript-eslint";
const commonFiles = "{js,mjs,cjs,ts,mts,cts,jsx,tsx}";
const commonJSX = "{jsx,tsx}";
const commonRuleset = merge(...common, { files: [`**/*${commonFiles}`] });
const nodeRuleset = merge(...node, {
files: [`**/*${commonFiles}`],
rules: {
"no-restricted-globals": 0,
"n/prefer-global/url": 0,
"n/prefer-global/url-search-params": 0,
"n/prefer-global/process": 0,
},
});
const typeScriptRuleset = merge(...typescript, {
files: [`**/*${commonFiles}`],
languageOptions: {
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
allowAutomaticSingleRunInference: true,
project: ["tsconfig.eslint.json"],
},
},
rules: {
"@typescript-eslint/naming-convention": [
2,
{
selector: "typeParameter",
format: ["PascalCase"],
custom: {
regex: "^\\w{3,}",
match: true,
},
},
],
},
settings: {
"import-x/resolver-next": [
createTypeScriptImportResolver({
alwaysTryTypes: true,
project: ["tsconfig.eslint.json"],
}),
],
},
});
const reactRuleset = merge(...react, {
files: [`src/**/*${commonJSX}`, "src/**/*ts"],
plugins: {
"react-compiler": reactCompiler,
},
rules: {
"@next/next/no-html-link-for-pages": 0,
"react/react-in-jsx-scope": 0,
"react/jsx-filename-extension": [1, { extensions: [".tsx"] }],
"react/jsx-handler-names": 0,
"react-refresh/only-export-components": [0, { allowConstantExport: true }],
"react-compiler/react-compiler": 2,
"jsdoc/no-bad-blocks": 0,
"tsdoc/syntax": 0,
"@typescript-eslint/unbound-method": 0,
},
});
const nextRuleset = merge(...next, { files: [`src/**/*${commonFiles}`] });
const edgeRuleset = merge(...edge, { files: [`src/**/*${commonFiles}`] });
const prettierRuleset = merge(...prettier, { files: [`**/*${commonFiles}`] });
export default tseslint.config(
{
ignores: ["**/node_modules/", ".git/", "**/dist/", "**/coverage/", "**/.next/"],
},
commonRuleset,
nodeRuleset,
typeScriptRuleset,
reactRuleset,
nextRuleset,
edgeRuleset,
prettierRuleset,
);