Skip to content

Commit 593c9c5

Browse files
committed
chore: eslint config
1 parent 82bb2de commit 593c9c5

File tree

2 files changed

+148
-12
lines changed

2 files changed

+148
-12
lines changed

eslint.config.ts

Lines changed: 139 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,145 @@
1-
import config from '@antfu/eslint-config'
1+
import config from '@antfu/eslint-config';
22

33
export default await config({
44
react: true,
55
rules: {
6+
'antfu/if-newline': 'off',
7+
'antfu/top-level-function': 'off',
8+
'antfu/consistent-list-newline': 'off',
9+
'unicorn/number-literal-case': 'off',
10+
// 'style/quote-props': ['error', 'consistent-as-needed'],
11+
// 'style/member-delimiter-style': ['error', {
12+
// multiline: {
13+
// delimiter: 'none',
14+
// requireLast: false,
15+
// },
16+
// }],
17+
18+
'style/quote-props': 'off',
19+
'style/member-delimiter-style': 'off', // TODO
20+
21+
'indent': ['error', 2, { SwitchCase: 1 }],
22+
'max-len': ['error', {
23+
code: 120,
24+
ignoreComments: true,
25+
ignorePattern: '\\sd=\".+\"',
26+
}],
27+
'array-bracket-newline': [2, 'consistent'],
28+
// 'no-null/no-null': 2,
29+
'no-console': 'error',
30+
'semi': ['error', 'always'],
631
'style/semi': ['error', 'always'],
32+
'no-implicit-coercion': 'error',
33+
// 'react-hooks/exhaustive-deps': 'off',
34+
// 'react-hooks-static-deps/exhaustive-deps': ['error', {
35+
// 'additionalHooks': '(useSyncEffect|useAsync|useDebouncedCallback|useThrottledCallback|useEffectWithPrevDeps|useLayoutEffectWithPrevDeps|useDerivedState|useDerivedSignal|useThrottledResolver|useDebouncedResolver|useThrottleForHeavyAnimation)$',
36+
// 'staticHooks': {
37+
// 'getActions': true,
38+
// 'useFlag': [false, true, true],
39+
// 'useForceUpdate': true,
40+
// 'useReducer': [false, true],
41+
// 'useLastCallback': true
42+
// }
43+
// }],
44+
'arrow-body-style': 'off',
45+
'no-else-return': 'off',
46+
'no-plusplus': 'off',
47+
'no-void': 'off',
48+
'no-continue': 'off',
49+
'default-case': 'off',
50+
'no-param-reassign': 'off',
51+
'no-prototype-builtins': 'off',
52+
'no-await-in-loop': 'off',
53+
'no-nested-ternary': 'off',
54+
'function-paren-newline': ['error', 'consistent'],
55+
'prefer-destructuring': 'off',
56+
'no-restricted-syntax': [
57+
'error',
58+
{
59+
selector: 'ForInStatement',
60+
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
61+
},
62+
{
63+
selector: 'LabeledStatement',
64+
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
65+
},
66+
{
67+
selector: 'WithStatement',
68+
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
69+
},
70+
],
71+
'import/no-extraneous-dependencies': 'off',
72+
'import/prefer-default-export': 'off',
73+
'import/named': 'off',
74+
'import/no-webpack-loader-syntax': 'off',
75+
// 'import/no-cycle': ['error', {
76+
// 'allowUnsafeDynamicCyclicDependency': true
77+
// }],
78+
'react/prop-types': 'off',
79+
'react/jsx-one-expression-per-line': 'off',
80+
'react/button-has-type': 'off',
81+
'react/require-default-props': 'off',
82+
'react/function-component-definition': 'off',
83+
'react/style-prop-object': 'off',
84+
'react/no-unknown-property': 'off',
85+
// 'react/jsx-no-bind': ['error', {
86+
// 'ignoreRefs': true,
87+
// 'allowArrowFunctions': false,
88+
// 'allowFunctions': false,
89+
// 'allowBind': false,
90+
// 'ignoreDOMComponents': true
91+
// }],
92+
'jsx-a11y/click-events-have-key-events': 'off',
93+
'jsx-a11y/mouse-events-have-key-events': 'off',
94+
'jsx-a11y/no-static-element-interactions': 'off',
95+
'jsx-a11y/label-has-associated-control': 'off',
96+
'jsx-a11y/anchor-is-valid': 'off',
97+
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'off',
98+
'jsx-a11y/media-has-caption': 'off',
99+
// 'no-async-without-await/no-async-without-await': 1,
100+
'@typescript-eslint/no-use-before-define': ['error', {
101+
functions: false,
102+
}],
103+
'@typescript-eslint/camelcase': 'off',
104+
// '@typescript-eslint/member-delimiter-style': 'error',
105+
'@typescript-eslint/default-param-last': 'off',
106+
// '@typescript-eslint/return-await': ['error', 'in-try-catch'],
107+
// '@typescript-eslint/consistent-type-imports': ['error', {
108+
// 'prefer': 'type-imports',
109+
// 'disallowTypeAnnotations': false
110+
// }],
111+
// 'simple-import-sort/imports': ['error', {
112+
// 'groups': [
113+
// ["^\\u0000"],
114+
// [
115+
// "^react",
116+
// "^@?\\w",
117+
// "dist(/.*|$)",
118+
// "^(\\.+/)+(lib/(teact|gramjs))(/.*|$)",
119+
// "^(\\.+/)+global$"
120+
// ],
121+
// [
122+
// "^(\\.+/)+.+\\u0000$",
123+
// "^(\\.+/|\\w+/)+(types)(/.*|$)",
124+
// "^(\\.+/|\\w+/)+(types)\\u0000"
125+
// ],
126+
// [
127+
// "^(\\.+/)+config",
128+
// "^(\\.+/)+(lib)(?!/(gramjs|teact))(/.*|$)",
129+
// "^(\\.+/)+global/.+",
130+
// "^(\\.+/)+(util)(/.*|$)",
131+
// "^\\.\\.(?!/?$)",
132+
// "^\\.\\./?$",
133+
// "^\\./(?=.*/)(?!/?$)",
134+
// "^\\.(?!/?$)",
135+
// "^\\./?$"
136+
// ],
137+
// [".+(/hooks/)(.*|$)"],
138+
// ["\/[A-Z](([a-z]+[A-Z]?)*)" ],
139+
// ["^.+\\.s?css$"],
140+
// ["^(\\.+/)+(assets)(/.*|$)"]
141+
// ]
142+
// }]
7143
},
8144
ignores: [
9145
'**/*.tsx',
@@ -23,5 +159,5 @@ export default await config({
23159
'dist-electron',
24160
'public',
25161
'deploy/update_version.js',
26-
]
27-
})
162+
],
163+
});

