eslint icon indicating copy to clipboard operation
eslint copied to clipboard

please provide an example `.eslintrc.js` in README

Open nopeless opened this issue 11 months ago • 1 comments

https://github.com/vuejs/eslint-plugin-vue/issues/2434

https://github.com/nuxt-modules/eslint/issues/114

https://github.com/nuxt-modules/eslint/issues/92

I think it's best if we put examples for javascript and typescript setup

nopeless avatar Mar 22 '24 13:03 nopeless

May not be the place to mention, but I know that @antfu/eslint-config is a fairly popular configuration to use, and that uses the "flat config" of ESLint. And example eslint.config.js would be:

import antfu from '@antfu/eslint-config';

export default antfu(
  {
    vue: true,
    formatters: {
      css: true,
      html: true,
      graphql: false,
      markdown: false,
    },
    stylistic: {
      indent: 2,
      quotes: 'single',
      semi: true,
    },
    rules: {
      'prefer-arrow-callback': [
        'error',
        { allowNamedFunctions: true },
      ],
      'arrow-body-style': [
        'error',
        'as-needed',
        { requireReturnForObjectLiteral: false },
      ],
      'func-style': [
        'error',
        'declaration',
        { allowArrowFunctions: true },
      ],
      'vue/attribute-hyphenation': [
        'error',
        'always',
      ],
      'vue/mustache-interpolation-spacing': [
        'error',
        'always',
      ],
      'vue/no-spaces-around-equal-signs-in-attribute': ['error'],
      'vue/max-attributes-per-line': [
        'error',
        {
          singleline: {
            max: 2,
          },
          multiline: {
            max: 1,
          },
        },
      ],
      'vue/v-on-event-hyphenation': [
        'error',
        'always',
        {
          autofix: true,
          ignore: [],
        },
      ],
    },
  },
);

I don't know if the flat config will be the defacto way of configuring ESLint, but this could a start to this issue.

And I guess in this case, would it also be good to show how people could use existing ESLint configurations with this module? Again, maybe this is not the place to ask this.

alecStewart1 avatar Jun 19 '24 14:06 alecStewart1