-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
80 lines (73 loc) · 2.08 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
import common from "eslint-config-neon/flat/common.js";
import node from "eslint-config-neon/flat/node.js";
import prettier from "eslint-config-neon/flat/prettier.js";
import react from "eslint-config-neon/flat/react.js";
import typescript from "eslint-config-neon/flat/typescript.js";
import merge from "lodash.merge";
const commonFiles = "{js,mjs,cjs,ts,mts,cts,jsx,tsx}";
const commonRuleset = merge(...common, { files: [`**/*${commonFiles}`] });
const nodeRuleset = merge(...node, { files: [`**/*${commonFiles}`] });
const prettierRuleset = merge(...prettier, { files: [`**/*${commonFiles}`] });
const typeScriptRuleset = merge(...typescript, {
files: [`**/*${commonFiles}`],
languageOptions: {
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
allowAutomaticSingleRunInference: true,
project: [
"tsconfig.eslint.json",
"apps/*/tsconfig.eslint.json",
"packages/*/tsconfig.eslint.json",
],
},
},
rules: {
"@typescript-eslint/consistent-type-definitions": [2, "interface"],
"@typescript-eslint/naming-convention": [
2,
{
selector: "typeParameter",
format: ["PascalCase"],
custom: {
regex: "^\\w{3,}",
match: true,
},
},
],
},
settings: {
"import/resolver": {
typescript: {
project: [
"tsconfig.eslint.json",
"apps/*/tsconfig.eslint.json",
"packages/*/tsconfig.eslint.json",
],
},
},
},
});
/** @type {import('eslint').Linter.FlatConfig[]} */
const reactRuleset = merge(...react, {
files: [`**/*${commonFiles}`],
rules: {
"react/react-in-jsx-scope": 0,
"react/jsx-filename-extension": [1, { extensions: [".tsx"] }],
"@typescript-eslint/triple-slash-reference": 0,
},
});
/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
{
ignores: ["**/node_modules/", ".git/", "**/dist/"],
},
{
files: ["**/*{js,mjs,cjs,jsx}"],
rules: { "tsdoc/syntax": 0 },
},
commonRuleset,
nodeRuleset,
typeScriptRuleset,
prettierRuleset,
reactRuleset,
];