From 0336168bdc24d3d63493f6f1fa0d10f09cfc0807 Mon Sep 17 00:00:00 2001 From: lana-k Date: Sun, 29 Aug 2021 21:27:02 +0200 Subject: [PATCH] line size lint checking --- .eslintrc.js | 3 +- karma.conf.js | 17 ++++--- src/components/CsvImport/index.vue | 5 +- src/components/Splitpanes/index.vue | 5 +- src/components/SqlTable/Pager.vue | 7 ++- src/components/svg/addTable.vue | 7 +-- src/components/svg/changeDb.vue | 8 ++- src/components/svg/chart.vue | 43 +++++++++++++--- src/components/svg/clear.vue | 8 ++- src/components/svg/clipboard.vue | 18 ++++++- src/components/svg/close.vue | 3 +- src/components/svg/dataView.vue | 23 ++++++++- src/components/svg/dropDownChevron.vue | 5 +- src/components/svg/export.vue | 4 +- src/components/svg/exportToCsv.vue | 50 +++++++++++++++++-- src/components/svg/exportToSvg.vue | 49 ++++++++++++++++-- src/components/svg/hint.vue | 24 ++++++++- src/components/svg/pivot.vue | 10 +++- src/components/svg/png.vue | 27 +++++++++- src/components/svg/sort.vue | 16 +++++- src/components/svg/sqlEditor.vue | 40 ++++++++++++++- src/components/svg/table.vue | 37 ++++++++++++-- src/components/svg/treeChevron.vue | 3 +- src/lib/database/index.js | 14 ++++-- src/views/Main/Inquiries/index.vue | 5 +- src/views/Main/Inquiries/svg/copy.vue | 7 ++- src/views/Main/Inquiries/svg/delete.vue | 5 +- src/views/Main/Inquiries/svg/rename.vue | 5 +- .../Tabs/Tab/DataView/Pivot/PivotUi/index.vue | 12 +++-- .../Tabs/Tab/DataView/Pivot/index.vue | 10 ++-- .../Workspace/Tabs/Tab/DataView/index.vue | 16 ++++-- .../Main/Workspace/Tabs/Tab/RunResult.vue | 6 ++- tests/components/CsvImport/CsvImport.spec.js | 5 +- tests/components/LoadingIndicator.spec.js | 3 +- tests/views/Main/Inquiries/Inquiries.spec.js | 6 ++- vue.config.js | 3 +- 36 files changed, 434 insertions(+), 75 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 0011c25..247a79d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -13,7 +13,8 @@ module.exports = { rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', - 'no-case-declarations': 'off' + 'no-case-declarations': 'off', + 'max-len': [2, 100, 4, { ignoreUrls: true }] }, overrides: [ { diff --git a/karma.conf.js b/karma.conf.js index 64520e2..c6b4c9d 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -55,12 +55,15 @@ module.exports = function (config) { junitReporter: { outputDir: 'report', // results will be saved as $outputDir/$browserName.xml - outputFile: undefined, // if included, results will be saved as $outputDir/$browserName/$outputFile + // if included, results will be saved as $outputDir/$browserName/$outputFile + outputFile: undefined, suite: '', // suite will become the package name attribute in xml testsuite element useBrowserName: true, // add browser name to report and classes names - nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element - classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element - properties: {} // key value pair of properties to add to the section of the report + // function (browser, result) to customize the name attribute in xml testcase element + nameFormatter: undefined, + // function (browser, result) to customize the classname attribute in xml testcase element + classNameFormatter: undefined, + properties: {} // key value pairs add to the section of the report }, // web server port @@ -70,7 +73,8 @@ module.exports = function (config) { colors: true, // level of logging - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || + // config.LOG_INFO || config.LOG_DEBUG logLevel: config.LOG_INFO, // enable / disable watching file and executing tests whenever any file changes @@ -80,7 +84,8 @@ module.exports = function (config) { FirefoxHeadlessTouch: { base: 'FirefoxHeadless', prefs: { - 'dom.w3c_touch_events.enabled': 1 + 'dom.w3c_touch_events.enabled': 1, + 'dom.events.asyncClipboard.clipboardItem': true } } }, diff --git a/src/components/CsvImport/index.vue b/src/components/CsvImport/index.vue index 64efdf5..07a3af7 100644 --- a/src/components/CsvImport/index.vue +++ b/src/components/CsvImport/index.vue @@ -39,7 +39,10 @@ />
- + + ` } diff --git a/src/components/svg/addTable.vue b/src/components/svg/addTable.vue index bd098f9..85542c6 100644 --- a/src/components/svg/addTable.vue +++ b/src/components/svg/addTable.vue @@ -14,14 +14,15 @@ diff --git a/src/components/svg/changeDb.vue b/src/components/svg/changeDb.vue index 9c7c8f1..08a6227 100644 --- a/src/components/svg/changeDb.vue +++ b/src/components/svg/changeDb.vue @@ -11,7 +11,13 @@ @mouseleave="hideTooltip" > diff --git a/src/components/svg/chart.vue b/src/components/svg/chart.vue index fb1012b..2c643fb 100644 --- a/src/components/svg/chart.vue +++ b/src/components/svg/chart.vue @@ -5,12 +5,43 @@ viewBox="0 0 18 18" fill="none" > - - - - - - + + + + + + diff --git a/src/components/svg/clear.vue b/src/components/svg/clear.vue index c61ba43..d52363f 100644 --- a/src/components/svg/clear.vue +++ b/src/components/svg/clear.vue @@ -8,7 +8,13 @@ xmlns="http://www.w3.org/2000/svg" > diff --git a/src/components/svg/clipboard.vue b/src/components/svg/clipboard.vue index d3a5459..8858823 100644 --- a/src/components/svg/clipboard.vue +++ b/src/components/svg/clipboard.vue @@ -5,7 +5,23 @@ viewBox="0 0 18 18" fill="none" > - + diff --git a/src/components/svg/close.vue b/src/components/svg/close.vue index a9b2375..2e43ffb 100644 --- a/src/components/svg/close.vue +++ b/src/components/svg/close.vue @@ -9,7 +9,8 @@ xmlns="http://www.w3.org/2000/svg" > diff --git a/src/components/svg/dataView.vue b/src/components/svg/dataView.vue index 7ecd371..701d1d6 100644 --- a/src/components/svg/dataView.vue +++ b/src/components/svg/dataView.vue @@ -5,9 +5,28 @@ viewBox="0 0 18 18" fill="none" > - + - + diff --git a/src/components/svg/dropDownChevron.vue b/src/components/svg/dropDownChevron.vue index d05949c..4242c0f 100644 --- a/src/components/svg/dropDownChevron.vue +++ b/src/components/svg/dropDownChevron.vue @@ -7,7 +7,10 @@ fill="none" xmlns="http://www.w3.org/2000/svg" > - + diff --git a/src/components/svg/export.vue b/src/components/svg/export.vue index d6cd99f..047b413 100644 --- a/src/components/svg/export.vue +++ b/src/components/svg/export.vue @@ -11,7 +11,9 @@ @mouseleave="hideTooltip" > diff --git a/src/components/svg/exportToCsv.vue b/src/components/svg/exportToCsv.vue index 7d3a736..3b09cfe 100644 --- a/src/components/svg/exportToCsv.vue +++ b/src/components/svg/exportToCsv.vue @@ -5,10 +5,52 @@ viewBox="0 0 19 18" fill="none" > - - - - + + + + diff --git a/src/components/svg/exportToSvg.vue b/src/components/svg/exportToSvg.vue index 064abd8..52ab6e4 100644 --- a/src/components/svg/exportToSvg.vue +++ b/src/components/svg/exportToSvg.vue @@ -5,10 +5,51 @@ viewBox="0 0 19 18" fill="none" > - - - - + + + + diff --git a/src/components/svg/hint.vue b/src/components/svg/hint.vue index c6f6b77..44808d6 100644 --- a/src/components/svg/hint.vue +++ b/src/components/svg/hint.vue @@ -10,8 +10,28 @@ @mouseenter="showTooltip" @mouseleave="hideTooltip" > - - + + {{ hint }} diff --git a/src/components/svg/pivot.vue b/src/components/svg/pivot.vue index 364bda8..d507816 100644 --- a/src/components/svg/pivot.vue +++ b/src/components/svg/pivot.vue @@ -5,7 +5,15 @@ viewBox="0 0 18 18" fill="none" > - + diff --git a/src/components/svg/png.vue b/src/components/svg/png.vue index 0cf17a2..2f44733 100644 --- a/src/components/svg/png.vue +++ b/src/components/svg/png.vue @@ -5,8 +5,31 @@ viewBox="0 0 18 18" fill="none" > - - + + diff --git a/src/components/svg/sort.vue b/src/components/svg/sort.vue index 26384ba..6145a52 100644 --- a/src/components/svg/sort.vue +++ b/src/components/svg/sort.vue @@ -6,8 +6,20 @@ viewBox="0 0 6 12" fill="none" > - - + + diff --git a/src/components/svg/sqlEditor.vue b/src/components/svg/sqlEditor.vue index c209381..58f0f8c 100644 --- a/src/components/svg/sqlEditor.vue +++ b/src/components/svg/sqlEditor.vue @@ -6,8 +6,44 @@ fill="none" > - - + + diff --git a/src/components/svg/table.vue b/src/components/svg/table.vue index 0df1091..19f9a59 100644 --- a/src/components/svg/table.vue +++ b/src/components/svg/table.vue @@ -5,11 +5,38 @@ viewBox="0 0 18 18" fill="none" > - - - - - + + + + + diff --git a/src/components/svg/treeChevron.vue b/src/components/svg/treeChevron.vue index e4d63b5..e213c11 100644 --- a/src/components/svg/treeChevron.vue +++ b/src/components/svg/treeChevron.vue @@ -9,7 +9,8 @@ xmlns="http://www.w3.org/2000/svg" > diff --git a/src/lib/database/index.js b/src/lib/database/index.js index 92264d6..19edbea 100644 --- a/src/lib/database/index.js +++ b/src/lib/database/index.js @@ -80,11 +80,17 @@ class Database { async refreshSchema () { const getSchemaSql = ` - WITH columns as (SELECT a.tbl_name, json_group_array(json_object('name', b.name,'type', IIF(b.type = '', 'N/A', b.type))) as column_json - FROM sqlite_master a, pragma_table_info(a.name) b - WHERE a.type in ('table','view') AND a.name NOT LIKE 'sqlite_%' group by tbl_name + WITH columns as ( + SELECT + a.tbl_name, + json_group_array( + json_object('name', b.name,'type', IIF(b.type = '', 'N/A', b.type)) + ) as column_json + FROM sqlite_master a, pragma_table_info(a.name) b + WHERE a.type in ('table','view') AND a.name NOT LIKE 'sqlite_%' group by tbl_name ) - SELECT json_group_array(json_object('name',tbl_name, 'columns', json(column_json))) objects from columns; + SELECT json_group_array(json_object('name',tbl_name, 'columns', json(column_json))) objects + FROM columns; ` const result = await this.execute(getSchemaSql) this.schema = JSON.parse(result.values.objects[0]) diff --git a/src/views/Main/Inquiries/index.vue b/src/views/Main/Inquiries/index.vue index 876136f..8895f7e 100644 --- a/src/views/Main/Inquiries/index.vue +++ b/src/views/Main/Inquiries/index.vue @@ -84,7 +84,10 @@
{{ inquiry.createdAt | date }}
- + diff --git a/src/views/Main/Inquiries/svg/delete.vue b/src/views/Main/Inquiries/svg/delete.vue index 2d6270a..7865339 100644 --- a/src/views/Main/Inquiries/svg/delete.vue +++ b/src/views/Main/Inquiries/svg/delete.vue @@ -11,7 +11,10 @@ @mouseleave="hideTooltip" > diff --git a/src/views/Main/Inquiries/svg/rename.vue b/src/views/Main/Inquiries/svg/rename.vue index 99b70f7..30b36a1 100644 --- a/src/views/Main/Inquiries/svg/rename.vue +++ b/src/views/Main/Inquiries/svg/rename.vue @@ -11,7 +11,10 @@ @mouseleave="hideTooltip" > diff --git a/src/views/Main/Workspace/Tabs/Tab/DataView/Pivot/PivotUi/index.vue b/src/views/Main/Workspace/Tabs/Tab/DataView/Pivot/PivotUi/index.vue index 023fcce..5bdb63b 100644 --- a/src/views/Main/Workspace/Tabs/Tab/DataView/Pivot/PivotUi/index.vue +++ b/src/views/Main/Workspace/Tabs/Tab/DataView/Pivot/PivotUi/index.vue @@ -165,8 +165,11 @@ export default { colOrder: (this.value && this.value.colOrder) || 'key_a_to_z', rowOrder: (this.value && this.value.rowOrder) || 'key_a_to_z', customChartComponent: - (this.value && this.value.rendererOptions && this.value.rendererOptions.customChartComponent) || - new ChartClass() + ( + this.value && + this.value.rendererOptions && + this.value.rendererOptions.customChartComponent + ) || new ChartClass() } }, computed: { @@ -222,7 +225,10 @@ export default { }, created () { this.customChartComponent.$on('update', () => { this.$emit('update') }) - this.customChartComponent.$on('loadingImageCompleted', value => { this.$emit('loadingCustomChartImageCompleted') }) + this.customChartComponent.$on( + 'loadingImageCompleted', + value => { this.$emit('loadingCustomChartImageCompleted') } + ) }, methods: { returnValue () { diff --git a/src/views/Main/Workspace/Tabs/Tab/DataView/Pivot/index.vue b/src/views/Main/Workspace/Tabs/Tab/DataView/Pivot/index.vue index 19de9fe..760db8d 100644 --- a/src/views/Main/Workspace/Tabs/Tab/DataView/Pivot/index.vue +++ b/src/views/Main/Workspace/Tabs/Tab/DataView/Pivot/index.vue @@ -53,7 +53,9 @@ export default { colOrder: this.initOptions.colOrder, rowOrder: this.initOptions.rowOrder, aggregatorName: this.initOptions.aggregatorName, - aggregator: $.pivotUtilities.aggregators[this.initOptions.aggregatorName](this.initOptions.vals), + aggregator: $.pivotUtilities.aggregators[ + this.initOptions.aggregatorName + ](this.initOptions.vals), vals: this.initOptions.vals, rendererName: this.initOptions.rendererName, renderer: $.pivotUtilities.renderers[this.initOptions.rendererName], @@ -165,9 +167,9 @@ export default { if (this.viewCustomChart) { this.pivotOptions.rendererOptions.customChartComponent.saveAsPng() } else { - const source = this.viewStandartChart ? - await chartHelper.getImageDataUrl(this.$refs.pivotOutput, 'png') : - (await getPivotCanvas(this.$refs.pivotOutput)).toDataURL('image/png') + const source = this.viewStandartChart + ? await chartHelper.getImageDataUrl(this.$refs.pivotOutput, 'png') + : (await getPivotCanvas(this.$refs.pivotOutput)).toDataURL('image/png') this.$emit('loadingImageCompleted') fIo.downloadFromUrl(source, 'pivot') diff --git a/src/views/Main/Workspace/Tabs/Tab/DataView/index.vue b/src/views/Main/Workspace/Tabs/Tab/DataView/index.vue index 7acda21..d71cc89 100644 --- a/src/views/Main/Workspace/Tabs/Tab/DataView/index.vue +++ b/src/views/Main/Workspace/Tabs/Tab/DataView/index.vue @@ -124,9 +124,15 @@ export default { async saveAsPng () { this.loadingImage = true /* - setTimeout does its thing by putting its callback on the callback queue. The callback queue is only called by the browser after both the call stack and the render queue are done. So our animation (which is on the call stack) gets done, the render queue renders it, and then the browser is ready for the callback queue and calls the long-calculation. + setTimeout does its thing by putting its callback on the callback queue. + The callback queue is only called by the browser after both the call stack + and the render queue are done. So our animation (which is on the call stack) gets done, + the render queue renders it, and then the browser is ready for the callback queue + and calls the long-calculation. - nextTick allows you to do something after you have changed the data and VueJS has updated the DOM based on your data change, but before the browser has rendered those changed on the page. + nextTick allows you to do something after you have changed the data + and VueJS has updated the DOM based on your data change, + but before the browser has rendered those changed on the page. http://www.hesselinkwebdesign.nl/2019/nexttick-vs-settimeout-in-vue/ @@ -153,7 +159,11 @@ export default { this.preparingCopy = false } } else { - alert("Your browser doesn't support copying images into the clipboard. If you use Firefox you can enable it by setting dom.events.asyncClipboard.clipboardItem to true.") + alert( + "Your browser doesn't support copying images into the clipboard. " + + 'If you use Firefox you can enable it ' + + 'by setting dom.events.asyncClipboard.clipboardItem to true.' + ) } }, async copyToClipboard () { diff --git a/src/views/Main/Workspace/Tabs/Tab/RunResult.vue b/src/views/Main/Workspace/Tabs/Tab/RunResult.vue index 15529cf..e2aac8d 100644 --- a/src/views/Main/Workspace/Tabs/Tab/RunResult.vue +++ b/src/views/Main/Workspace/Tabs/Tab/RunResult.vue @@ -136,7 +136,11 @@ export default { this.preparingCopy = false } } else { - alert("Your browser doesn't support copying images into the clipboard. If you use Firefox you can enable it by setting dom.events.asyncClipboard.clipboardItem to true.") + alert( + "Your browser doesn't support copying images into the clipboard. " + + 'If you use Firefox you can enable it ' + + 'by setting dom.events.asyncClipboard.clipboardItem to true.' + ) } }, diff --git a/tests/components/CsvImport/CsvImport.spec.js b/tests/components/CsvImport/CsvImport.spec.js index 7f52377..92bc338 100644 --- a/tests/components/CsvImport/CsvImport.spec.js +++ b/tests/components/CsvImport/CsvImport.spec.js @@ -167,7 +167,10 @@ describe('CsvImport.vue', () => { expect(rows.at(0).findAll('td').at(0).text()).to.equal('baz') expect(rows.at(0).findAll('td').at(1).text()).to.equal('3') expect(wrapper.findComponent({ name: 'logs' }).text()) - .to.contain('Error in row 0. Quote is missed. Edit your CSV so that the field has a closing quote char.') + .to.contain( + 'Error in row 0. Quote is missed. ' + + 'Edit your CSV so that the field has a closing quote char.' + ) expect(wrapper.findComponent({ name: 'logs' }).text()) .to.not.contain('Preview parsing is completed in') diff --git a/tests/components/LoadingIndicator.spec.js b/tests/components/LoadingIndicator.spec.js index ce3a60c..b6b177a 100644 --- a/tests/components/LoadingIndicator.spec.js +++ b/tests/components/LoadingIndicator.spec.js @@ -19,6 +19,7 @@ describe('LoadingIndicator.vue', () => { }) // The lendth of circle in the component is 50.24. If progress is 50% then resulting arc // should be 25.12 - expect(wrapper.find('.loader-svg.front').element.style.strokeDasharray).to.equal('25.12px, 25.12px') + expect(wrapper.find('.loader-svg.front').element.style.strokeDasharray) + .to.equal('25.12px, 25.12px') }) }) diff --git a/tests/views/Main/Inquiries/Inquiries.spec.js b/tests/views/Main/Inquiries/Inquiries.spec.js index ac28186..5cbb6f8 100644 --- a/tests/views/Main/Inquiries/Inquiries.spec.js +++ b/tests/views/Main/Inquiries/Inquiries.spec.js @@ -305,7 +305,8 @@ describe('Inquiries.vue', () => { await storedInquiries.readPredefinedInquiries.returnValues[0] await storedInquiries.getStoredInquiries.returnValues[0] await wrapper.vm.$nextTick() - await wrapper.findComponent({ ref: 'mainCheckBox' }).find('.checkbox-container').trigger('click') + await wrapper.findComponent({ ref: 'mainCheckBox' }).find('.checkbox-container') + .trigger('click') await wrapper.findComponent({ name: 'CopyIcon' }).find('svg').trigger('click') const checkboxes = wrapper.findAllComponents({ ref: 'rowCheckBox' }) @@ -553,7 +554,8 @@ describe('Inquiries.vue', () => { await wrapper.vm.$nextTick() // click on master checkbox - await wrapper.findComponent({ ref: 'mainCheckBox' }).find('.checkbox-container').trigger('click') + await wrapper.findComponent({ ref: 'mainCheckBox' }).find('.checkbox-container') + .trigger('click') // click Import await wrapper.find('#toolbar-btns-import').trigger('click') diff --git a/vue.config.js b/vue.config.js index b9de711..d29970f 100644 --- a/vue.config.js +++ b/vue.config.js @@ -10,7 +10,8 @@ module.exports = { plugins: [ new CopyPlugin([ // This wasm file will be fetched dynamically when we initialize sql.js - // It is important that we do not change its name, and that it is in the same folder as the js + // It is important that we do not change its name, + // and that it is in the same folder as the js { from: 'node_modules/sql.js/dist/sql-wasm.wasm', to: 'js/' }, { from: 'LICENSE', to: './' } ]),