tsconfig.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@
22
"compilerOptions": {
33
// We don't care about this since Webpack runs Babel after TypeScript
44
"target": "esnext",
5+
"jsx": "react",
56
"lib": [
67
"dom",
78
"dom.iterable",
89
"webworker",
910
"es2021"
1011
],
11-
"allowJs": true,
12-
"skipLibCheck": true,
13-
"esModuleInterop": true,
14-
"allowSyntheticDefaultImports": true,
15-
"strict": true,
16-
"forceConsistentCasingInFileNames": true,
1712
"module": "esnext",
1813
"moduleResolution": "bundler",
1914
"resolveJsonModule": true,
20-
"isolatedModules": true,
15+
"allowJs": true,
16+
"strict": true,
2117
"noEmit": true,
22-
"jsx": "react"
18+
"allowSyntheticDefaultImports": true,
19+
"esModuleInterop": true,
20+
"forceConsistentCasingInFileNames": true,
21+
"isolatedModules": true,
22+
"skipLibCheck": true
2323
},
2424
"include": [
2525
"src",
2626
"tests",
2727
"plugins",
2828
"dev",
2929
"rsbuild.config.ts",
30-
"rsbuild-electron.config.ts",
30+
"rsbuild-electron.config.ts"
3131
]
3232
}

0 commit comments

Comments
 (0)