antfu / eslint-config

Anthony's ESLint config preset
https://eslint-config.antfu.me/
MIT License
4.05k stars 447 forks source link

espree template for vue parser #294

Closed GaborTorma closed 2 months ago

GaborTorma commented 1 year ago

Clear and concise description of the problem

Performance drop when we use Type Aware Rules.

Suggested solution

10 times faster with espree template.

https://github.com/vuejs/vue-eslint-parser#parseroptionsparser

Add "espree" template for vue parser.

      languageOptions: {
        parser: parserVue,
        parserOptions: {
          ecmaFeatures: {
            jsx: true,
          },
          extraFileExtensions: ['.vue'],
          parser: {
            '<template>': 'espree',
            'js': parserTs as any,
            'ts': options.typescript ? parserTs as any : null,
          },
          sourceType: 'module',
        },
      },

I tried to create a PR, but I got a ts error: src/configs/vue.ts(33,11): error TS2322: Type '{ '<template>': string; js: typeof parserTs; ts: any; }' is not assignable to type 'Parser | undefined'.

Validations

antfu commented 1 year ago

Sure, PR welcome :)

antfu commented 2 months ago

https://github.com/antfu/eslint-config/pull/296#issuecomment-2312203148