Skip to content

Rule Proposal: no-unused-components - add a option to make rule case sensitive  #1413

@kassuro

Description

@kassuro

What rule do you want to change?
vue/no-unused-components

Does this change cause the rule to produce more or fewer warnings?
It should produce more warnings / errors

How will the change be implemented? (New option, new default behavior, etc.)?
A new option could be provided which makes the rule case sensitive for the name of components.

Please provide some example code that this change will affect:

<template>
  <div>
      <SuperComponent />
  </div>
</template>
<script>
import superComponent from './superComponent.vue';

export default {
  components: {
    superComponent
  },
};
</script>

What does the rule currently do for this code?
Nothing, the rule doesn't detect the mismatch in the casing of the name in components and the use in the template.

What will the rule do after it's changed?
After the rule is extended with a option to make the check case sensitive the rule will report a warning / error that superComponent is not used in the template.

Additional context
We had mixed casings / conventions in our project for component names and decided we want all of them to be PascalCase. After changing the eslint rules eslint made an auto-fix for most components in templates, but not in the registration it seems. But this was undetected from any rule. I would have expected that no-unused-components would have detected this as the casing is not matching.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions