generated from didinele/typescript-docker-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 4
/
eslint.config.js
96 lines (87 loc) · 2.61 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
import queryPlugin from '@tanstack/eslint-plugin-query';
import common from 'eslint-config-neon/flat/common.js';
import next from 'eslint-config-neon/flat/next.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';
import tseslint from 'typescript-eslint';
const commonFiles = '{js,mjs,cjs,ts,mts,cts,jsx,tsx}';
const commonRuleset = merge(...common, {
files: [`**/*${commonFiles}`],
rules: {
'no-eq-null': ['off'],
eqeqeq: ['error', 'always', { null: 'ignore' }],
'jsdoc/no-undefined-types': ['off'],
'import/no-duplicates': ['off'],
},
});
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',
'services/**/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', 'services/*/tsconfig.eslint.json', 'packages/*/tsconfig.eslint.json'],
},
},
},
});
const reactRuleset = merge(...react, {
files: [`apps/**/*${commonFiles}`, `packages/ui/**/*${commonFiles}`],
rules: {
'@next/next/no-html-link-for-pages': 0,
'react/react-in-jsx-scope': 0,
'react/jsx-filename-extension': [1, { extensions: ['.tsx'] }],
},
});
const nextRuleset = merge(...next, { files: [`apps/**/*${commonFiles}`] });
const pluginRuleset = merge(...queryPlugin.configs['flat/recommended'], { files: [`apps/**/*${commonFiles}`] });
const prettierRuleset = merge(...prettier, { files: [`**/*${commonFiles}`] });
export default tseslint.config(
{
ignores: ['**/node_modules/', '.git/', '**/dist/', '**/coverage/', 'packages/services/core/src/db.ts'],
},
commonRuleset,
nodeRuleset,
typeScriptRuleset,
reactRuleset,
nextRuleset,
pluginRuleset,
{
files: [`apps/website/**/*${commonFiles}`],
rules: {
'no-restricted-globals': ['off'],
'n/prefer-global/url': ['off'],
'n/prefer-global/url-search-params': ['off'],
},
},
prettierRuleset,
);