fix: conventions

pull/556/head
Webber 2023-08-20 17:57:34 +02:00
parent be6d1ab351
commit 94795b4666
6 changed files with 59 additions and 18 deletions

View File

@ -1,11 +1,22 @@
{ {
"plugins": ["jest", "@typescript-eslint", "prettier", "unicorn"], "plugins": [
"extends": ["plugin:unicorn/recommended", "plugin:github/recommended", "plugin:prettier/recommended"], "jest",
"@typescript-eslint",
"prettier",
"unicorn"
],
"extends": [
"plugin:unicorn/recommended",
"plugin:github/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "parserOptions": {
"ecmaVersion": 2020, "ecmaVersion": 2020,
"sourceType": "module", "sourceType": "module",
"extraFileExtensions": [".mjs"], "extraFileExtensions": [
".mjs"
],
"ecmaFeatures": { "ecmaFeatures": {
"impliedStrict": true "impliedStrict": true
}, },
@ -22,7 +33,10 @@
// Namespaces or sometimes needed // Namespaces or sometimes needed
"import/no-namespace": "off", "import/no-namespace": "off",
// Properly format comments // Properly format comments
"spaced-comment": ["error", "always"], "spaced-comment": [
"error",
"always"
],
"lines-around-comment": [ "lines-around-comment": [
"error", "error",
{ {
@ -38,14 +52,31 @@
// Mandatory spacing // Mandatory spacing
"padding-line-between-statements": [ "padding-line-between-statements": [
"error", "error",
{ "blankLine": "always", "prev": "*", "next": "return" }, {
{ "blankLine": "always", "prev": "directive", "next": "*" }, "blankLine": "always",
{ "blankLine": "any", "prev": "directive", "next": "directive" } "prev": "*",
"next": "return"
},
{
"blankLine": "always",
"prev": "directive",
"next": "*"
},
{
"blankLine": "any",
"prev": "directive",
"next": "directive"
}
], ],
// Enforce camelCase // Enforce camelCase
"camelcase": "error", "camelcase": "error",
// Allow forOfStatements // Allow forOfStatements
"no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"], "no-restricted-syntax": [
"error",
"ForInStatement",
"LabeledStatement",
"WithStatement"
],
// Continue is viable in forOf loops in generators // Continue is viable in forOf loops in generators
"no-continue": "off", "no-continue": "off",
// From experience, named exports are almost always desired. I got tired of this rule // From experience, named exports are almost always desired. I got tired of this rule
@ -53,8 +84,17 @@
// Unused vars are useful to keep method signatures consistent and documented // Unused vars are useful to keep method signatures consistent and documented
"@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "off",
// For this project only use kebab-case // For this project only use kebab-case
"unicorn/filename-case": ["error", { "cases": { "kebabCase": true } }], "unicorn/filename-case": [
"error",
{
"cases": {
"kebabCase": true
}
}
],
// Allow Array.from(set) mitigate TS2569 which would require '--downlevelIteration' // Allow Array.from(set) mitigate TS2569 which would require '--downlevelIteration'
"unicorn/prefer-spread": "off" "unicorn/prefer-spread": "off",
// Temp disable to prevent mixing changes with other PRs
"i18n-text/no-en": "off"
} }
} }

10
dist/index.js generated vendored
View File

@ -3812,7 +3812,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const async_wait_until_1 = __importDefault(__nccwpck_require__(41299)); const async_wait_until_1 = __nccwpck_require__(41299);
const core = __importStar(__nccwpck_require__(42186)); const core = __importStar(__nccwpck_require__(42186));
const k8s = __importStar(__nccwpck_require__(89679)); const k8s = __importStar(__nccwpck_require__(89679));
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(42864)); const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(42864));
@ -3853,7 +3853,7 @@ class KubernetesStorage {
try { try {
cloud_runner_logger_1.default.log(`watch Until PVC Not Pending ${name} ${namespace}`); cloud_runner_logger_1.default.log(`watch Until PVC Not Pending ${name} ${namespace}`);
cloud_runner_logger_1.default.log(`${await this.getPVCPhase(kubeClient, name, namespace)}`); cloud_runner_logger_1.default.log(`${await this.getPVCPhase(kubeClient, name, namespace)}`);
await (0, async_wait_until_1.default)(async () => { await (0, async_wait_until_1.waitUntil)(async () => {
return (await this.getPVCPhase(kubeClient, name, namespace)) === 'Pending'; return (await this.getPVCPhase(kubeClient, name, namespace)) === 'Pending';
}, { }, {
timeout: 750000, timeout: 750000,
@ -3909,7 +3909,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(42864)); const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(42864));
const async_wait_until_1 = __importDefault(__nccwpck_require__(41299)); const async_wait_until_1 = __nccwpck_require__(41299);
const cloud_runner_system_1 = __nccwpck_require__(4197); const cloud_runner_system_1 = __nccwpck_require__(4197);
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144)); const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
const kubernetes_pods_1 = __importDefault(__nccwpck_require__(90740)); const kubernetes_pods_1 = __importDefault(__nccwpck_require__(90740));
@ -3988,7 +3988,7 @@ class KubernetesTaskRunner {
let success = false; let success = false;
let message = ``; let message = ``;
cloud_runner_logger_1.default.log(`Watching ${podName} ${namespace}`); cloud_runner_logger_1.default.log(`Watching ${podName} ${namespace}`);
await (0, async_wait_until_1.default)(async () => { await (0, async_wait_until_1.waitUntil)(async () => {
const status = await kubeClient.readNamespacedPodStatus(podName, namespace); const status = await kubeClient.readNamespacedPodStatus(podName, namespace);
const phase = status?.body.status?.phase; const phase = status?.body.status?.phase;
success = phase === 'Running'; success = phase === 'Running';
@ -6342,7 +6342,7 @@ class ImageTag {
const isCloudRunnerLocal = cloudRunnerBuilderPlatform === 'local' || cloudRunnerBuilderPlatform === undefined; const isCloudRunnerLocal = cloudRunnerBuilderPlatform === 'local' || cloudRunnerBuilderPlatform === undefined;
this.builderPlatform = ImageTag.getTargetPlatformToTargetPlatformSuffixMap(targetPlatform, editorVersion); this.builderPlatform = ImageTag.getTargetPlatformToTargetPlatformSuffixMap(targetPlatform, editorVersion);
this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes(isCloudRunnerLocal ? process.platform : cloudRunnerBuilderPlatform); this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes(isCloudRunnerLocal ? process.platform : cloudRunnerBuilderPlatform);
this.imageRollingVersion = 1; // Will automatically roll to the latest non-breaking version. this.imageRollingVersion = 2; // Will automatically roll to the latest non-breaking version.
} }
static get versionPattern() { static get versionPattern() {
return /^(20\d{2}\.\d\.\w{3,4}|3)$/; return /^(20\d{2}\.\d\.\w{3,4}|3)$/;

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import waitUntil from 'async-wait-until'; import { waitUntil } from 'async-wait-until';
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as k8s from '@kubernetes/client-node'; import * as k8s from '@kubernetes/client-node';
import BuildParameters from '../../../build-parameters'; import BuildParameters from '../../../build-parameters';

View File

@ -1,6 +1,6 @@
import { CoreV1Api, KubeConfig } from '@kubernetes/client-node'; import { CoreV1Api, KubeConfig } from '@kubernetes/client-node';
import CloudRunnerLogger from '../../services/core/cloud-runner-logger'; import CloudRunnerLogger from '../../services/core/cloud-runner-logger';
import waitUntil from 'async-wait-until'; import { waitUntil } from 'async-wait-until';
import { CloudRunnerSystem } from '../../services/core/cloud-runner-system'; import { CloudRunnerSystem } from '../../services/core/cloud-runner-system';
import CloudRunner from '../../cloud-runner'; import CloudRunner from '../../cloud-runner';
import KubernetesPods from './kubernetes-pods'; import KubernetesPods from './kubernetes-pods';
@ -10,6 +10,7 @@ class KubernetesTaskRunner {
static lastReceivedTimestamp: number = 0; static lastReceivedTimestamp: number = 0;
static readonly maxRetry: number = 3; static readonly maxRetry: number = 3;
static lastReceivedMessage: string = ``; static lastReceivedMessage: string = ``;
static async runTask( static async runTask(
kubeConfig: KubeConfig, kubeConfig: KubeConfig,
kubeClient: CoreV1Api, kubeClient: CoreV1Api,