@@ -69,6 +69,222 @@ export default antfu(
6969 multilineDetection : 'brackets' ,
7070 overrides : { } ,
7171 } ] ,
72+
73+ /**
74+ * back `@stylistic/no-multiple-empty-lines` to default error
75+ * - https://eslint.style/rules/default/no-multiple-empty-lines
76+ * - https://github.com/eslint-stylistic/eslint-stylistic/blob/v3.0.1/packages/eslint-plugin/configs/customize.ts#L104
77+ */
78+ 'style/no-multiple-empty-lines' : [ 'error' , { max : 2 , maxBOF : 1 , maxEOF : 2 } ] ,
79+
80+ /**
81+ * - https://eslint.style/rules/default/jsx-quotes
82+ * - https://github.com/eslint-stylistic/eslint-stylistic/blob/v3.0.1/packages/eslint-plugin/configs/customize.ts#L153
83+ */
84+ '@stylistic/jsx-quotes' : [ 'error' , 'prefer-single' ] ,
85+
86+ /**
87+ * allow cases:
88+ *
89+ * ```jsx
90+ * List elements as render hierarchy. <br />
91+ *
92+ * #{index() + 1}
93+ *
94+ * <span>({position().top.toFixed(0)}, {position().left.toFixed(0)})</span>
95+ *
96+ * <span>‎{props.item.subtitle || '—'}‎</span>
97+ * ```
98+ *
99+ * - https://eslint.style/rules/default/jsx-one-expression-per-line
100+ * - https://github.com/eslint-stylistic/eslint-stylistic/blob/v3.0.1/packages/eslint-plugin/configs/customize.ts#L152
101+ */
102+ 'style/jsx-one-expression-per-line' : [ 'off' ] ,
103+
104+
105+ /**
106+ * allow cases:
107+ * ```ts
108+ * { element1, element2, element3 }
109+ *
110+ * {
111+ * element1,
112+ * element2,
113+ * element3,
114+ * element4,
115+ * }
116+ * ```
117+ * https://eslint.style/rules/default/object-curly-newline
118+ */
119+ 'style/object-curly-newline' : [
120+ 'error' ,
121+ {
122+ ObjectExpression : {
123+ minProperties : 4 ,
124+ multiline : true ,
125+ consistent : true ,
126+ } ,
127+ ObjectPattern : {
128+ minProperties : 4 ,
129+ multiline : true ,
130+ consistent : true ,
131+ } ,
132+ ImportDeclaration : {
133+ minProperties : 4 ,
134+ multiline : true ,
135+ consistent : true ,
136+ } ,
137+ ExportDeclaration : {
138+ minProperties : 4 ,
139+ multiline : true ,
140+ consistent : true ,
141+ } ,
142+ } ,
143+ ] ,
144+
145+ /**
146+ * https://eslint.style/rules/default/indent
147+ */
148+ 'style/indent' : [ 'error' , 2 , {
149+ ArrayExpression : 1 ,
150+ CallExpression : { arguments : 1 } ,
151+ flatTernaryExpressions : false ,
152+ FunctionDeclaration : { body : 1 , parameters : 1 } ,
153+ FunctionExpression : { body : 1 , parameters : 1 } ,
154+ ignoreComments : false ,
155+ ImportDeclaration : 1 ,
156+ MemberExpression : 1 ,
157+ ObjectExpression : 1 ,
158+ outerIIFEBody : 1 ,
159+ SwitchCase : 1 ,
160+ tabLength : 2 ,
161+ VariableDeclarator : 1 ,
162+
163+ offsetTernaryExpressions : false ,
164+ ignoredNodes : [
165+ 'TSUnionType' ,
166+ 'TSIntersectionType' ,
167+ 'TSTypeParameterInstantiation' ,
168+ 'PropertyDefinition[decorators]' ,
169+ 'FunctionExpression > .params[decorators.length > 0]' ,
170+ ] ,
171+ } ] ,
172+
173+ /**
174+ * https://eslint.style/rules/default/quotes
175+ */
176+ 'style/quotes' : [
177+ 'error' ,
178+ 'single' ,
179+ {
180+ avoidEscape : true ,
181+ allowTemplateLiterals : true ,
182+ } ,
183+ ] ,
184+
185+ /**
186+ * https://eslint.style/rules/default/quote-props
187+ */
188+ 'style/quote-props' : [ 'error' , 'as-needed' ] ,
189+
190+ /**
191+ * https://eslint.style/rules/default/arrow-parens
192+ */
193+ 'style/arrow-parens' : [ 'off' ] ,
194+
195+ /**
196+ * allow cases:
197+ *
198+ * ```ts
199+ * (next, middleware) => (
200+ * () => { middleware(req, res, next) }
201+ * )
202+ * ```
203+ *
204+ * and avoid too many edge cases with incorrect auto fix
205+ * - https://eslint.style/rules/default/no-extra-parens
206+ */
207+ 'style/no-extra-parens' : [ 'off' ] ,
208+
209+ /**
210+ * allow cases:
211+ *
212+ * ```ts
213+ * class={`absolute top-0 right-0 z-10 cursor-nesw-resize`}
214+ * ```
215+ *
216+ * and avoid too many edge cases with incorrect auto fix
217+ * - https://eslint.style/rules/jsx/jsx-curly-brace-presence
218+ */
219+ 'style/jsx-curly-brace-presence' : [ 'off' ] ,
220+
221+ /**
222+ * and avoid too many edge cases with incorrect auto fix
223+ * - https://eslint.style/rules/jsx/jsx-curly-newline
224+ */
225+ 'style/jsx-curly-newline' : [ 'error' , {
226+ multiline : 'consistent' ,
227+ singleline : 'consistent' ,
228+ } ] ,
229+
230+ /**
231+ * use both
232+ * ```ts
233+ * import type { Meta, StoryFn } from '@storybook/react'
234+ * import Foo, { type Bar, OOT } from 'Foo'
235+ * ```
236+ *
237+ * - https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/consistent-type-specifier-style.md
238+ * - https://github.com/antfu/eslint-config/blob/v4.1.1/src/configs/imports.ts#L22
239+ */
240+ 'import/consistent-type-specifier-style' : [ 'off' ] ,
241+
242+ /**
243+ * - https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
244+ * - https://github.com/antfu/eslint-config/blob/v4.1.1/src/configs/imports.ts#L24
245+ */
246+ 'import-x/no-duplicates' : [ 'error' , {
247+ considerQueryString : true ,
248+ 'prefer-inline' : true ,
249+ } ] ,
250+
251+ 'perfectionist/sort-exports' : [ 'off' , { order : 'asc' , type : 'natural' } ] ,
252+ /**
253+ * https://perfectionist.dev/rules/sort-imports
254+ */
255+ 'perfectionist/sort-imports' : [ 'off' , {
256+ order : 'asc' ,
257+ type : 'natural' ,
258+ newlinesBetween : 'ignore' ,
259+ internalPattern : [
260+ '^~/.*$' ,
261+ '^src(/.*)?$' ,
262+ '^#.*$' ,
263+ '^@stories/.*$' ,
264+ ] ,
265+ // customGroups: {},
266+ groups : [
267+ 'unknown' ,
268+ 'builtin' ,
269+ 'external' ,
270+ 'internal' ,
271+ 'parent' ,
272+ 'sibling' ,
273+ 'index' ,
274+ 'style' ,
275+ 'side-effect' ,
276+ 'side-effect-style' ,
277+ 'object' ,
278+ ] ,
279+ } ] ,
280+ 'perfectionist/sort-named-exports' : [ 'off' , { order : 'asc' , type : 'natural' } ] ,
281+ 'perfectionist/sort-named-imports' : [ 'off' , { order : 'asc' , type : 'natural' } ] ,
282+
283+ /**
284+ * https://github.com/antfu/eslint-plugin-antfu/blob/v3.0.0/src/rules/top-level-function.md
285+ * https://github.com/antfu/eslint-config/blob/v4.1.1/src/configs/stylistic.ts#L63
286+ */
287+ 'antfu/top-level-function' : [ 'off' ] ,
72288 } ,
73289 } ,
74290)
@@ -85,7 +301,8 @@ export default antfu(
85301 */
86302 . remove ( 'antfu/javascript/rules' )
87303 /**
88- * https://github.com/antfu/eslint-plugin-antfu/blob/v3.0.0/src/rules/top-level-function.md
89- * https://github.com/antfu/eslint-config/blob/v4.1.1/src/configs/stylistic.ts#L63
304+ * disable correctness check, only use stylistic rules
305+ *
306+ * https://github.com/antfu/eslint-config/blob/v4.1.1/src/configs/node.ts#L8
90307 */
91- . removeRules ( 'antfu/top-level-function ' )
308+ . remove ( 'antfu/node/rules ' )
0 commit comments