mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
eslint: update rules for jsx
This commit is contained in:
2 files changed
+57
-30
No files matched your search
+46
-6
@@ -121,12 +121,52 @@ const config = react({
|
|||||||
// FIXME A bug with eslint-parser
|
// FIXME A bug with eslint-parser
|
||||||
// 'template-curly-spacing': 'off',
|
// 'template-curly-spacing': 'off',
|
||||||
|
|
||||||
'style/indent': [
|
'style/indent': ['warn', 2, {
|
||||||
'warn',
|
ArrayExpression: 1,
|
||||||
2,
|
CallExpression: {
|
||||||
{ SwitchCase: 1 },
|
arguments: 1,
|
||||||
],
|
},
|
||||||
'style/indent-binary-ops': ['warn', 2],
|
flatTernaryExpressions: false,
|
||||||
|
FunctionDeclaration: {
|
||||||
|
body: 1,
|
||||||
|
parameters: 1,
|
||||||
|
},
|
||||||
|
FunctionExpression: {
|
||||||
|
body: 1,
|
||||||
|
parameters: 1,
|
||||||
|
},
|
||||||
|
ignoreComments: false,
|
||||||
|
ignoredNodes: [
|
||||||
|
'TSUnionType',
|
||||||
|
'TSIntersectionType',
|
||||||
|
'TSTypeParameterInstantiation',
|
||||||
|
'FunctionExpression > .params[decorators.length > 0]',
|
||||||
|
'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
|
||||||
|
'JSXElement',
|
||||||
|
'JSXElement > *',
|
||||||
|
'JSXAttribute',
|
||||||
|
'JSXIdentifier',
|
||||||
|
'JSXNamespacedName',
|
||||||
|
'JSXMemberExpression',
|
||||||
|
'JSXSpreadAttribute',
|
||||||
|
'JSXExpressionContainer',
|
||||||
|
'JSXOpeningElement',
|
||||||
|
'JSXClosingElement',
|
||||||
|
'JSXFragment',
|
||||||
|
'JSXOpeningFragment',
|
||||||
|
'JSXClosingFragment',
|
||||||
|
'JSXText',
|
||||||
|
'JSXEmptyExpression',
|
||||||
|
'JSXSpreadChild',
|
||||||
|
],
|
||||||
|
ImportDeclaration: 1,
|
||||||
|
ObjectExpression: 1,
|
||||||
|
outerIIFEBody: 1,
|
||||||
|
SwitchCase: 1,
|
||||||
|
VariableDeclarator: 1,
|
||||||
|
}],
|
||||||
|
'style/jsx-indent-props': 'off',
|
||||||
|
'style/indent-binary-ops': 'off',
|
||||||
'function-paren-newline': 'off',
|
'function-paren-newline': 'off',
|
||||||
'no-mixed-operators': 'off',
|
'no-mixed-operators': 'off',
|
||||||
'no-await-in-loop': 'off',
|
'no-await-in-loop': 'off',
|
||||||
|
|||||||
@@ -182,37 +182,24 @@ const base = (option, ...args) => antfu(
|
|||||||
arguments: 1,
|
arguments: 1,
|
||||||
},
|
},
|
||||||
flatTernaryExpressions: false,
|
flatTernaryExpressions: false,
|
||||||
FunctionDeclaration: {
|
FunctionDeclaration: { body: 1, parameters: 1, returnType: 1 },
|
||||||
body: 1,
|
FunctionExpression: { body: 1, parameters: 1, returnType: 1 },
|
||||||
parameters: 1,
|
|
||||||
},
|
|
||||||
FunctionExpression: {
|
|
||||||
body: 1,
|
|
||||||
parameters: 1,
|
|
||||||
},
|
|
||||||
ignoreComments: false,
|
ignoreComments: false,
|
||||||
ignoredNodes: [
|
ignoredNodes: [
|
||||||
// 'JSXElement',
|
'TSUnionType',
|
||||||
// 'JSXElement > *',
|
'TSIntersectionType',
|
||||||
// 'JSXAttribute',
|
'TSTypeParameterInstantiation',
|
||||||
// 'JSXIdentifier',
|
'FunctionExpression > .params[decorators.length > 0]',
|
||||||
// 'JSXNamespacedName',
|
'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
|
||||||
// 'JSXMemberExpression',
|
'Punctuator',
|
||||||
// 'JSXSpreadAttribute',
|
|
||||||
// 'JSXExpressionContainer',
|
|
||||||
// 'JSXOpeningElement',
|
|
||||||
// 'JSXClosingElement',
|
|
||||||
// 'JSXFragment',
|
|
||||||
// 'JSXOpeningFragment',
|
|
||||||
// 'JSXClosingFragment',
|
|
||||||
'JSXText',
|
|
||||||
// 'JSXEmptyExpression',
|
|
||||||
// 'JSXSpreadChild',
|
|
||||||
],
|
],
|
||||||
ImportDeclaration: 1,
|
ImportDeclaration: 1,
|
||||||
|
// MemberExpression: 1,
|
||||||
ObjectExpression: 1,
|
ObjectExpression: 1,
|
||||||
|
// offsetTernaryExpressions: true,
|
||||||
outerIIFEBody: 1,
|
outerIIFEBody: 1,
|
||||||
SwitchCase: 1,
|
SwitchCase: 1,
|
||||||
|
// tabLength: option.stylistic?.indent ?? 4,
|
||||||
VariableDeclarator: 1,
|
VariableDeclarator: 1,
|
||||||
}],
|
}],
|
||||||
'style/jsx-closing-bracket-location': 'off',
|
'style/jsx-closing-bracket-location': 'off',
|
||||||
|
|||||||
Reference in new issue
Block a user