You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If the component name is PascalCase or camelCase// it can be used in various of ways inside template,// like "theComponent", "The-component" etc.// but except snake_caseif(casing.isPascalCase(name)||casing.isCamelCase(name)){return![...usedComponents].some((n)=>{return(n.indexOf('_')===-1&&(name===casing.pascalCase(n)||casing.camelCase(n)===name))})}else{// In any other case the used component name must exactly match// the registered namereturn!usedComponents.has(name)}
gets auto-fixed by unicorn/prefer-ternary to:
// If the component name is PascalCase or camelCase// it can be used in various of ways inside template,// like "theComponent", "The-component" etc.// but except snake_casereturncasing.isPascalCase(name)||casing.isCamelCase(name) ? ![...usedComponents].some((n)=>{return(n.indexOf('_')===-1&&(name===casing.pascalCase(n)||casing.camelCase(n)===name))}) : !usedComponents.has(name);
So the comment in the else branch is lost. I suggest to either disable the auto-fix in this case, or don't report this at all (since a comment indicates more complicated code where a ternary likely decreases readability).
This code:
gets auto-fixed by
unicorn/prefer-ternary
to:So the comment in the
else
branch is lost. I suggest to either disable the auto-fix in this case, or don't report this at all (since a comment indicates more complicated code where a ternary likely decreases readability).Repo where this can be reproduced: https://github.com/vuejs/eslint-plugin-vue/blob/a473a0d543655addf28b8bbc3c1e1393e2b30854/lib/rules/no-unused-components.js#L111-L127
The text was updated successfully, but these errors were encountered: