1
0

feat: 前端集成 Prettier 代码格式化

This commit is contained in:
2026-04-24 13:40:53 +08:00
parent 52007c9461
commit 365943e4c4
61 changed files with 1968 additions and 1698 deletions

View File

@@ -10,4 +10,4 @@ const plugin = {
},
}
export default plugin
export default plugin

View File

@@ -42,10 +42,7 @@ function isHardcodedColor(value) {
function extractStyleProperties(expression) {
const properties = []
if (
expression.type === 'ObjectExpression' &&
expression.properties
) {
if (expression.type === 'ObjectExpression' && expression.properties) {
for (const styleProp of expression.properties) {
if (
styleProp.type === 'Property' &&
@@ -92,9 +89,7 @@ export default ESLintUtils.RuleCreator((name) => {
node.value?.type === 'JSXExpressionContainer' &&
node.value.expression
) {
const styleProps = extractStyleProperties(
node.value.expression,
)
const styleProps = extractStyleProperties(node.value.expression)
for (const prop of styleProps) {
if (isHardcodedColor(prop.value)) {
@@ -109,4 +104,4 @@ export default ESLintUtils.RuleCreator((name) => {
},
}
},
})
})