diff --git a/.eslintrc.json b/.eslintrc.json index 9f2b75c5..d74c442f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,15 @@ { "plugins": ["jest", "@typescript-eslint", "prettier", "unicorn"], - "extends": ["plugin:unicorn/recommended", "plugin:github/recommended", "prettier"], + "extends": ["plugin:unicorn/recommended", "plugin:github/recommended", "plugin:prettier/recommended"], "parser": "@typescript-eslint/parser", "parserOptions": { - "ecmaVersion": 9, - "sourceType": "module" + "ecmaVersion": 2020, + "sourceType": "module", + "extraFileExtensions": [".mjs"], + "ecmaFeatures": { + "impliedStrict": true + }, + "project": "./tsconfig.json" }, "env": { "node": true, @@ -15,6 +20,17 @@ "prettier/prettier": "error", "import/no-extraneous-dependencies": 0, "import/no-namespace": "off", - "no-undef": "off" // TODO: REMOVE THIS LINE WHEN UPDATING ESLINT RULES + // Allow forOfStatements + "no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"], + // Continue is viable in forOf loops in generators + "no-continue": "off", + // From experience, named exports are almost always desired. I got tired of this rule + "import/prefer-default-export": "off", + // Unused vars are useful to keep method signatures consistent and documented + "@typescript-eslint/no-unused-vars": "off", + // For this project only use kebab-case + "unicorn/filename-case": ["error", { "cases": { "kebabCase": true } }], + // Allow Array.from(set) mitigate TS2569 which would require '--downlevelIteration' + "unicorn/prefer-spread": "off" } } diff --git a/package.json b/package.json index a9596179..d60ea916 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "author": "Webber ", "license": "MIT", "scripts": { - "prepare": "lefthook install", + "prepare": "lefthook install && npx husky uninstall -y", "build": "yarn && tsc && ncc build lib --source-map --license licenses.txt", "lint": "prettier --check \"src/**/*.{js,ts}\" && eslint src/**/*.ts", "format": "prettier --write \"src/**/*.{js,ts}\"", diff --git a/src/model/cloud-runner/providers/k8s/kubernetes-storage.ts b/src/model/cloud-runner/providers/k8s/kubernetes-storage.ts index 1ea8d904..36e4fafc 100644 --- a/src/model/cloud-runner/providers/k8s/kubernetes-storage.ts +++ b/src/model/cloud-runner/providers/k8s/kubernetes-storage.ts @@ -4,6 +4,7 @@ import * as k8s from '@kubernetes/client-node'; import BuildParameters from '../../../build-parameters'; import CloudRunnerLogger from '../../services/cloud-runner-logger'; import YAML from 'yaml'; +import { IncomingMessage } from 'http'; class KubernetesStorage { public static async createPersistentVolumeClaim( @@ -100,7 +101,7 @@ class KubernetesStorage { } private static async handleResult( - result: { response: import('http').IncomingMessage; body: k8s.V1PersistentVolumeClaim }, + result: { response: IncomingMessage; body: k8s.V1PersistentVolumeClaim }, kubeClient: k8s.CoreV1Api, namespace: string, pvcName: string, diff --git a/tsconfig.json b/tsconfig.json index c1ae307a..e8c9118c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,5 +9,5 @@ "noImplicitAny": false /* Re-enable after fixing compatibility */ /* Raise error on expressions and declarations with an implied 'any' type. */, "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ }, - "exclude": ["node_modules", "**/*.test.ts"] + "exclude": ["node_modules", "dist"] }