chore: configure project wide linter (#577)

* chore(lint): configure project-wide linter

* chore(lint): improve linting in files

* chore(lint): hide warnings in CI
This commit is contained in:
Carlos Valente
2023-11-07 22:30:39 +01:00
committed by GitHub
parent 943dd19c09
commit 2c47d90f34
38 changed files with 138 additions and 171 deletions
-15
View File
@@ -2,23 +2,8 @@
"env": {
"node": true
},
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"plugins": ["@typescript-eslint", "prettier"],
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"rules": {
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
}
}
+1 -1
View File
@@ -52,7 +52,7 @@
"build:local": "pnpm prebuild && esbuild src/index.ts --log-level=error --platform=node --format=cjs --bundle --minify --outfile=dist/index.cjs",
"build:docker": "pnpm prebuild && esbuild src/index.ts --log-level=error --platform=node --format=cjs --minify --bundle --outfile=dist/docker.cjs",
"build:debug": "pnpm prebuild && esbuild src/app.ts --platform=node --format=cjs --bundle --outfile=dist/index.cjs",
"lint": "eslint .",
"lint": "eslint . --quiet",
"test": "cross-env IS_TEST=true vitest",
"test:pipeline": "cross-env IS_TEST=true vitest run",
"typecheck": "tsc --noEmit",
@@ -30,7 +30,7 @@ const whitelistedPayload = {
};
export function parse(field: string, value: unknown) {
if (!whitelistedPayload.hasOwnProperty(field)) {
if (!Object.hasOwn(whitelistedPayload, field)) {
throw new Error(`Field ${field} not permitted`);
}
const parserFn = whitelistedPayload[field];
@@ -51,7 +51,7 @@ export function updateEvent(
const event = EventLoader.getEventWithId(eventId);
if (event) {
let propertiesToUpdate = { [propertyName]: newValue };
const propertiesToUpdate = { [propertyName]: newValue };
// Handles the special case for duration
// needs to be converted to milliseconds
@@ -14,7 +14,7 @@ export function dispatchFromAdapter(
payload: unknown;
params?: Array<string>;
},
source?: 'osc' | 'ws',
_source?: 'osc' | 'ws',
) {
const payload = args.payload;
const typeComponents = type.toLowerCase().split('/');
@@ -1,6 +1,7 @@
/* eslint-disable no-console -- we are mocking the console */
import { vi } from 'vitest';
import { EndAction, TimerType } from 'ontime-types';
import { EndAction, OntimeEvent, TimerType } from 'ontime-types';
import { dbModel } from '../../models/dataModel.js';
import { parseExcel, parseJson, validateEvent } from '../parser.js';