@vue/eslint-config-typescript
Advanced tools
Comparing version 10.0.0 to 11.0.0
29
index.js
module.exports = { | ||
plugins: ['@typescript-eslint'], | ||
// Prerequisite `eslint-plugin-vue`, being extended, sets | ||
@@ -8,3 +9,11 @@ // root property `parser` to `'vue-eslint-parser'`, which, for code parsing, | ||
parserOptions: { | ||
parser: require.resolve('@typescript-eslint/parser'), | ||
parser: { | ||
'js': 'espree', | ||
'jsx': 'espree', | ||
'ts': require.resolve('@typescript-eslint/parser'), | ||
'tsx': require.resolve('@typescript-eslint/parser'), | ||
// Leave the template parser unspecified, so that it could be determined by `<script lang="...">` | ||
}, | ||
extraFileExtensions: ['.vue'], | ||
@@ -15,13 +24,17 @@ ecmaFeatures: { | ||
}, | ||
extends: [ | ||
'plugin:@typescript-eslint/eslint-recommended' | ||
], | ||
overrides: [{ | ||
files: ['*.ts', '*.tsx'], | ||
rules: { | ||
// The core 'no-unused-vars' rules (in the eslint:recommeded ruleset) | ||
// does not work with type definitions | ||
'no-unused-vars': 'off', | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx'], | ||
rules: { | ||
// The core 'no-unused-vars' rules (in the eslint:recommeded ruleset) | ||
// does not work with type definitions | ||
'no-unused-vars': 'off', | ||
} | ||
} | ||
}] | ||
] | ||
} |
{ | ||
"name": "@vue/eslint-config-typescript", | ||
"version": "10.0.0", | ||
"version": "11.0.0", | ||
"description": "eslint-config-typescript for vue-cli", | ||
@@ -31,3 +31,3 @@ "main": "index.js", | ||
"eslint": "^8.0.0", | ||
"eslint-plugin-vue": "^8.0.1", | ||
"eslint-plugin-vue": "^9.0.0", | ||
"execa": "^4.0.3", | ||
@@ -42,16 +42,21 @@ "jest": "^26.5.2", | ||
"eslint": "^6.2.0 || ^7.0.0 || ^8.0.0", | ||
"eslint-plugin-vue": "^8.0.1" | ||
"eslint-plugin-vue": "^9.0.0", | ||
"typescript": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"typescript": { | ||
"optional": true | ||
} | ||
}, | ||
"dependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.0.0", | ||
"@typescript-eslint/parser": "^5.0.0", | ||
"vue-eslint-parser": "^8.0.0" | ||
"vue-eslint-parser": "^9.0.0" | ||
}, | ||
"engines": { | ||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" | ||
"node": "^14.17.0 || >=16.0.0" | ||
}, | ||
"scripts": { | ||
"test": "jest" | ||
}, | ||
"readme": "# @vue/eslint-config-typescript\n\n> eslint-config-typescript for Vue\n\nSee [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/rules/) for available rules.\n\nThis config is specifically designed to be used by `@vue/cli` & `create-vue` setups\nand is not meant for outside use (it can be used but some adaptations\non the user side might be needed - for details see the config file).\n\nA part of its design is that this config may implicitly depend on\nother parts of `@vue/cli`/`create-vue` setups, such as `eslint-plugin-vue` being\nextended in the same resulting config.\n\n## Installation\n\nIn order to work around [a known limitation in ESLint](https://github.com/eslint/eslint/issues/3458), we recommend you to use this package alongside `@rushstack/eslint-patch`, so that you don't have to install too many dependencies:\n\n```sh\nnpm add --dev @vue/eslint-config-typescript @rushstack/eslint-patch\n```\n\n## Usage\n\nThis package comes with 2 rulesets.\n\n### `@vue/eslint-config-typescript`\n\nThis ruleset is the base configuration for Vue-TypeScript projects.\nBesides setting the parser and plugin options, it also turns off several conflicting rules in the `eslint:recommended` ruleset.\nSo when used alongside other sharable configs, this config should be placed at the end of the `extends` array.\n\nAn example `.eslintrc.cjs`:\n\n```js\n/* eslint-env node */\nrequire(\"@rushstack/eslint-patch/modern-module-resolution\")\n\nmodule.exports = {\n extends: [\n 'eslint:recommended',\n 'plugin:vue/vue3-essential',\n '@vue/eslint-config-typescript'\n ]\n}\n```\n\n### `@vue/eslint-config-typescript/recommended`\n\nThis is extended from the `@typescript-eslint/recommended` ruleset, which is an **_opinionated_** ruleset.\nSee the [original documentation](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/src/configs#recommended) for more information.\n\nSome of its rules, however, might conflict with `prettier`.\nSo when used alongside other sharable configs, this config should be placed after all other configs except for the one from `@vue/eslint-config-prettier` or `eslint-plugin-prettier` in the `extends` array.\n\nAn example `.eslintrc.cjs`:\n\n```js\n/* eslint-env node */\nrequire(\"@rushstack/eslint-patch/modern-module-resolution\")\n\nmodule.exports = {\n extends: [\n 'plugin:vue/vue3-essential',\n '@vue/eslint-config-typescript/recommended',\n '@vue/eslint-config-prettier'\n ]\n}\n```\n\n### With Other Community Configs\n\nWork-In-Progress.\n\n~~If you are following the [`standard`](https://standardjs.com/) or [`airbnb`](https://github.com/airbnb/javascript/) style guides, don't manually extend from this package. Please use `@vue/eslint-config-standard-with-typescript` or `@vue/eslint-config-airbnb-with-typescript` instead.~~\n" | ||
} | ||
} |
module.exports = { | ||
extends: [ | ||
'./index.js', | ||
require.resolve('./index'), | ||
'plugin:@typescript-eslint/recommended' | ||
@@ -12,3 +12,19 @@ ], | ||
// this rule, if on, would require explicit return type on the `render` function | ||
'@typescript-eslint/explicit-function-return-type': 'off' | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
// The following rules are enabled in an `overrides` field in the | ||
// `@typescript-eslint/recommended` ruleset, only turned on for TypeScript source modules | ||
// <https://github.com/typescript-eslint/typescript-eslint/blob/cb2d44650d27d8b917e8ce19423245b834db29d2/packages/eslint-plugin/src/configs/eslint-recommended.ts#L27-L30> | ||
// But as ESLint cannot precisely target `<script lang="ts">` blocks and skip normal `<script>`s, | ||
// no TypeScript code in `.vue` files would be checked against these rules. | ||
// So we now enable them globally. | ||
// That would also check plain JavaScript files, which diverges a little from | ||
// the original intention of the `@typescript-eslint/recommended` rulset. | ||
// But it should be mostly fine. | ||
'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more | ||
'prefer-const': 'error', // ts provides better types with const | ||
'prefer-rest-params': 'error', // ts provides better types with rest args over arguments | ||
'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply | ||
}, | ||
@@ -15,0 +31,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75
8286
6
+ Addedeslint-plugin-vue@9.28.0(transitive)
+ Addedvue-eslint-parser@9.4.3(transitive)
+ Addedxml-name-validator@4.0.0(transitive)
- Removedeslint-plugin-vue@8.7.1(transitive)
- Removedeslint-utils@3.0.0(transitive)
- Removedeslint-visitor-keys@2.1.0(transitive)
- Removedvue-eslint-parser@8.3.0(transitive)
Updatedvue-eslint-parser@^9.0.0