Skip to content

Commit

Permalink
Add lintSkip option
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjohnsontv committed Dec 2, 2024
1 parent d2c4667 commit 93c0c82
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/config/maintenance/lintConfigFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
14 changes: 14 additions & 0 deletions packages/config/src/devices/ParamInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand All @@ -224,6 +237,7 @@ Parameter #${parameterNumber}: options is malformed!`,
"readOnly",
"writeOnly",
"allowManualEntry",
"lintSkip",
]),
options: evaluateDeep(this.options, deviceId, true),
};
Expand Down

0 comments on commit 93c0c82

Please sign in to comment.