From 10654ad6d2589b43f2ae256f9811af5ee7e11ccf Mon Sep 17 00:00:00 2001 From: Alexandre Geissmann Date: Tue, 11 Feb 2020 14:35:08 -0500 Subject: [PATCH 1/2] wip: yarn v2 compat --- @typescript-eslint/eslint-plugin/index.js | 1 + @typescript-eslint/eslint-plugin/package.json | 8 ++++++++ index.js | 6 +++--- package.json | 6 +++++- recommended.js | 4 ++-- yarn.lock | 15 +++++++++++++++ 6 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 @typescript-eslint/eslint-plugin/index.js create mode 100644 @typescript-eslint/eslint-plugin/package.json diff --git a/@typescript-eslint/eslint-plugin/index.js b/@typescript-eslint/eslint-plugin/index.js new file mode 100644 index 0000000..c7b7ff3 --- /dev/null +++ b/@typescript-eslint/eslint-plugin/index.js @@ -0,0 +1 @@ +module.exports = require('@typescript-eslint/eslint-plugin'); \ No newline at end of file diff --git a/@typescript-eslint/eslint-plugin/package.json b/@typescript-eslint/eslint-plugin/package.json new file mode 100644 index 0000000..a416cc0 --- /dev/null +++ b/@typescript-eslint/eslint-plugin/package.json @@ -0,0 +1,8 @@ +{ + "name": "eslint-plugin-shim-typescript", + "version": "0.0.1", + "private": true, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": "^2.7.0" + } +} \ No newline at end of file diff --git a/index.js b/index.js index befe562..ccfb50e 100644 --- a/index.js +++ b/index.js @@ -1,18 +1,18 @@ module.exports = { - plugins: ['@typescript-eslint'], + plugins: ['shim-typescript'], // Prerequisite `eslint-plugin-vue`, being extended, sets // root property `parser` to `'vue-eslint-parser'`, which, for code parsing, // in turn delegates to the parser, specified in `parserOptions.parser`: // https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error parserOptions: { - parser: '@typescript-eslint/parser', + parser: require.resolve('@typescript-eslint/parser'), extraFileExtensions: ['.vue'], ecmaFeatures: { jsx: true } }, extends: [ - 'plugin:@typescript-eslint/eslint-recommended' + 'plugin:shim-typescript/eslint-recommended' ], overrides: [{ files: ['*.ts', '*.tsx'], diff --git a/package.json b/package.json index 3c99ba0..1958129 100644 --- a/package.json +++ b/package.json @@ -43,5 +43,9 @@ "@typescript-eslint/parser": "^2.7.0", "eslint": "^5.0.0 || ^6.0.0", "eslint-plugin-vue": "^5.2.3 || ^6.0.0" + }, + "dependencies": { + "vue-eslint-parser": "^7.0.0", + "eslint-plugin-shim-typescript": "file:./@typescript-eslint/eslint-plugin" } -} +} \ No newline at end of file diff --git a/recommended.js b/recommended.js index 940f7a0..d998cd6 100644 --- a/recommended.js +++ b/recommended.js @@ -1,11 +1,11 @@ module.exports = { extends: [ './index.js', - 'plugin:@typescript-eslint/recommended' + 'plugin:shim-typescript/recommended' ], // the ts-eslint recommended ruleset sets the parser so we need to set it back - parser: 'vue-eslint-parser', + parser: require.resolve('vue-eslint-parser'), rules: { // this rule, if on, would require explicit return type on the `render` function diff --git a/yarn.lock b/yarn.lock index bcc71f5..08c7b3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1108,6 +1108,9 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" +"eslint-plugin-shim-typescript@file:./@typescript-eslint/eslint-plugin": + version "0.0.1" + eslint-plugin-vue@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-6.0.1.tgz#166d3eb24cf290f3ff24d44fe9fca496f3924fc2" @@ -3981,6 +3984,18 @@ vue-eslint-parser@^6.0.5: esquery "^1.0.1" lodash "^4.17.11" +vue-eslint-parser@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-7.0.0.tgz#a4ed2669f87179dedd06afdd8736acbb3a3864d6" + integrity sha512-yR0dLxsTT7JfD2YQo9BhnQ6bUTLsZouuzt9SKRP7XNaZJV459gvlsJo4vT2nhZ/2dH9j3c53bIx9dnqU2prM9g== + dependencies: + debug "^4.1.1" + eslint-scope "^5.0.0" + eslint-visitor-keys "^1.1.0" + espree "^6.1.2" + esquery "^1.0.1" + lodash "^4.17.15" + vue-property-decorator@^8.3.0: version "8.3.0" resolved "https://registry.yarnpkg.com/vue-property-decorator/-/vue-property-decorator-8.3.0.tgz#536f027dc7d626f37c8d85a2dc02f0a6cb979440" From 3ee37c9d84f850a3e008e3fc302f61e8891d9a13 Mon Sep 17 00:00:00 2001 From: Alexandre Geissmann Date: Tue, 11 Feb 2020 15:57:26 -0500 Subject: [PATCH 2/2] remove crappy shimming: this actually works without --- @typescript-eslint/eslint-plugin/index.js | 1 - @typescript-eslint/eslint-plugin/package.json | 8 -------- index.js | 4 ++-- package.json | 3 +-- recommended.js | 2 +- yarn.lock | 3 --- 6 files changed, 4 insertions(+), 17 deletions(-) delete mode 100644 @typescript-eslint/eslint-plugin/index.js delete mode 100644 @typescript-eslint/eslint-plugin/package.json diff --git a/@typescript-eslint/eslint-plugin/index.js b/@typescript-eslint/eslint-plugin/index.js deleted file mode 100644 index c7b7ff3..0000000 --- a/@typescript-eslint/eslint-plugin/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@typescript-eslint/eslint-plugin'); \ No newline at end of file diff --git a/@typescript-eslint/eslint-plugin/package.json b/@typescript-eslint/eslint-plugin/package.json deleted file mode 100644 index a416cc0..0000000 --- a/@typescript-eslint/eslint-plugin/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "eslint-plugin-shim-typescript", - "version": "0.0.1", - "private": true, - "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^2.7.0" - } -} \ No newline at end of file diff --git a/index.js b/index.js index ccfb50e..a5aa805 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ module.exports = { - plugins: ['shim-typescript'], + plugins: ['@typescript-eslint'], // Prerequisite `eslint-plugin-vue`, being extended, sets // root property `parser` to `'vue-eslint-parser'`, which, for code parsing, // in turn delegates to the parser, specified in `parserOptions.parser`: @@ -12,7 +12,7 @@ module.exports = { } }, extends: [ - 'plugin:shim-typescript/eslint-recommended' + 'plugin:@typescript-eslint/eslint-recommended' ], overrides: [{ files: ['*.ts', '*.tsx'], diff --git a/package.json b/package.json index 1958129..a0ec037 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ "eslint-plugin-vue": "^5.2.3 || ^6.0.0" }, "dependencies": { - "vue-eslint-parser": "^7.0.0", - "eslint-plugin-shim-typescript": "file:./@typescript-eslint/eslint-plugin" + "vue-eslint-parser": "^7.0.0" } } \ No newline at end of file diff --git a/recommended.js b/recommended.js index d998cd6..f726f42 100644 --- a/recommended.js +++ b/recommended.js @@ -1,7 +1,7 @@ module.exports = { extends: [ './index.js', - 'plugin:shim-typescript/recommended' + 'plugin:@typescript-eslint/recommended' ], // the ts-eslint recommended ruleset sets the parser so we need to set it back diff --git a/yarn.lock b/yarn.lock index 08c7b3a..3ea4aae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1108,9 +1108,6 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" -"eslint-plugin-shim-typescript@file:./@typescript-eslint/eslint-plugin": - version "0.0.1" - eslint-plugin-vue@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-6.0.1.tgz#166d3eb24cf290f3ff24d44fe9fca496f3924fc2"