Skip to content

Commit

Permalink
Support '1' in addition to 'true' in env var boolean values.
Browse files Browse the repository at this point in the history
  • Loading branch information
iclanton committed Mar 20, 2024
1 parent b7ab99e commit adff2fa
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export function shouldBulkSuppress(params: {
};
}

return process.env[ESLINT_BULK_PRUNE_ENV_VAR_NAME] !== 'true' && currentNodeIsSuppressed;
return process.env[ESLINT_BULK_PRUNE_ENV_VAR_NAME] !== '1' && currentNodeIsSuppressed;
}

export function prune(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function pruneAsync(): Promise<void> {
throw new Error(`@rushstack/eslint-bulk: Unknown arguments: ${args.join(' ')}`);
}

process.env[ESLINT_BULK_PRUNE_ENV_VAR_NAME] = 'true';
process.env[ESLINT_BULK_PRUNE_ENV_VAR_NAME] = '1';

await runEslintAsync(['.'], 'prune');
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ export function generatePatchedLinterJsFileIfDoesNotExist(
inputFilePath: string,
outputFilePath: string
): void {
if (
process.env[ESLINT_BULK_FORCE_REGENERATE_PATCH_ENV_VAR_NAME] !== 'true' &&
fs.existsSync(outputFilePath)
) {
const generateEnvVarValue: string | undefined =
process.env[ESLINT_BULK_FORCE_REGENERATE_PATCH_ENV_VAR_NAME];
if (generateEnvVarValue !== 'true' && generateEnvVarValue !== '1' && fs.existsSync(outputFilePath)) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion eslint/eslint-patch/src/eslint-bulk-suppressions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ if (!eslintFolder) {
process.exit(1);
}

if (process.env[ESLINT_BULK_DETECT_ENV_VAR_NAME] === 'true') {
const eslintBulkDetectEnvVarValue: string | undefined = process.env[ESLINT_BULK_DETECT_ENV_VAR_NAME];
if (eslintBulkDetectEnvVarValue === 'true' || eslintBulkDetectEnvVarValue === '1') {
findAndConsoleLogPatchPathCli();
process.exit(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ interface IConfiguration {
const CURRENT_PACKAGE_VERSION: string = currentPackageJson.version;

export function findAndConsoleLogPatchPathCli(): void {
if (process.env[ESLINT_BULK_DETECT_ENV_VAR_NAME] !== 'true') {
const eslintBulkDetectEnvVarValue: string | undefined = process.env[ESLINT_BULK_DETECT_ENV_VAR_NAME];
if (eslintBulkDetectEnvVarValue !== 'true' && eslintBulkDetectEnvVarValue !== '1') {
return;
}

Expand Down

0 comments on commit adff2fa

Please sign in to comment.