diff --git a/Jenkinsfile.public b/Jenkinsfile.public index 6fdcb21fa..5ce3e54c0 100644 --- a/Jenkinsfile.public +++ b/Jenkinsfile.public @@ -279,7 +279,7 @@ pipeline { stage('web/storagenode') { steps { dir("web/storagenode") { - sh 'npm run lint' + sh 'npm run lint-ci' sh script: 'npm audit', returnStatus: true sh 'npm run test' } diff --git a/web/storagenode/.eslintrc.js b/web/storagenode/.eslintrc.js index 0c1b04096..443614a0a 100644 --- a/web/storagenode/.eslintrc.js +++ b/web/storagenode/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { env: { node: true }, - 'extends': [ + extends: [ 'plugin:vue/essential', 'eslint:recommended', '@vue/typescript/recommended', @@ -17,11 +17,19 @@ module.exports = { rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-empty-function": "off", - '@typescript-eslint/no-var-requires': 0, - "vue/require-v-for-key": "off", - "indent": ["error", 4], + "indent": ["warn", 4], + + "@typescript-eslint/no-explicit-any": "off", // TODO: fix + + "@typescript-eslint/no-unused-vars": [ + "warn", { + "vars": "all", + "args": "all", + "argsIgnorePattern": "^_" + }], + + '@typescript-eslint/no-empty-function': "off", + '@typescript-eslint/no-var-requires': "off", }, } \ No newline at end of file diff --git a/web/storagenode/.stylelintrc.js b/web/storagenode/.stylelintrc.js new file mode 100644 index 000000000..4b57ecf0c --- /dev/null +++ b/web/storagenode/.stylelintrc.js @@ -0,0 +1,51 @@ +// Copyright (C) 2021 Storj Labs, Inc. +// See LICENSE for copying information. + +module.exports = { + "env": { + "es2020": true, + "node": true, + "jest": true + }, + "plugins": [ + "stylelint-scss" + ], + "extends": "stylelint-config-standard", + "ignoreFiles": ["dist/**"], + "rules": { + "indentation": 4, + "string-quotes": "single", + "no-duplicate-selectors": true, + "selector-max-attribute": 1, + "selector-combinator-space-after": "always", + "selector-attribute-operator-space-before": "never", + "selector-attribute-operator-space-after": "never", + "selector-attribute-brackets-space-inside": "never", + "declaration-block-trailing-semicolon": "always", + "declaration-colon-space-before": "never", + "declaration-colon-space-after": "always", + "number-leading-zero": "always", + "function-url-quotes": "always", + "font-family-name-quotes": "always-unless-keyword", + "comment-whitespace-inside": "always", + "comment-empty-line-before": "always", + "rule-empty-line-before": "always-multi-line", + "selector-pseudo-element-colon-notation": "single", + "selector-pseudo-class-parentheses-space-inside": "never", + "selector-max-type": 3, + "font-family-no-missing-generic-family-keyword": true, + "at-rule-no-unknown": null, + "scss/at-rule-no-unknown": true, + "media-feature-range-operator-space-before": "always", + "media-feature-range-operator-space-after": "always", + "media-feature-parentheses-space-inside": "never", + "media-feature-colon-space-before": "never", + "media-feature-colon-space-after": "always", + "selector-pseudo-element-no-unknown": [ + true, + { + "ignorePseudoElements": ["v-deep"] + } + ] + } +} diff --git a/web/storagenode/.stylelintrc.json b/web/storagenode/.stylelintrc.json deleted file mode 100644 index 12061ab10..000000000 --- a/web/storagenode/.stylelintrc.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "env": { - "es2020": true, - "node": true, - "jest": true - }, - "plugins": [ - "stylelint-scss" - ], - "extends": "stylelint-config-standard", - "rules": { - "indentation": 4, - "string-quotes": "single", - "no-duplicate-selectors": true, - "selector-max-attribute": 1, - "selector-combinator-space-after": "always", - "selector-attribute-operator-space-before": "never", - "selector-attribute-operator-space-after": "never", - "selector-attribute-brackets-space-inside": "never", - "declaration-block-trailing-semicolon": "always", - "declaration-colon-space-before": "never", - "declaration-colon-space-after": "always", - "number-leading-zero": "always", - "function-url-quotes": "always", - "font-family-name-quotes": "always-unless-keyword", - "comment-whitespace-inside": "always", - "comment-empty-line-before": "always", - "rule-empty-line-before": "always-multi-line", - "selector-pseudo-element-colon-notation": "single", - "selector-pseudo-class-parentheses-space-inside": "never", - "selector-max-type": 1, - "font-family-no-missing-generic-family-keyword": true, - "at-rule-no-unknown": null, - "scss/at-rule-no-unknown": true, - "media-feature-range-operator-space-before": "always", - "media-feature-range-operator-space-after": "always", - "media-feature-parentheses-space-inside": "never", - "media-feature-colon-space-before": "never", - "media-feature-colon-space-after": "always", - "selector-pseudo-element-no-unknown": [ - true, - { - "ignorePseudoElements": ["v-deep"] - } - ] - } -} diff --git a/web/storagenode/package.json b/web/storagenode/package.json index 092212536..f2179e678 100644 --- a/web/storagenode/package.json +++ b/web/storagenode/package.json @@ -4,7 +4,8 @@ "private": true, "scripts": { "serve": "vue-cli-service serve", - "lint": "vue-cli-service lint && stylelint \"**/*.{vue,scss}\" --fix", + "lint": "vue-cli-service lint --max-warnings 0 && stylelint --max-warnings 0 \"**/*.{vue,css,sss,less,scss,sass}\" --fix", + "lint-ci": "vue-cli-service lint --max-warnings 0 --no-fix && stylelint --max-warnings 0 --no-fix \"**/*.{vue,css,sss,less,scss,sass}\"", "build": "vue-cli-service build", "dev": "vue-cli-service build --mode development --watch", "test": "vue-cli-service test:unit" diff --git a/web/storagenode/src/app/components/BandwidthChart.vue b/web/storagenode/src/app/components/BandwidthChart.vue index 11a6d15a7..f832ff90e 100644 --- a/web/storagenode/src/app/components/BandwidthChart.vue +++ b/web/storagenode/src/app/components/BandwidthChart.vue @@ -20,8 +20,7 @@ import { Component } from 'vue-property-decorator'; import BaseChart from '@/app/components/BaseChart.vue'; -import { ChartData } from '@/app/types/chartData'; -import { Tooltip, TooltipParams } from '@/app/types/tooltip'; +import { ChartData, Tooltip, TooltipParams, TooltipModel } from '@/app/types/chart'; import { ChartUtils } from '@/app/utils/chart'; import { Size } from '@/private/memory/size'; import { BandwidthUsed } from '@/storagenode/sno/sno'; @@ -81,7 +80,7 @@ export default class BandwidthChart extends BaseChart { return new ChartData(daysCount, chartBackgroundColor, chartBorderColor, chartBorderWidth, data); } - public bandwidthTooltip(tooltipModel: any): void { + public bandwidthTooltip(tooltipModel: TooltipModel): void { const tooltipParams = new TooltipParams(tooltipModel, 'bandwidth-chart', 'bandwidth-tooltip', 'bandwidth-tooltip-arrow', 'bandwidth-tooltip-point', this.tooltipMarkUp(tooltipModel), 303, 125, 35, 24, 6, 4, `#1f49a3`); @@ -89,7 +88,7 @@ export default class BandwidthChart extends BaseChart { Tooltip.custom(tooltipParams); } - private tooltipMarkUp(tooltipModel: any): string { + private tooltipMarkUp(tooltipModel: TooltipModel): string { if (!tooltipModel.dataPoints) { return ''; } diff --git a/web/storagenode/src/app/components/DiskSpaceChart.vue b/web/storagenode/src/app/components/DiskSpaceChart.vue index ec38e0810..34705de35 100644 --- a/web/storagenode/src/app/components/DiskSpaceChart.vue +++ b/web/storagenode/src/app/components/DiskSpaceChart.vue @@ -20,8 +20,7 @@ import { Component } from 'vue-property-decorator'; import BaseChart from '@/app/components/BaseChart.vue'; -import { ChartData } from '@/app/types/chartData'; -import { Tooltip, TooltipParams } from '@/app/types/tooltip'; +import { ChartData, Tooltip, TooltipParams, TooltipModel } from '@/app/types/chart'; import { ChartUtils } from '@/app/utils/chart'; import { Size } from '@/private/memory/size'; import { Stamp } from '@/storagenode/sno/sno'; @@ -73,7 +72,7 @@ export default class DiskSpaceChart extends BaseChart { return new ChartData(daysCount, chartBackgroundColor, chartBorderColor, chartBorderWidth, data); } - public diskSpaceTooltip(tooltipModel): void { + public diskSpaceTooltip(tooltipModel: TooltipModel): void { const tooltipParams = new TooltipParams(tooltipModel, 'disk-space-chart', 'disk-space-tooltip', 'disk-space-tooltip-arrow', 'disk-space-tooltip-point', this.tooltipMarkUp(tooltipModel), 125, 89, 38, 24, 6, 4, `#1f49a3`); @@ -81,7 +80,7 @@ export default class DiskSpaceChart extends BaseChart { Tooltip.custom(tooltipParams); } - private tooltipMarkUp(tooltipModel: any): string { + private tooltipMarkUp(tooltipModel: TooltipModel): string { if (!tooltipModel.dataPoints) { return ''; } diff --git a/web/storagenode/src/app/components/DiskStatChart.vue b/web/storagenode/src/app/components/DiskStatChart.vue index bdb48b750..635f928aa 100644 --- a/web/storagenode/src/app/components/DiskStatChart.vue +++ b/web/storagenode/src/app/components/DiskStatChart.vue @@ -44,10 +44,7 @@ import { Component, Vue } from 'vue-property-decorator'; import DoughnutChart from '@/app/components/DoughnutChart.vue'; -import { - DiskStatChartData, - DiskStatDataSet, -} from '@/app/types/chartData'; +import {DiskStatChartData, DiskStatDataSet} from '@/app/types/chart'; import { Traffic } from '@/storagenode/sno/sno'; @Component({ diff --git a/web/storagenode/src/app/components/DoughnutChart.vue b/web/storagenode/src/app/components/DoughnutChart.vue index 5fb71fab4..33b7c5fec 100644 --- a/web/storagenode/src/app/components/DoughnutChart.vue +++ b/web/storagenode/src/app/components/DoughnutChart.vue @@ -4,19 +4,18 @@