Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve conflicting packages; address linting issues; resolve "@… #46

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommendation is to disable no-unused-vars as it complains about unused vars in interface declarations

'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }],
'vue/multi-word-component-names': 0
}
Expand Down
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
},
Expand Down
30 changes: 25 additions & 5 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -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: [
Expand Down Expand Up @@ -39,6 +58,7 @@ export default {
typescript(),
vue(),
postcss({ include: /(?<!&module=.*)\.css$/ }),
commonjs()
commonjs(),
tscAlias()
]
}
4 changes: 2 additions & 2 deletions src/components/Area/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ export default defineComponent({
.y0(p => p.y)
.y1(p => p.y)
.x0(p => p.x)
.x1(_ => secondary.scale(0))
.x1(() => secondary.scale(0))
}

return area<any>()
.curve(lineType(props.type))
.x0(p => p.x)
.x1(p => p.x)
.y0(p => p.y)
.y1(_ => secondary.scale(0))
.y1(() => secondary.scale(0))
}

const getStyle = computed(() => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Group/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<template>
<slot />
<div>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linting error complaining about having slot as the root element, so wrapped in a div

<slot />
</div>
</template>
<script lang="ts">
import { defineComponent, provide } from 'vue'
Expand Down
2 changes: 1 addition & 1 deletion src/components/HoverBar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default defineComponent({
bar.value = {
x: x - width / 2,
y: 0,
width: width,
width,
height: canvas.value.height
}
} else {
Expand Down
5 changes: 2 additions & 3 deletions src/components/Labels/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</template>

<script lang="ts">
import { computed, defineComponent, watch, ref, onMounted, inject } from 'vue'
import { computed, defineComponent } from 'vue'
import { is } from 'ramda'
import { useChart, usePoints } from '@/hooks'
import { usePoints } from '@/hooks'
import Layer from '../Layer/index.vue'
import { kebabize, mapKeys } from '@/utils'

Expand All @@ -26,7 +26,6 @@ export default defineComponent({
},
setup(props) {
const toKebabCase = (data: any) => mapKeys(kebabize, data)
const chart = useChart()
const { points } = usePoints(props.dataKeys, { stacked: false, type: 'custom' })

const getStyle = computed(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Treemap/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export default defineComponent({
},
margin: {
type: Object as () => Margin,
default: { top: 0, right: 0, bottom: 0, left: 0 }
default: () => ({ top: 0, right: 0, bottom: 0, left: 0 })
},
padding: {
type: Number,
default: 8
},
data: {
type: Array as () => any[],
default: []
default: () => ([])
},
dataKeys: {
type: Object as () => [string, string],
Expand Down
2 changes: 2 additions & 0 deletions src/models/Scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ export default class Scale {
const valueMin: number = min(stackedData, (arr) => min(arr, (x) => min(x))) || 0

const [dataMin, dataMax] = extent(Array.from(new Set(values.concat([valueMin, valueMax]))))
// eslint-disable-next-line no-eval
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just ignoring these for now: my recommendation would be to allow a function to be passed through, rather than a string that you have to eval. That is, allow a function to be passed through that takes an optional min/max.

const yMin = eval(`
let dataMin = ${dataMin || 0}
${domain[0]}
`)

// eslint-disable-next-line no-eval
const yMax = eval(`
let dataMax = ${dataMax || 0}
${domain[1]}
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"strict": true,
"declaration": true,
"declarationDir": "dist/types",
"outDir": "dist",
"noUnusedLocals": false,
"noUnusedParameters": true,
"importHelpers": true,
Expand Down