web/storagenode: switch to eslint, sass, bump deps

tslint has been deprecated so it's nice to switch to eslint.
Currently this uses a minimal eslint, to get things up and running.

node-sass requires C which does not work nicely on all platforms.

Change-Id: Icf12e375293e052befc2d0daeb23d73697ed6ded
This commit is contained in:
Egon Elbre 2021-08-02 20:39:56 +03:00
parent 5bb3836312
commit 80854ea921
42 changed files with 26699 additions and 18740 deletions

View File

@ -0,0 +1,27 @@
// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended',
'@vue/typescript/recommended',
],
parserOptions: {
ecmaVersion: 2020
},
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],
},
}

View File

@ -1,4 +1,9 @@
{
"env": {
"es2020": true,
"node": true,
"jest": true
},
"plugins": [
"stylelint-scss"
],
@ -31,6 +36,12 @@
"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"
"media-feature-colon-space-after": "always",
"selector-pseudo-element-no-unknown": [
true,
{
"ignorePseudoElements": ["v-deep"]
}
]
}
}

File diff suppressed because it is too large Load Diff

View File

@ -4,52 +4,53 @@
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"lint": "vue-cli-service lint && stylelint '**/*.{vue,scss}' --fix",
"lint": "vue-cli-service lint && stylelint \"**/*.{vue,scss}\" --fix",
"build": "vue-cli-service build",
"debug": "vue-cli-service build --mode development",
"dev": "vue-cli-service build --mode development --watch",
"test": "vue-cli-service test:unit"
},
"dependencies": {
"chart.js": "2.9.3",
"chart.js": "2.9.4",
"vue": "2.6.11",
"vue-chartjs": "3.5.0",
"vue-class-component": "7.2.2",
"vue-jest": "3.0.5",
"vue-chartjs": "3.5.1",
"vue-class-component": "7.2.6",
"vue-clipboard2": "0.3.1",
"vue-property-decorator": "8.3.0",
"vue-router": "3.1.5",
"vuex": "3.1.2"
"vue-property-decorator": "9.1.2",
"vue-router": "3.4.9",
"vuex": "3.6.0"
},
"devDependencies": {
"@babel/core": "7.8.4",
"@babel/core": "7.14.8",
"@babel/plugin-proposal-object-rest-spread": "7.8.3",
"@typescript-eslint/eslint-plugin": "4.28.5",
"@typescript-eslint/parser": "4.28.5",
"@types/segment-analytics": "0.0.32",
"@vue/cli-plugin-babel": "4.1.1",
"@vue/cli-plugin-typescript": "4.1.1",
"@vue/cli-plugin-eslint": "4.5.13",
"@vue/cli-plugin-typescript": "4.5.13",
"@vue/cli-plugin-unit-jest": "4.1.1",
"@vue/cli-service": "4.1.1",
"@vue/cli-service": "4.5.13",
"@vue/eslint-config-typescript": "7.0.0",
"@vue/test-utils": "1.0.0-beta.30",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"compression-webpack-plugin": "6.0.0",
"core-js": "3.6.5",
"eslint": "6.7.2",
"eslint-plugin-vue": "6.2.2",
"jest-fetch-mock": "3.0.0",
"node-sass": "4.14.1",
"sass": "1.37.0",
"sass-loader": "8.0.0",
"sinon": "7.5.0",
"stylelint": "13.3.3",
"stylelint": "13.7.1",
"stylelint-config-standard": "19.0.0",
"stylelint-scss": "3.13.0",
"stylelint-scss": "3.18.0",
"stylelint-webpack-plugin": "1.2.1",
"ts-jest": "25.5.0",
"tslint": "5.20.1",
"tslint-consistent-codestyle": "1.16.0",
"tslint-loader": "3.5.4",
"typescript": "3.7.4",
"vue-svg-loader": "0.15.0",
"vue-template-compiler": "2.6.11",
"vue-tslint": "0.3.2",
"vue-tslint-loader": "3.5.6",
"webpack": "4.41.5"
"vue-jest": "3.0.5",
"vue-svg-loader": "0.16.0",
"vue-template-compiler": "2.6.11"
},
"postcss": {
"plugins": {

View File

@ -44,7 +44,7 @@ export default class AllSatellitesAuditsArea extends Vue {
/**
* Number of score blocks displayed on page.
*/
public numberOfItemsOnPage: number = 6;
public numberOfItemsOnPage = 6;
/**
* Number of blocks added to displayed on page by clocking "Load more".
*/

View File

@ -24,7 +24,7 @@ export default class BaseChart extends Vue {
/**
* Used for chart re rendering.
*/
public chartKey: number = 0;
public chartKey = 0;
public $refs: {
chartContainer: HTMLElement;

View File

@ -40,7 +40,7 @@ export default class ChecksArea extends Vue {
/**
* Indicates if tooltip needs to be shown.
*/
public isTooltipVisible: boolean = false;
public isTooltipVisible = false;
/**
* Toggles tooltip visibility.

View File

@ -62,7 +62,7 @@ export default class DiskStatChart extends Vue {
public get chartData(): DiskStatChartData {
return new DiskStatChartData([
new DiskStatDataSet(
'',
'',
['#D6D6D6', '#0059D0', '#8FA7C6', '#2582FF'],
[
this.free,

View File

@ -15,7 +15,7 @@ export default class DoughnutChart extends Vue {
private readonly chartData: DiskStatChartData;
@Watch('chartData')
private onDataChange(news: object, old: object): void {
private onDataChange(news: Record<string, unknown>, old: Record<string, unknown>): void {
(this as any).renderChart(this.chartData, {
hover: false,
tooltips: {

View File

@ -31,7 +31,7 @@ export default class OptionsDropdown extends Vue {
/**
* Uses for switching mode.
*/
public isDarkMode: boolean = false;
public isDarkMode = false;
/**
* Lifecycle hook after initial render.

View File

@ -199,10 +199,10 @@ import { Dashboard, SatelliteInfo, SatelliteScores } from '@/storagenode/sno/sno
})
export default class SNOContentFilling extends Vue {
public readonly PAYOUT_PATH: string = RouteConfig.Payout.path;
public chartWidth: number = 0;
public chartHeight: number = 0;
public diskSpaceChartWidth: number = 0;
public diskSpaceChartHeight: number = 0;
public chartWidth = 0;
public chartHeight = 0;
public diskSpaceChartWidth = 0;
public diskSpaceChartHeight = 0;
public $refs: {
chart: HTMLElement;

View File

@ -256,7 +256,7 @@ export default class SNOContentTitle extends Vue {
color: #ce0000;
}
/deep/ .info__message-box {
::v-deep .info__message-box {
background-image: var(--info-image-arrow-left-path);
bottom: 100%;
left: 220%;

View File

@ -87,8 +87,8 @@ const {
},
})
export default class SNOHeader extends Vue {
public isNotificationPopupShown: boolean = false;
public isOptionsShown: boolean = false;
public isNotificationPopupShown = false;
public isOptionsShown = false;
private readonly FIRST_PAGE: number = 1;
/**

View File

@ -69,7 +69,7 @@ export default class SatelliteSelection extends Vue {
/**
* Indicates if name or id should be shown.
*/
public isNameShown: boolean = true;
public isNameShown = true;
/**
* Returns label depends on which satellite is selected.

View File

@ -113,7 +113,7 @@ export default class SatelliteSelectionDropdown extends Vue {
/**
* Fetches payout information depends on selected satellite.
*/
private async fetchPayoutInfo(id: string = ''): Promise<void> {
private async fetchPayoutInfo(id = ''): Promise<void> {
await this.$store.dispatch(APPSTATE_ACTIONS.TOGGLE_PAYOUT_CALENDAR, false);
await this.$store.dispatch(APPSTATE_ACTIONS.SET_NO_PAYOUT_DATA, false);

View File

@ -85,7 +85,7 @@ export default class SatelliteSelectionDropdownItem extends Vue {
/**
* Indicates if name or id should be shown.
*/
public isNameShown: boolean = true;
public isNameShown = true;
/**
* Toggles between name and id view.

View File

@ -41,7 +41,7 @@ export default class VChart extends Vue {
private readonly chartData: ChartData;
@Watch('chartData')
private onDataChange(news: object, old: object) {
private onDataChange(news: Record<string, unknown>, old: Record<string, unknown>) {
/**
* renderChart method is inherited from BaseChart which is extended by VChart.Line
*/
@ -55,7 +55,7 @@ export default class VChart extends Vue {
(this as any).renderChart(this.chartData, this.chartOptions);
}
public get chartOptions(): object {
public get chartOptions(): Record<string, unknown> {
const filterCallback = this.filterDaysDisplayed;
return {

View File

@ -27,8 +27,8 @@ declare interface MessageBoxStyle {
@Component
export default class VInfo extends Vue {
private isVisible: boolean = false;
private height: string = '5px';
private isVisible = false;
private height = '5px';
@Prop({default: ''})
private readonly text: string;

View File

@ -53,7 +53,7 @@ import { OnPageClickCallback, Page } from '@/app/types/pagination';
export default class VPagination extends Vue {
private readonly MAX_PAGES_PER_BLOCK: number = 3;
private readonly MAX_PAGES_OFF_BLOCKS: number = 6;
private currentPageNumber: number = 1;
private currentPageNumber = 1;
public isLoading = false;
public pagesArray: Page[] = [];
public firstBlockPages: Page[] = [];

View File

@ -26,7 +26,7 @@ export default class BaseSmallHeldHistoryTable extends Vue {
/**
* Indicates if held info should be rendered.
*/
public isExpanded: boolean = false;
public isExpanded = false;
/**
* Shows held info.

View File

@ -407,7 +407,7 @@ export default class EstimationArea extends Vue {
/**
* Indicates if tooltip needs to be shown.
*/
public isTooltipVisible: boolean = false;
public isTooltipVisible = false;
/**
* Toggles tooltip visibility.

View File

@ -50,7 +50,7 @@ export default class HeldHistoryArea extends Vue {
/**
* Indicates if All Stats state is active.
*/
public isAllStatsShown: boolean = true;
public isAllStatsShown = true;
/**
* Sets held history table state to All Stats.

View File

@ -57,7 +57,7 @@ export default class PayoutHistoryPeriodCalendar extends Vue {
*/
public currentDisplayedMonths: MonthButton[] = [];
public displayedYear: number = this.now.getUTCFullYear();
public period: string = '';
public period = '';
private displayedMonths: StoredMonthsByYear = {};
private selectedMonth: MonthButton | null;

View File

@ -128,7 +128,7 @@ export default class PayoutHistoryTableItem extends Vue {
/**
* Indicates if payout info should be rendered.
*/
public isExpanded: boolean = false;
public isExpanded = false;
/**
* Toggles additional payout information.

View File

@ -61,7 +61,7 @@ export default class PayoutPeriodCalendar extends Vue {
*/
public currentDisplayedMonths: MonthButton[] = [];
public displayedYear: number = this.now.getUTCFullYear();
public period: string = '';
public period = '';
private displayedMonths: StoredMonthsByYear = {};
private firstSelectedMonth: MonthButton | null = null;

View File

@ -42,7 +42,7 @@ export default class SingleInfo extends Vue {
/**
* Indicates if tooltip needs to be shown.
*/
public isTooltipVisible: boolean = false;
public isTooltipVisible = false;
/**
* Toggles tooltip visibility.

View File

@ -36,12 +36,12 @@ export class StoreModule<S> {
* storage node store (vuex)
*/
export const store = new Vuex.Store({
modules: {
node: newNodeModule(nodeService),
appStateModule,
notificationsModule: newNotificationsModule(notificationsService),
payoutModule: newPayoutModule(payoutService),
},
modules: {
node: newNodeModule(nodeService),
appStateModule,
notificationsModule: newNotificationsModule(notificationsService),
payoutModule: newPayoutModule(payoutService),
},
});
export default store;

View File

@ -37,7 +37,7 @@ const {
SET_DAILY_DATA,
} = NODE_MUTATIONS;
const STATUS_TRESHHOLD_MINUTES: number = 120;
const STATUS_TRESHHOLD_MINUTES = 120;
export function newNodeModule(service: StorageNodeService): StoreModule<StorageNodeState> {
return {

View File

@ -89,7 +89,7 @@ export function newPayoutModule(service: PayoutService): StoreModule<PayoutState
},
},
actions: {
[PAYOUT_ACTIONS.GET_PAYOUT_INFO]: async function ({ commit, state, rootState }: any, satelliteId: string = ''): Promise<void> {
[PAYOUT_ACTIONS.GET_PAYOUT_INFO]: async function ({ commit, state, rootState }: any, satelliteId = ''): Promise<void> {
const totalPaystubForPeriod = await service.paystubSummaryForPeriod(
state.periodRange.start,
state.periodRange.end,
@ -99,7 +99,7 @@ export function newPayoutModule(service: PayoutService): StoreModule<PayoutState
commit(PAYOUT_MUTATIONS.SET_HELD_PERCENT, getHeldPercentage(rootState.node.selectedSatellite.joinDate));
commit(PAYOUT_MUTATIONS.SET_PAYOUT_INFO, totalPaystubForPeriod);
},
[PAYOUT_ACTIONS.GET_TOTAL]: async function ({ commit, rootState }: any, satelliteId: string = ''): Promise<void> {
[PAYOUT_ACTIONS.GET_TOTAL]: async function ({ commit, rootState }: any, satelliteId = ''): Promise<void> {
const now = new Date();
const start = new PayoutPeriod(rootState.node.selectedSatellite.joinDate.getUTCFullYear(), rootState.node.selectedSatellite.joinDate.getUTCMonth());
const end = new PayoutPeriod(now.getUTCFullYear(), now.getUTCMonth());
@ -137,7 +137,7 @@ export function newPayoutModule(service: PayoutService): StoreModule<PayoutState
commit(PAYOUT_MUTATIONS.SET_HELD_HISTORY, heldHistory);
},
[PAYOUT_ACTIONS.GET_PERIODS]: async function ({commit}: any, satelliteId: string = ''): Promise<void> {
[PAYOUT_ACTIONS.GET_PERIODS]: async function ({commit}: any, satelliteId = ''): Promise<void> {
const periods = await service.availablePeriods(satelliteId);
commit(PAYOUT_MUTATIONS.SET_PERIODS, periods);
@ -146,7 +146,7 @@ export function newPayoutModule(service: PayoutService): StoreModule<PayoutState
commit(PAYOUT_MUTATIONS.SET_PAYOUT_HISTORY_AVAILABLE_PERIODS, periods);
}
},
[PAYOUT_ACTIONS.GET_ESTIMATION]: async function ({ commit }: any, satelliteId: string = ''): Promise<void> {
[PAYOUT_ACTIONS.GET_ESTIMATION]: async function ({ commit }: any, satelliteId = ''): Promise<void> {
const estimatedInfo = await service.estimatedPayout(satelliteId);
commit(PAYOUT_MUTATIONS.SET_ESTIMATION, estimatedInfo);

View File

@ -44,16 +44,16 @@ export class UINotification {
const differenceInSeconds = (Math.trunc(new Date().getTime()) - Math.trunc(new Date(this.createdAt).getTime())) / 1000;
switch (true) {
case differenceInSeconds < 60:
return 'Just now';
case differenceInSeconds < 3600:
return `${(differenceInSeconds / 60).toFixed(0)} minute(s) ago`;
case differenceInSeconds < 86400:
return `${(differenceInSeconds / 3600).toFixed(0)} hour(s) ago`;
case differenceInSeconds < 86400 * 2:
return `Yesterday`;
default:
return new Date(this.createdAt).toDateString();
case differenceInSeconds < 60:
return 'Just now';
case differenceInSeconds < 3600:
return `${(differenceInSeconds / 60).toFixed(0)} minute(s) ago`;
case differenceInSeconds < 86400:
return `${(differenceInSeconds / 3600).toFixed(0)} hour(s) ago`;
case differenceInSeconds < 86400 * 2:
return `Yesterday`;
default:
return new Date(this.createdAt).toDateString();
}
}
@ -69,17 +69,17 @@ export class UINotification {
*/
private setIcon(): void {
switch (this.type) {
case NotificationTypes.AuditCheckFailure:
this.icon = NotificationIcon.FAIL;
break;
case NotificationTypes.Disqualification:
this.icon = NotificationIcon.SOFTWARE_UPDATE;
break;
case NotificationTypes.Suspension:
this.icon = NotificationIcon.SUSPENDED;
break;
default:
this.icon = NotificationIcon.INFO;
case NotificationTypes.AuditCheckFailure:
this.icon = NotificationIcon.FAIL;
break;
case NotificationTypes.Disqualification:
this.icon = NotificationIcon.SOFTWARE_UPDATE;
break;
case NotificationTypes.Suspension:
this.icon = NotificationIcon.SUSPENDED;
break;
default:
this.icon = NotificationIcon.INFO;
}
}
}

View File

@ -27,10 +27,10 @@ export class StorageNodeState {
public egressChartData: EgressUsed[] = [];
public ingressChartData: IngressUsed[] = [];
public storageChartData: Stamp[] = [];
public storageSummary: number = 0;
public bandwidthSummary: number = 0;
public egressSummary: number = 0;
public ingressSummary: number = 0;
public storageSummary = 0;
public bandwidthSummary = 0;
public egressSummary = 0;
public ingressSummary = 0;
public satellitesScores: SatelliteScores[] = [];
public audits: SatelliteScores = new SatelliteScores();
}

View File

@ -20,18 +20,18 @@ export class ChartUtils {
let divider: number = SizeBreakpoints.PB;
switch (true) {
case maxBytes < SizeBreakpoints.MB:
divider = SizeBreakpoints.KB;
break;
case maxBytes < SizeBreakpoints.GB:
divider = SizeBreakpoints.MB;
break;
case maxBytes < SizeBreakpoints.TB:
divider = SizeBreakpoints.GB;
break;
case maxBytes < SizeBreakpoints.PB:
divider = SizeBreakpoints.TB;
break;
case maxBytes < SizeBreakpoints.MB:
divider = SizeBreakpoints.KB;
break;
case maxBytes < SizeBreakpoints.GB:
divider = SizeBreakpoints.MB;
break;
case maxBytes < SizeBreakpoints.TB:
divider = SizeBreakpoints.GB;
break;
case maxBytes < SizeBreakpoints.PB:
divider = SizeBreakpoints.TB;
break;
}
return data.map(elem => elem / divider);
@ -47,20 +47,20 @@ export class ChartUtils {
let dataDimension: string;
switch (true) {
case maxBytes < SizeBreakpoints.MB:
dataDimension = 'KB';
break;
case maxBytes < SizeBreakpoints.GB:
dataDimension = 'MB';
break;
case maxBytes < SizeBreakpoints.TB:
dataDimension = 'GB';
break;
case maxBytes < SizeBreakpoints.PB:
dataDimension = 'TB';
break;
default:
dataDimension = 'PB';
case maxBytes < SizeBreakpoints.MB:
dataDimension = 'KB';
break;
case maxBytes < SizeBreakpoints.GB:
dataDimension = 'MB';
break;
case maxBytes < SizeBreakpoints.TB:
dataDimension = 'GB';
break;
case maxBytes < SizeBreakpoints.PB:
dataDimension = 'TB';
break;
default:
dataDimension = 'PB';
}
return dataDimension;

View File

@ -45,4 +45,4 @@ export type LoadScriptOnSuccessCallback = () => void;
* LoadScriptOnErrorCallback describes signature of onError callback.
* @param err - error occurred during script loading.
*/
export type LoadScriptOnErrorCallback = (err: Error) => { };
export type LoadScriptOnErrorCallback = (err: Error) => any;

View File

@ -10,14 +10,14 @@ export function getHeldPercentage(startedAt: Date): number {
const monthsOnline = getMonthsBeforeNow(startedAt);
switch (true) {
case monthsOnline < 4:
return 75;
case monthsOnline < 7:
return 50;
case monthsOnline < 10:
return 25;
default:
return 0;
case monthsOnline < 4:
return 75;
case monthsOnline < 7:
return 50;
case monthsOnline < 10:
return 25;
default:
return 0;
}
}

View File

@ -27,20 +27,20 @@ export class Size {
const _size = Math.abs(size);
switch (true) {
case _size >= SizeBreakpoints.EB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.EB).toFixed(decimals))}EB`;
case _size >= SizeBreakpoints.PB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.PB).toFixed(decimals))}PB`;
case _size >= SizeBreakpoints.TB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.TB).toFixed(decimals))}TB`;
case _size >= SizeBreakpoints.GB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.GB).toFixed(decimals))}GB`;
case _size >= SizeBreakpoints.MB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.MB).toFixed(decimals))}MB`;
case _size >= SizeBreakpoints.KB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.KB).toFixed(decimals))}KB`;
default:
return `${size}B`;
case _size >= SizeBreakpoints.EB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.EB).toFixed(decimals))}EB`;
case _size >= SizeBreakpoints.PB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.PB).toFixed(decimals))}PB`;
case _size >= SizeBreakpoints.TB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.TB).toFixed(decimals))}TB`;
case _size >= SizeBreakpoints.GB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.GB).toFixed(decimals))}GB`;
case _size >= SizeBreakpoints.MB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.MB).toFixed(decimals))}MB`;
case _size >= SizeBreakpoints.KB * 2 / 3:
return `${parseFloat((size / SizeBreakpoints.KB).toFixed(decimals))}KB`;
default:
return `${size}B`;
}
}
}

View File

@ -53,7 +53,7 @@ export enum NotificationTypes {
* Describes page offset for pagination.
*/
export class NotificationsCursor {
private DEFAULT_LIMIT: number = 7;
private DEFAULT_LIMIT = 7;
public constructor(
public page: number = 0,

View File

@ -42,7 +42,7 @@ export interface PayoutApi {
/**
* Divider to convert payout amounts to cents.
*/
const PRICE_DIVIDER: number = 10000;
const PRICE_DIVIDER = 10000;
/**
* Represents payout period month and year.
@ -118,26 +118,26 @@ export class Paystub {
* Payout amounts converted to cents.
*/
export class TotalPaystubForPeriod {
public usageAtRest: number = 0;
public usageGet: number = 0;
public usagePut: number = 0;
public usageGetRepair: number = 0;
public usagePutRepair: number = 0;
public usageGetAudit: number = 0;
public compAtRest: number = 0;
public compGet: number = 0;
public compPut: number = 0;
public compGetRepair: number = 0;
public compPutRepair: number = 0;
public compGetAudit: number = 0;
public surgePercent: number = 0;
public held: number = 0;
public owed: number = 0;
public disposed: number = 0;
public paid: number = 0;
public paidWithoutSurge: number = 0;
public grossWithSurge: number = 0;
public distributed: number = 0;
public usageAtRest = 0;
public usageGet = 0;
public usagePut = 0;
public usageGetRepair = 0;
public usagePutRepair = 0;
public usageGetAudit = 0;
public compAtRest = 0;
public compGet = 0;
public compPut = 0;
public compGetRepair = 0;
public compPutRepair = 0;
public compGetAudit = 0;
public surgePercent = 0;
public held = 0;
public owed = 0;
public disposed = 0;
public paid = 0;
public paidWithoutSurge = 0;
public grossWithSurge = 0;
public distributed = 0;
public constructor(
paystubs: Paystub[] = [],
@ -175,12 +175,12 @@ export class TotalPaystubForPeriod {
* Holds accumulated held and earned payouts.
*/
export class TotalPayments {
public held: number = 0;
public paid: number = 0;
public disposed: number = 0;
public held = 0;
public paid = 0;
public disposed = 0;
// TODO: remove
public currentMonthEarnings: number = 0;
public balance: number = 0;
public currentMonthEarnings = 0;
public balance = 0;
public constructor(
paystubs: Paystub[] = [],

View File

@ -46,8 +46,8 @@ export class Traffic {
* Holds audit and suspension checks.
*/
export class Checks {
public audit: number = 0;
public suspension: number = 0;
public audit = 0;
public suspension = 0;
public constructor(
audit: Metric = new Metric(),
@ -115,7 +115,7 @@ export class Stamp {
public atRestTotal: number;
public intervalStart: Date;
public constructor(atRestTotal: number = 0, intervalStart: Date = new Date()) {
public constructor(atRestTotal = 0, intervalStart: Date = new Date()) {
this.atRestTotal = atRestTotal;
this.intervalStart = intervalStart;
}
@ -291,16 +291,16 @@ export class SatelliteScores {
public auditScore: Score;
public suspensionScore: Score;
public onlineScore: Score;
public iconClassName: string = '';
public iconClassName = '';
private readonly WARNING_CLASSNAME: string = 'warning';
private readonly DISQUALIFICATION_CLASSNAME: string = 'disqualification';
public constructor(
public satelliteName: string = 'satellite-name',
auditScore: number = 0,
unknownScore: number = 0,
onlineScore: number = 0,
auditScore = 0,
unknownScore = 0,
onlineScore = 0,
) {
this.auditScore = new Score(auditScore);
this.suspensionScore = new Score(unknownScore);
@ -332,21 +332,21 @@ export class Score {
private readonly DISQUALIFICATION_CLASSNAME: string = 'disqualification';
public constructor(
score: number = 0,
score = 0,
) {
this.label = `${parseFloat((score * 100).toFixed(2))} %`;
switch (true) {
case (score < this.DISQUALIFICATION_MINIMUM_SCORE):
this.statusClassName = this.DISQUALIFICATION_CLASSNAME;
case (score < this.DISQUALIFICATION_MINIMUM_SCORE):
this.statusClassName = this.DISQUALIFICATION_CLASSNAME;
break;
case (score < this.WARNING_MINIMUM_SCORE):
this.statusClassName = this.WARNING_CLASSNAME;
break;
case (score < this.WARNING_MINIMUM_SCORE):
this.statusClassName = this.WARNING_CLASSNAME;
break;
default:
this.statusClassName = '';
break;
default:
this.statusClassName = '';
}
}
}

View File

@ -49,7 +49,7 @@ export class HttpClient {
* @param body serialized JSON
* @param auth indicates if authentication is needed
*/
public async put(path: string, body: string | null, auth: boolean = true): Promise<Response> {
public async put(path: string, body: string | null, auth = true): Promise<Response> {
return this.sendJSON('PUT', path, body);
}
@ -58,7 +58,7 @@ export class HttpClient {
* @param path
* @param auth indicates if authentication is needed
*/
public async get(path: string, auth: boolean = true): Promise<Response> {
public async get(path: string, auth = true): Promise<Response> {
return this.sendJSON('GET', path, null);
}
@ -67,7 +67,7 @@ export class HttpClient {
* @param path
* @param auth indicates if authentication is needed
*/
public async delete(path: string, auth: boolean = true): Promise<Response> {
public async delete(path: string, auth = true): Promise<Response> {
return this.sendJSON('DELETE', path, null);
}
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
declare var global: any;
declare let global: any;

View File

@ -71,7 +71,7 @@ describe('mutations', () => {
it('selects single satellite', () => {
const satelliteInfo = new Satellite(
'3',
[new Stamp()],
[new Stamp()],
[],
[],
[],

View File

@ -1,97 +0,0 @@
{
"defaultSeverity": "warning",
"rulesDirectory": [
"tslint-consistent-codestyle"
],
"linterOptions": {
"exclude": [
"node_modules/**"
]
},
"rules": {
"function-constructor": true,
"align": [true, "parameters", "statements"],
"array-type": [true, "array-simple"],
"arrow-return-shorthand": true,
"class-name": true,
"comment-format": [true, "check-space"],
"comment-type": [true, "doc", "singleline"],
"curly": [true, "ignore-same-line"],
"early-exit": true,
"eofline": true,
"indent": [true, "spaces", 4],
"interface-name": false,
"import-spacing": true,
"no-async-without-await": true,
"no-boolean-literal-compare": true,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": [true, 1],
"no-console": [true, "log"],
"no-default-export": false,
"no-duplicate-imports": true,
"no-duplicate-super": true,
"no-duplicate-switch-case": true,
"no-empty": true,
"no-eval": true,
"no-invalid-template-strings": true,
"no-invalid-this": true,
"no-misused-new": true,
"no-static-this": true,
"no-trailing-whitespace": true,
"no-var-keyword": true,
"newline-before-return": true,
"object-literal-sort-keys": false,
"one-variable-per-declaration": [true, "ignore-for-loop"],
"ordered-imports": [
true, {
"import-sources-order": "case-insensitive",
"named-imports-order": "case-insensitive",
"grouped-imports": true,
"groups": [{
"name": "external",
"match": "^[A-Za-z]",
"order": 1
}, {
"name": "internal components",
"match": "^@/app/components",
"order": 2
}, {
"name": "internal images",
"match": "^@/../static/images",
"order": 3
}, {
"name": "internal else",
"match": "^@",
"order": 4
}]
}],
"prefer-const": true,
"prefer-method-signature": true,
"prefer-switch": [true, {"min-cases": 2}],
"prefer-while": true,
"quotemark": [true, "single", "avoid-escape"],
"semicolon": [true, "always"],
"space-within-parens": 0,
"static-this": true,
"trailing-comma": [true, {"multiline": "always", "singleline": "never"}],
"triple-equals": true,
"typedef": [
true,
"property-declaration"
],
"type-literal-delimiter": true,
"unnecessary-else": true,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-module",
"check-operator",
"check-preblock",
"check-rest-spread",
"check-separator",
"check-type",
"check-type-operator"
]
}
}