From cb054105f3b7ab7ee3d33ba966692feeb7687a9b Mon Sep 17 00:00:00 2001 From: Michael Dodsworth Date: Mon, 11 Jul 2022 14:12:24 -0700 Subject: [PATCH] fix: resolve conflicting packages; address linting issues; resolve "@/" aliases in generated types --- .eslintrc.js | 2 +- package.json | 14 ++++++++------ rollup.config.js | 30 +++++++++++++++++++++++++----- src/components/Area/index.vue | 4 ++-- src/components/Group/index.vue | 4 +++- src/components/HoverBar/index.vue | 2 +- src/components/Labels/index.vue | 5 ++--- src/components/Treemap/index.vue | 4 ++-- src/models/Scale.ts | 2 ++ tsconfig.json | 1 + 10 files changed, 47 insertions(+), 21 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 787ccc5..7b97647 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,7 +14,7 @@ module.exports = { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'space-before-function-paren': 0, - 'no-unused-vars': ['warn', { varsIgnorePattern: '^_' }], + 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }], 'vue/multi-word-component-names': 0 } diff --git a/package.json b/package.json index 771a419..0ca11ab 100644 --- a/package.json +++ b/package.json @@ -35,18 +35,19 @@ "@types/ramda": "^0.27.60", "@typescript-eslint/eslint-plugin": "^5.6.0", "@typescript-eslint/parser": "^5.6.0", - "@vue/babel-preset-app": "^4.5.15", - "@vue/cli-plugin-babel": "^4.5.15", - "@vue/cli-plugin-typescript": "^4.5.15", - "@vue/cli-service": "^4.5.15", + "@vue/babel-preset-app": "^5.0.8", + "@vue/cli-plugin-babel": "^5.0.8", + "@vue/cli-plugin-eslint": "^5.0.8", + "@vue/cli-plugin-typescript": "^5.0.8", + "@vue/cli-service": "^5.0.8", "@vue/compiler-sfc": "^3.2.26", "core-js": "^3.19.3", "cross-env": "^7.0.3", "eslint": "^8.4.1", - "eslint-config-standard": "^16.0.3", + "eslint-config-standard": "^17.0.0", "eslint-plugin-import": "^2.25.3", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.2.0", + "eslint-plugin-promise": "^6.0.0", "eslint-plugin-vue": "^8.2.0", "minimist": "^1.2.5", "postcss": "^8.4.4", @@ -55,6 +56,7 @@ "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-typescript2": "^0.31.1", "rollup-plugin-vue": "^6.0.0", + "tsc-alias": "^1.6.11", "typescript": "^4.5.3", "vue-router": "^4.0.11" }, diff --git a/rollup.config.js b/rollup.config.js index c26cbaf..740345a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,16 +1,35 @@ +import alias from '@rollup/plugin-alias' +import commonjs from '@rollup/plugin-commonjs' +import resolve from '@rollup/plugin-node-resolve' +import { exec } from 'child_process' import path from 'path' import peerDepsExternal from 'rollup-plugin-peer-deps-external' -import resolve from '@rollup/plugin-node-resolve' -import commonjs from '@rollup/plugin-commonjs' +import postcss from 'rollup-plugin-postcss' import typescript from 'rollup-plugin-typescript2' import vue from 'rollup-plugin-vue' -import alias from '@rollup/plugin-alias' -import postcss from 'rollup-plugin-postcss' import packageJson from './package.json' const projectRoot = path.resolve(__dirname, '.') +// see https://github.com/ezolenko/rollup-plugin-typescript2/issues/201 +const tscAlias = () => { + return { + name: 'tsAlias', + writeBundle: () => { + return new Promise((resolve, reject) => { + exec('tsc-alias', function callback(error, stdout, stderr) { + if (stderr || error) { + reject(stderr || error) + } else { + resolve(stdout) + } + }) + }) + } + } +} + export default { input: 'src/index.ts', output: [ @@ -39,6 +58,7 @@ export default { typescript(), vue(), postcss({ include: /(? p.y) .y1(p => p.y) .x0(p => p.x) - .x1(_ => secondary.scale(0)) + .x1(() => secondary.scale(0)) } return area() @@ -94,7 +94,7 @@ export default defineComponent({ .x0(p => p.x) .x1(p => p.x) .y0(p => p.y) - .y1(_ => secondary.scale(0)) + .y1(() => secondary.scale(0)) } const getStyle = computed(() => { diff --git a/src/components/Group/index.vue b/src/components/Group/index.vue index 7f9b4da..8e0b01b 100644 --- a/src/components/Group/index.vue +++ b/src/components/Group/index.vue @@ -1,5 +1,7 @@