-
-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy patheslint.config.js
175 lines (164 loc) · 4.74 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import unocss from '@unocss/eslint-plugin';
import common from 'eslint-config-neon/common';
import edge from 'eslint-config-neon/edge';
import jsxa11y from 'eslint-config-neon/jsx-a11y';
import next from 'eslint-config-neon/next';
import node from 'eslint-config-neon/node';
import prettier from 'eslint-config-neon/prettier';
import react from 'eslint-config-neon/react';
import typescript from 'eslint-config-neon/typescript';
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
import reactCompiler from 'eslint-plugin-react-compiler';
// import oxlint from 'eslint-plugin-oxlint';
import merge from 'lodash.merge';
import tseslint from 'typescript-eslint';
const commonFiles = '{js,mjs,cjs,ts,mts,cts,jsx,tsx}';
const commonRuleset = merge(...common, { files: [`**/*${commonFiles}`] });
const nodeRuleset = merge(...node, { 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-x/resolver-next': [
createTypeScriptImportResolver({
noWarnOnMultipleProjects: true,
project: ['tsconfig.eslint.json', 'apps/*/tsconfig.eslint.json', 'packages/*/tsconfig.eslint.json'],
}),
],
},
});
const reactRuleset = merge(...react, {
files: [`apps/**/*${commonFiles}`, `packages/ui/**/*${commonFiles}`],
plugins: {
'react-compiler': reactCompiler,
},
rules: {
'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 jsxa11yRuleset = merge(...jsxa11y, { files: [`apps/**/*${commonFiles}`, `packages/ui/**/*${commonFiles}`] });
const nextRuleset = merge(...next, { files: [`apps/**/*${commonFiles}`] });
const edgeRuleset = merge(...edge, { files: [`apps/**/*${commonFiles}`] });
const prettierRuleset = merge(...prettier, { files: [`**/*${commonFiles}`] });
// const oxlintRuleset = merge({ rules: oxlint.rules }, { files: [`**/*${commonFiles}`] });
export default tseslint.config(
{
ignores: [
'**/node_modules/',
'.git/',
'**/dist/',
'**/template/',
'**/coverage/',
'**/storybook-static/',
'**/.next/',
'packages/discord.js/',
],
},
commonRuleset,
nodeRuleset,
typeScriptRuleset,
{
files: ['**/*{ts,mts,cts,tsx}'],
rules: { 'jsdoc/no-undefined-types': 0 },
},
{
files: [`packages/{api-extractor,brokers,create-discord-bot,docgen,ws}/**/*${commonFiles}`],
rules: { 'n/no-sync': 0 },
},
{
files: [`packages/api-extractor/**/*${commonFiles}`],
rules: {
'consistent-this': 0,
'unicorn/no-this-assignment': 0,
'@typescript-eslint/no-this-alias': 0,
},
},
{
files: [`packages/api-extractor-model/**/*${commonFiles}`],
rules: {
'@typescript-eslint/no-namespace': 0,
'no-prototype-builtins': 0,
'consistent-this': 0,
'unicorn/no-this-assignment': 0,
'@typescript-eslint/no-this-alias': 0,
},
},
{
files: [`packages/{api-extractor,api-extractor-model,api-extractor-utils}/**/*${commonFiles}`],
rules: {
'n/prefer-global/process': 0,
'@typescript-eslint/naming-convention': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/no-empty-object-type': 0,
'@typescript-eslint/switch-exhaustiveness-check': 0,
'@typescript-eslint/prefer-nullish-coalescing': 0,
},
},
{
files: [`packages/builders/**/*${commonFiles}`],
rules: {
'@typescript-eslint/no-empty-object-type': 0,
},
},
{
files: [`packages/rest/**/*${commonFiles}`],
rules: {
'n/prefer-global/url': 0,
'n/prefer-global/url-search-params': 0,
'n/prefer-global/buffer': 0,
'n/prefer-global/process': 0,
'no-restricted-globals': 0,
'unicorn/prefer-node-protocol': 0,
},
},
{
files: [`packages/voice/**/*${commonFiles}`],
rules: {
'no-restricted-globals': 0,
'n/prefer-global/buffer': 0,
'@typescript-eslint/no-unsafe-declaration-merging': 0,
},
},
reactRuleset,
jsxa11yRuleset,
{
files: [`apps/guide/**/*${commonFiles}`, `packages/ui/**/*${commonFiles}`],
plugins: { '@unocss': unocss },
rules: {
'@unocss/order': 2,
},
},
nextRuleset,
edgeRuleset,
{
files: ['**/*{js,mjs,cjs,jsx}'],
rules: { 'tsdoc/syntax': 0 },
},
prettierRuleset,
// oxlintRuleset,
);