Skip to content

Add good/bad example of script setup to rule doc multi-word-component-names #1867

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

Closed
zjfresh opened this issue Apr 24, 2022 · 3 comments · Fixed by #1871
Closed

Add good/bad example of script setup to rule doc multi-word-component-names #1867

zjfresh opened this issue Apr 24, 2022 · 3 comments · Fixed by #1871

Comments

@zjfresh
Copy link
Contributor

zjfresh commented Apr 24, 2022

Tell us about your environment

  • ESLint version: 6.7.2
  • eslint-plugin-vue version: 8.7.0
  • Node version:

The problem you want to solve.
It's in a puzzle about this rule reporting an error (Component name "index" should always be multi-word.) about a .vue named views/data/Report/index.vue using script setup, the same code with the offical site, like:

<script setup>
import { ref, onMounted } from 'vue'

// reactive state
const count = ref(0)

// functions that mutate state and trigger updates
function increment() {
  count.value++
}

// lifecycle hooks
onMounted(() => {
  console.log(`The initial count is ${count.value}.`)
})
</script>

<template>
  <button @click="increment">Count is: {{ count }}</button>
</template>

Your take on the correct solution to problem.

<!-- filename: Todo.vue -->
/* ✗ BAD */
<script setup>
  // ...
</script>
<!-- filename: TodoItem.vue -->
/* ✓ GOOD */
<script setup>
  // ...
</script>
<!-- filename: Todo.vue -->
/* ✓ GOOD */
<script setup>
  // ...
</script>
<script>
export default {
  name: 'TodoItem'
}
</script>

Additional context

@zjfresh zjfresh changed the title Add good & bad example of script setup to rule doc multi-word-component-names Add good/bad example of script setup to rule doc multi-word-component-names Apr 24, 2022
@zjfresh
Copy link
Contributor Author

zjfresh commented Apr 24, 2022

Also look issue #1779 , allow disabling file name checking for file like src/products/Show.vue

@zjfresh
Copy link
Contributor Author

zjfresh commented Apr 24, 2022

I can commit a PR if necessary :)

@FloEdelmann
Copy link
Member

FloEdelmann commented Apr 26, 2022

Thanks for the report, I'll be happy to accept a pull request with that clarification!

zjfresh added a commit to zjfresh/eslint-plugin-vue that referenced this issue Apr 26, 2022
zjfresh added a commit to zjfresh/eslint-plugin-vue that referenced this issue Apr 26, 2022
@FloEdelmann FloEdelmann linked a pull request Apr 26, 2022 that will close this issue
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