-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
117 lines (114 loc) · 3.25 KB
/
.eslintrc.cjs
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
const fs = require('fs')
const prefixes = ['zss']
const srcFolders = prefixes
.map((folder) =>
fs
.readdirSync(`./${folder}`, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => `/${folder}/${dirent.name}`),
)
.concat(prefixes.map((folder) => `/${folder}`))
.flat()
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:import/errors', // Import ordering
'plugin:import/warnings', // Import ordering
'plugin:import/typescript', // Import ordering
'plugin:react/jsx-runtime',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@react-three/recommended',
'plugin:valtio/recommended',
'plugin:prettier/recommended',
// Enables eslint-plugin-prettier and eslint-config-prettier.
// This will display prettier errors as ESLint errors.
// Make sure this is always the last configuration in the extends array.
'prettier',
],
parserOptions: {
project: './tsconfig.lint.json',
},
settings: {
react: {
version: 'detect',
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx', '.js', '.jsx', '.json'],
},
'import/resolver': {
alias: {
map: [
...prefixes.map((item) => [`/${item}`, `./${item}`]),
['chevrotain', '.'],
],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
},
},
},
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
"@typescript-eslint/consistent-type-definitions": [
'error', 'type'
],
'no-console': [
'error',
{
allow: ['warn', 'error', 'info'],
},
],
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'react/react-in-jsx-scope': 'off',
'react/self-closing-comp': [
'error',
{
component: true,
html: true,
},
],
'react/prefer-stateless-function': [2],
'react/function-component-definition': [
2,
{ namedComponents: 'function-declaration' },
],
'import/no-unresolved': 'off',
'import/order': [
'error',
{
'newlines-between': 'always',
alphabetize: { order: 'asc', caseInsensitive: true },
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
pathGroups: srcFolders.map((prefix) => ({
group: 'internal',
pattern: `${prefix}/**`,
position: 'before',
})),
},
],
},
}