src/BaseCharts.js
Replace `'chart.js'` with `"chart.js";`import Chart from 'chart.js' Function `generateChart` has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Function `generateChart` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.export function generateChart(chartId, chartType) { return {Delete `路` render: function (createElement) { return createElement(Replace `'div'` with `"div"` 'div', { style: this.styles, class: this.cssClasses }, [Replace `'canvas'` with `"canvas"` createElement('canvas', { attrs: { id: this.chartId, width: this.width, height: this.height },Replace `'canvas'` with `"canvas"` ref: 'canvas' }) ]Insert `;` ) }, props: { chartId: { default: chartId, type: String }, width: { default: 400, type: Number }, height: { default: 400, type: Number }, cssClasses: { type: String,Replace `''` with `""` default: '' }, styles: { type: Object }, plugins: { type: Array, default() {Insert `;` return [] } } }, data() { return { _chart: null, _plugins: this.pluginsInsert `;` } }, methods: { addPlugin(plugin) {Insert `;` this.$data._plugins.push(plugin) }, generateLegend() { if (this.$data._chart) {Insert `;` return this.$data._chart.generateLegend() } }, renderChart(data, options) {Insert `;` if (this.$data._chart) this.$data._chart.destroy() if (!this.$refs.canvas) throw new Error(Replace `'Please路remove路the路路tags路from路your路chart路component.路See路https://vue-chartjs.org/guide/#vue-single-file-components'` with `"Please路remove路the路路tags路from路your路chart路component.路See路https://vue-chartjs.org/guide/#vue-single-file-components"` 'Please remove the <template></template> tags from your chart component. See https://vue-chartjs.org/guide/#vue-single-file-components'Insert `;` )Replace `'2d'` with `"2d"` this.$data._chart = new Chart(this.$refs.canvas.getContext('2d'), { type: chartType, data: data, options: options, plugins: this.$data._pluginsInsert `;` }) } }, beforeDestroy() { if (this.$data._chart) {Insert `;` this.$data._chart.destroy() } }Insert `;` }} Replace `'bar-chart',路'bar')` with `"bar-chart",路"bar");`export const Bar = generateChart('bar-chart', 'bar')export const HorizontalBar = generateChart(Replace `'horizontalbar-chart'` with `"horizontalbar-chart"` 'horizontalbar-chart',Replace `'horizontalBar'` with `"horizontalBar"` 'horizontalBar'Insert `;`)Replace `'doughnut-chart',路'doughnut')` with `"doughnut-chart",路"doughnut");`export const Doughnut = generateChart('doughnut-chart', 'doughnut')Replace `'line-chart',路'line')` with `"line-chart",路"line");`export const Line = generateChart('line-chart', 'line')Replace `'pie-chart',路'pie')` with `"pie-chart",路"pie");`export const Pie = generateChart('pie-chart', 'pie')Replace `'polar-chart',路'polarArea')` with `"polar-chart",路"polarArea");`export const PolarArea = generateChart('polar-chart', 'polarArea')Replace `'radar-chart',路'radar')` with `"radar-chart",路"radar");`export const Radar = generateChart('radar-chart', 'radar')Replace `'bubble-chart',路'bubble')` with `"bubble-chart",路"bubble");`export const Bubble = generateChart('bubble-chart', 'bubble')Replace `'scatter-chart',路'scatter')` with `"scatter-chart",路"scatter");`export const Scatter = generateChart('scatter-chart', 'scatter') export default { Bar, HorizontalBar, Doughnut, Line, Pie, PolarArea, Radar, Bubble, ScatterInsert `;`}