vuejs / vue-eslint-parser

The ESLint custom parser for `.vue` files.
MIT License
443 stars 74 forks source link

Enhanced parser options #203

Closed lyswhut closed 1 year ago

lyswhut commented 1 year ago

Is it possible to enhance the parser options? Examples like the following are supported:

module.exports = {
  // ...
  overrides: [
    {
      files: ['*.vue'],
      parser: 'vue-eslint-parser',
      rules: [
        // ... The rules here are only applied to vue files.
      ],
      extends: [ // The extends here are only applied to vue files.
        'plugin:vue/base',
        'plugin:vue/vue3-recommended',
      ],
      parserOptions: {
        // ...
        parser: {
          // Script parser for `<script>`
          js: { // The config here are only applied to js code.
            parser: '@babel/eslint-parser',
            extends: [  // The extends here are only applied to js code.
              'standard',
            ],
            rules: [
              // ... The rules here are only applied to js code.
            ],
            project: './jsconfig.json',
          },

          // Script parser for `<script lang="ts">`
          ts: {  // The config here are only applied to ts code.
            parser: '@typescript-eslint/parser',
            extends: [  // The extends here are only applied to ts code.
              'standard-with-typescript',
            ],
            rules: [
              // ... The rules here are only applied to ts code.
            ],
            project: './tsconfig.json',
          },
        },
        extraFileExtensions: ['.vue'],
      },
    },
  ],
}
ota-meshi commented 1 year ago

That configuration is not possible. The configuration must be one that ESLint itself understands.