Skip to content

Huge performance increase with '<template>': 'espree' #127

Closed
@freakzlike

Description

@freakzlike

I was struggling to upgrade ESLint to v9 for a large project, because of massive performance difference with type aware linting.

I've tested the performance only on a sub directory of the project containing only ts and vue lang="ts" files with the following results:

ESLint v8
real    0m42.312s
user    1m10.596s
sys     0m5.044s

ESLint v9
real    1m26.031s
user    1m51.048s
sys     0m5.195s

ESLint v9 after config adjustments
real    0m31.473s
user    0m51.516s
sys     0m3.925s

The biggest performance difference is setting '<template>': 'espree' which made my linting more than 2.5x faster. I'm not sure if these changes break anything, especially as I don't have any vue files with js.

That's my simplified config with the adjustments:

import pluginVue from 'eslint-plugin-vue'
import vueTsEslintConfig from '@vue/eslint-config-typescript'
import * as tseslint from 'typescript-eslint'

export default [
  ...pluginVue.configs['flat/recommended'],
  ...vueTsEslintConfig({
    extends: ['recommendedTypeChecked'],
    // Lead to not existing directory to disable specific settings
    rootDir: './does-not-exist'
  }),
  {
    name: 'vue-typescript/setup',
    files: ['*.vue', '**/*.vue'],
    languageOptions: {
      parserOptions: {
        project: ['**/tsconfig.json', '**/tsconfig.*.json'],
        parser: {
          // Using espree results in "`parseForESLint` from parser `context.languageOptions.parser` is invalid and will just be ignored"
          js: tseslint.parser,
          jsx: tseslint.parser,

          '<template>': 'espree'
        }
      }
    }
  }
]

Perhaps someone can test these changes in their project if there are any problems or other adjustments needed.


Draft PR (#126) with changes in @vue/eslint-config-typescript

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions