lint update

This commit is contained in:
Stephen Zhou 2025-12-26 10:11:08 +08:00
parent 3736e2d91e
commit c6d367a76f
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -310,11 +310,15 @@ export default {
fixes.push(fixer.insertTextBefore(firstProp, `ns: '${ns}', `))
}
}
else if (hasSecondArg && secondArg.type === 'Literal' && typeof secondArg.value === 'string') {
// Second arg is a string (default value): 'default' -> { ns: 'xxx', defaultValue: 'default' }
fixes.push(fixer.replaceText(secondArg, `{ ns: '${ns}', defaultValue: ${sourceCode.getText(secondArg)} }`))
}
else if (!hasSecondArg) {
// No second argument, add new object
fixes.push(fixer.insertTextAfter(originalFirstArg, `, { ns: '${ns}' }`))
}
// If second arg exists but is not an object, skip (can't safely add ns)
// If second arg exists but is not an object or string, skip (can't safely add ns)
}
if (firstArg.type === 'Literal' && typeof firstArg.value === 'string') {