How to disable vue/multi-word-component-names eslint rule for just one .vue file?

16,394

Solution 1

In your case, you can replace

'vue/multi-word-component-names': 'off'

with:

'vue/multi-word-component-names': ['error', {
  'ignores': ['default']
}]

this will set the rule to 'allow' for all files named 'default'

you can read more about it here: https://eslint.vuejs.org/rules/multi-word-component-names.html

Solution 2

rules: { 'vue/multi-word-component-names': 0 } try this way

Share:
16,394

Related videos on Youtube

Carson Wood
Author by

Carson Wood

Updated on June 04, 2022

Comments

  • Carson Wood
    Carson Wood almost 2 years

    I am using the Vue ESLint plugin and it has a rule for not allowing single word component names.

    However, I am also using Nuxt, and to set a default Layout in Nuxt you need a .vue component named default.vue which throws the ES Lint rule errors.

    I can't seem to get it to just disable in that one .vue file that is actually pretty small...

    <template>
        <div>
            <Header/>
            <Nuxt/>
        </div>
    </template>
    

    But if I disable the rule in my .eslintrc.js then it works.

    module.exports = {
      root: true,
      env: {
        browser: true,
        node: true,
      },
      extends: [
        '@nuxtjs/eslint-config-typescript',
        'plugin:nuxt/recommended',
        'prettier',
      ],
      plugins: [],
      // add your custom rules here
      rules: {
        'vue/multi-word-component-names': 'off',
      },
    }
    
    

    Is there a way to disable the rule for just one Vue file?

  • Jeremy Caney
    Jeremy Caney about 2 years
    Isn't this functionally equivalent to the existing answer?
  • HJW
    HJW about 2 years
    @JeremyCaney Same as which one? It's 0 not off
  • Titus Sutio Fanpula
    Titus Sutio Fanpula about 2 years
    Thanks, it's working.
  • Titus Sutio Fanpula
    Titus Sutio Fanpula about 2 years
    This working for me. Thanks