Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule Proposal: vue/no-restricted-component-names #2182

Closed
qmhc opened this issue May 17, 2023 · 2 comments · Fixed by #2210
Closed

Rule Proposal: vue/no-restricted-component-names #2182

qmhc opened this issue May 17, 2023 · 2 comments · Fixed by #2210

Comments

@qmhc
Copy link
Contributor

qmhc commented May 17, 2023

Please describe what the rule should do:

Restrict some component names via a list of pattern.

What category should the rule belong to?

[ ] Enforces code style (layout)
[x] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

Options:

{
  "vue/no-restricted-component-names": ["error", "Foo", "/^Baz(One|Two)/"]
}
<script>
<!--BAD -->
export default {
  name: 'Foo'
}

<!--BAD -->
export default {
  name: 'BazTwo'
}

<!--GOOD-->
export default {
  name: 'Allow'
}
</script>

Additional context

Related #2180 (comment).

@ItMaga
Copy link
Contributor

ItMaga commented May 31, 2023

I think there can be cases when we need more detailed options, for example, when the team has some convention for suggestions or a custom error message. What do you think about this?

As a variant:

string[]
// or
{
  pattern: "string or regex",
  suggestion: "string", // optional
  message: "string" // optional
 }

@FloEdelmann
Copy link
Member

I'm also fine with those options. However, if someone wants to implement this, adding only the string (or pattern) options is also sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants