diff --git a/README.md b/README.md index 182c330..273b6fb 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,8 @@ export default [ ...vueTsEslintConfig({ // Optional: extend additional configurations from `typescript-eslint`. - // Supports all the configurations in https://typescript-eslint.io/users/configs#recommended-configurations + // Supports all the configurations in + // https://typescript-eslint.io/users/configs#recommended-configurations extends: [ // By default, only the recommended rules are enabled. "recommended", diff --git a/package.json b/package.json index e5e2180..f1b75d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vue/eslint-config-typescript", - "version": "14.1.0", + "version": "14.1.1", "description": "ESLint config for TypeScript + Vue.js projects", "main": "./dist/index.mjs", "type": "module", diff --git a/src/index.ts b/src/index.ts index 812037d..c8d887e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,7 +51,10 @@ export default function createConfig({ files: ['**/*.js', '**/*.jsx'], ...tseslint.configs.disableTypeChecked, }, - { + ] + + if (otherVueFiles.length > 0) { + projectServiceConfigs.push({ name: 'vue-typescript/skip-type-checking-for-vue-files-without-ts', files: otherVueFiles, ...tseslint.configs.disableTypeChecked, @@ -63,9 +66,9 @@ export default function createConfig({ // https://github.com/typescript-eslint/typescript-eslint/issues/4755#issuecomment-1080961338 '@typescript-eslint/consistent-type-imports': 'off', '@typescript-eslint/prefer-optional-chain': 'off', - } - }, - ] + }, + }) + } const mayHaveJsxInSfc = supportedScriptLangs.jsx || supportedScriptLangs.tsx const needsTypeAwareLinting = configNamesToExtend.some( @@ -87,18 +90,20 @@ export default function createConfig({ }, }) - projectServiceConfigs.push({ - name: 'vue-typescript/default-project-service-for-vue-files', - files: vueFilesWithScriptTs, - languageOptions: { - parser: vueParser, - parserOptions: { - projectService: true, - parser: tseslint.parser, - extraFileExtensions, + if (vueFilesWithScriptTs.length > 0) { + projectServiceConfigs.push({ + name: 'vue-typescript/default-project-service-for-vue-files', + files: vueFilesWithScriptTs, + languageOptions: { + parser: vueParser, + parserOptions: { + projectService: true, + parser: tseslint.parser, + extraFileExtensions, + }, }, - }, - }) + }) + } // Vue's own typing inevitably contains some `any`s, so some of the `no-unsafe-*` rules can't be used. projectServiceConfigs.push({
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: