From 93c0c82dce1553250bc725c548e6ba179958282f Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Mon, 2 Dec 2024 01:35:57 -0600 Subject: [PATCH] Add lintSkip option --- packages/config/maintenance/lintConfigFiles.ts | 5 +++++ packages/config/src/devices/ParamInformation.ts | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/packages/config/maintenance/lintConfigFiles.ts b/packages/config/maintenance/lintConfigFiles.ts index 3066452754b9..18d4fa0ff5c1 100644 --- a/packages/config/maintenance/lintConfigFiles.ts +++ b/packages/config/maintenance/lintConfigFiles.ts @@ -1052,6 +1052,11 @@ Consider converting this parameter to unsigned using ${ // Check if any parameter has the lintSkip flag for duplicatedPartials const param = paramInformation.get({ parameter }); if (param?.lintSkip?.includes("duplicatedPartials")) { + addWarning( + file, + `Skipping "duplicatedPartials" lint check for parameter #${parameter} due to "lintSkip" configuration.`, + variant + ); return false; } return paramInformation.has({ parameter }); diff --git a/packages/config/src/devices/ParamInformation.ts b/packages/config/src/devices/ParamInformation.ts index 986cbb71eb30..a116eec4ca7b 100644 --- a/packages/config/src/devices/ParamInformation.ts +++ b/packages/config/src/devices/ParamInformation.ts @@ -164,6 +164,18 @@ Parameter #${parameterNumber}: allowManualEntry must be false or omitted!`, this.allowManualEntry = definition.allowManualEntry ?? (this.readOnly ? false : true); + if ( + definition.lintSkip != undefined + && (!isArray(definition.lintSkip) || !definition.lintSkip.every((rule: unknown) => typeof rule === "string")) + ) { + throwInvalidConfig( + "devices", + `packages/config/config/devices/${parent.filename}: +Parameter #${parameterNumber} has an invalid lintSkip property. It must be an array of strings.`, + ); + } + this.lintSkip = definition.lintSkip ?? []; + if ( isArray(definition.options) && !definition.options.every( @@ -200,6 +212,7 @@ Parameter #${parameterNumber}: options is malformed!`, public readonly readOnly?: true; public readonly writeOnly?: true; public readonly allowManualEntry: boolean; + public readonly lintSkip?: string[]; public readonly options: readonly ConditionalConfigOption[]; public readonly condition?: string; @@ -224,6 +237,7 @@ Parameter #${parameterNumber}: options is malformed!`, "readOnly", "writeOnly", "allowManualEntry", + "lintSkip", ]), options: evaluateDeep(this.options, deviceId, true), };