Skip to content

The template root requires exactly one element #1439

Closed
@alexcroox

Description

@alexcroox

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 7.19.0
  • eslint-plugin-nuxt version: 2.0.0 ("eslint-plugin-vue": "^7.5.0")
  • Node version: v12.16.1
  • Operating System: Mac OS 10.15.7

Please show your full configuration:

module.exports = {
  root: true,

  env: {
    browser: true,
    node: true
  },

  parserOptions: {
    parser: 'babel-eslint'
  },

  extends: [
    '@nuxtjs',
    'prettier',
    'prettier/vue',
    'plugin:prettier/recommended',
    'plugin:nuxt/recommended',
    'plugin:vue-a11y/base',
    'plugin:cypress/recommended',
    'plugin:@intlify/vue-i18n/recommended'
  ],

  plugins: ['prettier', '@intlify/vue-i18n', 'vue-a11y', 'cypress'],

  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    // https://eslint.org/docs/rules/padding-line-between-statements
    'padding-line-between-statements': [
      'error',
      { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
      { blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
      { blankLine: 'always', prev: ['case', 'default'], next: '*' },
      { blankLine: 'always', prev: 'directive', next: '*' },
      { blankLine: 'always', prev: 'function', next: '*' },
      { blankLine: 'always', prev: '*', next: 'function' },
      { blankLine: 'always', prev: 'if', next: '*' },
      { blankLine: 'always', prev: '*', next: 'if' },
      { blankLine: 'any', prev: 'directive', next: 'directive' }
    ],
    'lines-between-class-members': ['error', 'always'],
    'prefer-template': 'error',
    'vue/prop-name-casing': ['error', 'camelCase'],
    'vue/attribute-hyphenation': 'off',
    'vue/component-name-in-template-casing': [
      'error',
      'PascalCase',
      { registeredComponentsOnly: false, ignores: ['/^component/', '/^client-only/'] }
    ],
    'vue/new-line-between-multi-line-property': [
      'error',
      {
        minLineOfMultilineProperty: 2
      }
    ],
    'vue/require-name-property': 'error',
    'vue/object-curly-spacing': ['error', 'always'],
    'vue/padding-line-between-blocks': ['error', 'always'],

    'nuxt/no-cjs-in-config': 'off',
    'nuxt/require-func-head': ['error'],

    'import/no-mutable-exports': 'off',

    // https://eslint-plugin-vue-i18n.intlify.dev/rules/#recommended
    '@intlify/vue-i18n/no-html-messages': ['error'],
    '@intlify/vue-i18n/no-missing-keys': ['error'],
    '@intlify/vue-i18n/no-raw-text': 'off',
    '@intlify/vue-i18n/no-v-html': 'error',
    '@intlify/vue-i18n/key-format-style': ['error', 'camelCase'],
    '@intlify/vue-i18n/no-duplicate-keys-in-locale': [
      'error',
      {
        ignoreI18nBlock: false
      }
    ],
    '@intlify/vue-i18n/no-dynamic-keys': 'error',
    '@intlify/vue-i18n/no-unused-keys': [
      'off',
      {
        extensions: ['.js', '.vue']
      }
    ],

    'vue-a11y/label-has-for': 'off',
    'vue-a11y/form-has-label': 'off',
    'vue-a11y/no-onchange': 'off',
    'vue-a11y/click-events-have-key-events': 'off'
  },

  overrides: [
    {
      // https://stackoverflow.com/a/50101673/241465
      files: ['*.spec.js'],
      rules: {
        'no-unused-expressions': 'off'
      }
    }
  ],

  settings: {
    'vue-i18n': {
      localeDir: 'locales/*.json'
    }
  },

  ignorePatterns: ['ios/*', 'android/*']
}

What did you do?

<template>
  <Link :to="to" class="flex items-center">
    <span v-if="prefixIcon || $slots.prefix" class="mr-1">
      <slot name="prefix">
        <FontAwesomeIcon v-if="prefixIcon" :icon="prefixIcon" fixedWidth />
      </slot>
    </span>

    <slot />
  </Link>
</template>

What did you expect to happen?
No errors

What actually happened?
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions