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

Add suggestion(s) to vue/match-component-file-name #1816

Closed
FloEdelmann opened this issue Mar 16, 2022 · 1 comment · Fixed by #1874
Closed

Add suggestion(s) to vue/match-component-file-name #1816

FloEdelmann opened this issue Mar 16, 2022 · 1 comment · Fixed by #1874

Comments

@FloEdelmann
Copy link
Member

FloEdelmann commented Mar 16, 2022

What rule do you want to change?
vue/match-component-file-name

Does this change cause the rule to produce more or fewer warnings?
Same.

How will the change be implemented? (New option, new default behavior, etc.)?
New suggestions that can be applied by the user via the editor:

  • "Rename component to match file name." (without file extension)
  • "Rename file to match component name." (not sure if ESLint suggestions can rename files though)

Note that we can't add an auto-fix here because the user intent is not clear.

Please provide some example code that this change will affect:

// file name: "MySuperCoolComponent.vue"
export default {
  name: 'MyAwesomeComponent',
}

What does the rule currently do for this code?
Report, but no auto-fix and no suggestions.

What will the rule do after it's changed?
Report, still no auto-fix, but suggestions.

  • Rename component to match file name.
    // file name: "MySuperCoolComponent.vue"
    export default {
      name: 'MySuperCoolComponent',
    }
  • Rename file to match component name.
    // file name: "MyAwesomeComponent.vue"
    export default {
      name: 'MyAwesomeComponent',
    }
@ota-meshi
Copy link
Member

I think it's a good idea to add suggestions 👍

not sure if ESLint suggestions can rename files though

As far as I know, we can't rename files with the ESLint API 😅

mahaker pushed a commit to mahaker/eslint-plugin-vue that referenced this issue Apr 29, 2022
improve vuejs#1816

For the following reasons why name option changed.
If change file name, alto need to change import statement.
mahaker pushed a commit to mahaker/eslint-plugin-vue that referenced this issue May 1, 2022
improve vuejs#1816

For the following reasons why name option changed.
If change file name, alto need to change import statement.

Also, this rule not auto-fixed, because the file name may be incorrect.
mahaker pushed a commit to mahaker/eslint-plugin-vue that referenced this issue May 4, 2022
improve vuejs#1816

For the following reasons why name option changed.
If change file name, alto need to change import statement.

Also, this rule not auto-fixed, because the file name may be incorrect.
ota-meshi pushed a commit that referenced this issue May 9, 2022
* Add typing 'Literal#raw' property

vue-eslint-parser's ESLintLiteralBase Node has 'raw' property.
ref: https://github.com/vuejs/vue-eslint-parser/blob/160f4efc4eaf363662b464a4a26a4c9e514deb5d/src/ast/nodes.ts#L395

It was necessary to identify quotes in the match-component-file-name's fixer.

* feat: add suggestion match-component-file-name rule

improve #1816

For the following reasons why name option changed.
If change file name, alto need to change import statement.

Also, this rule not auto-fixed, because the file name may be incorrect.
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.

2 participants