Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(prettier): Force trailing commas #25631

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
singleQuote: true
trailingComma: "es5"
trailingComma: "all"
14 changes: 7 additions & 7 deletions docs/development/zod.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const ApiResults = z.array(
z.object({
id: z.number(),
value: z.string(),
})
}),
);
type ApiResults = z.infer<typeof ApiResults>;

Expand All @@ -155,8 +155,8 @@ const ApiResults = Json.pipe(
z.object({
id: z.number(),
value: z.string(),
})
)
}),
),
);

const results = ApiResults.parse(input);
Expand Down Expand Up @@ -269,10 +269,10 @@ const Versions = z
version: z.string(),
})
.nullable()
.catch(null)
.catch(null),
)
.transform((releases) =>
releases.filter((x): x is { version: string } => x !== null)
releases.filter((x): x is { version: string } => x !== null),
);
```

Expand All @@ -284,7 +284,7 @@ Instead, you should use the `LooseArray` and `LooseRecord` helpers from `schema-
const Versions = LooseArray(
z.object({
version: z.string(),
})
}),
);
```

Expand Down Expand Up @@ -339,7 +339,7 @@ const Users = z.object({

const { body: users } = await http.getJson(
'https://dummyjson.com/users',
LooseArray(User)
LooseArray(User),
);
```

Expand Down
8 changes: 4 additions & 4 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function normalizePattern(pattern: string, suffix: '.ts' | '.spec.ts'): string {
* Otherwise, `fallback` value is used to determine some defaults.
*/
function configureShardingOrFallbackTo(
fallback: JestShardedSubconfig
fallback: JestShardedSubconfig,
): JestShardedSubconfig {
const shardKey = process.env.TEST_SHARD;
if (!shardKey) {
Expand All @@ -163,7 +163,7 @@ function configureShardingOrFallbackTo(
if (!testShards[shardKey]) {
const keys = Object.keys(testShards).join(', ');
throw new Error(
`Unknown value for TEST_SHARD: ${shardKey} (possible values: ${keys})`
`Unknown value for TEST_SHARD: ${shardKey} (possible values: ${keys})`,
);
}

Expand Down Expand Up @@ -301,7 +301,7 @@ function getMatchingShards(files: string[]): string[] {
const patterns = matchPaths.map((path) =>
path.endsWith('.spec.ts')
? path.replace(/\.spec\.ts$/, '{.ts,.spec.ts}')
: `${path}/**/*`
: `${path}/**/*`,
);

if (patterns.some((pattern) => minimatch(file, pattern))) {
Expand All @@ -326,7 +326,7 @@ function scheduleItems<T>(items: T[], availableInstances: number): T[][] {
: items.length % numInstances;

const partitionSizes = Array.from({ length: numInstances }, (_, idx) =>
idx < lighterInstancesIdx ? maxPerInstance : maxPerInstance - 1
idx < lighterInstancesIdx ? maxPerInstance : maxPerInstance - 1,
);

const result: T[][] = Array.from({ length: numInstances }, () => []);
Expand Down
14 changes: 7 additions & 7 deletions lib/config-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function validate(
desc: string,
config: RenovateConfig,
strict: boolean,
isPreset = false
isPreset = false,
): Promise<void> {
const { isMigrated, migratedConfig } = migrateConfig(config);
if (isMigrated) {
Expand All @@ -29,7 +29,7 @@ async function validate(
oldConfig: config,
newConfig: migratedConfig,
},
'Config migration necessary'
'Config migration necessary',
);
if (strict) {
returnVal = 1;
Expand All @@ -40,14 +40,14 @@ async function validate(
if (res.errors.length) {
logger.error(
{ file: desc, errors: res.errors },
'Found errors in configuration'
'Found errors in configuration',
);
returnVal = 1;
}
if (res.warnings.length) {
logger.warn(
{ file: desc, warnings: res.warnings },
'Found errors in configuration'
'Found errors in configuration',
);
returnVal = 1;
}
Expand Down Expand Up @@ -87,7 +87,7 @@ type PackageJson = {
}
} else {
for (const file of configFileNames.filter(
(name) => name !== 'package.json'
(name) => name !== 'package.json',
)) {
try {
if (!(await pathExists(file))) {
Expand All @@ -108,7 +108,7 @@ type PackageJson = {
}
try {
const pkgJson = JSON.parse(
await readFile('package.json', 'utf8')
await readFile('package.json', 'utf8'),
) as PackageJson;
if (pkgJson.renovate) {
logger.info(`Validating package.json > renovate`);
Expand All @@ -121,7 +121,7 @@ type PackageJson = {
'package.json > renovate-config',
presetConfig,
strict,
true
true,
);
}
}
Expand Down
26 changes: 13 additions & 13 deletions lib/config/decrypt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('config/decrypt', () => {
config.encrypted = { a: 1 };
GlobalConfig.set({ privateKey, privateKeyOld: 'invalid-key' });
await expect(decryptConfig(config, repository)).rejects.toThrow(
CONFIG_VALIDATION
CONFIG_VALIDATION,
);
});

Expand All @@ -60,7 +60,7 @@ describe('config/decrypt', () => {
expect(res.encrypted).toBeUndefined();
expect(res.npmToken).toBeUndefined();
expect(res.npmrc).toBe(
'//registry.npmjs.org/:_authToken=abcdef-ghijklm-nopqf-stuvwxyz\n//registry.npmjs.org/:_authToken=abcdef-ghijklm-nopqf-stuvwxyz\n'
'//registry.npmjs.org/:_authToken=abcdef-ghijklm-nopqf-stuvwxyz\n//registry.npmjs.org/:_authToken=abcdef-ghijklm-nopqf-stuvwxyz\n',
);
});

Expand Down Expand Up @@ -98,11 +98,11 @@ describe('config/decrypt', () => {
expect(res.encrypted).toBeUndefined();
expect(res.packageFiles[0].devDependencies.encrypted).toBeUndefined();
expect(res.packageFiles[0].devDependencies.branchPrefix).toBe(
'abcdef-ghijklm-nopqf-stuvwxyz'
'abcdef-ghijklm-nopqf-stuvwxyz',
);
expect(res.packageFiles[0].devDependencies.npmToken).toBeUndefined();
expect(res.packageFiles[0].devDependencies.npmrc).toBe(
'//registry.npmjs.org/:_authToken=abcdef-ghijklm-nopqf-stuvwxyz\n'
'//registry.npmjs.org/:_authToken=abcdef-ghijklm-nopqf-stuvwxyz\n',
);
});

Expand All @@ -113,37 +113,37 @@ describe('config/decrypt', () => {
'long-but-wrong-wcFMAw+4H7SgaqGOAQ//ZNPgHJ4RQBdfFoDX8Ywe9UxqMlc8k6VasCszQ2JULh/BpEdKdgRUGNaKaeZ+oBKYDBmDwAD5V5FEMlsg+KO2gykp/p2BAwvKGtYK0MtxLh4h9yJbN7TrVnGO3/cC+Inp8exQt0gD6f1Qo/9yQ9NE4/BIbaSs2b2DgeIK7Ed8N675AuSo73UOa6o7t+9pKeAAK5TQwgSvolihbUs8zjnScrLZD+nhvL3y5gpAqK9y//a+bTu6xPA1jdLjsswoCUq/lfVeVsB2GWV2h6eex/0fRKgN7xxNgdMn0a7msrvumhTawP8mPisPY2AAsHRIgQ9vdU5HbOPdGoIwI9n9rMdIRn9Dy7/gcX9Ic+RP2WwS/KnPHLu/CveY4W5bYqYoikWtJs9HsBCyWFiHIRrJF+FnXwtKdoptRfxTfJIkBoLrV6fDIyKo79iL+xxzgrzWs77KEJUJfexZBEGBCnrV2o7mo3SU197S0qx7HNvqrmeCj8CLxq8opXC71TNa+XE6BQUVyhMFxtW9LNxZUHRiNzrTSikArT4hzjyr3f9cb0kZVcs6XJQsm1EskU3WXo7ETD7nsukS9GfbwMn7tfYidB/yHSHl09ih871BcgByDmEKKdmamcNilW2bmTAqB5JmtaYT5/H8jRQWo/VGrEqlmiA4KmwSv7SZPlDnaDFrmzmMZZDSRgHe5KWl283XLmSeE8J0NPqwFH3PeOv4fIbOjJrnbnFBwSAsgsMe2K4OyFDh2COfrho7s8EP1Kl5lBkYJ+VRreGRerdSu24',
};
await expect(decryptConfig(config, repository)).rejects.toThrow(
CONFIG_VALIDATION
CONFIG_VALIDATION,
);
config.encrypted = {
// Missing value
token:
'wcFMAw+4H7SgaqGOAQ//ZNPgHJ4RQBdfFoDX8Ywe9UxqMlc8k6VasCszQ2JULh/BpEdKdgRUGNaKaeZ+oBKYDBmDwAD5V5FEMlsg+KO2gykp/p2BAwvKGtYK0MtxLh4h9yJbN7TrVnGO3/cC+Inp8exQt0gD6f1Qo/9yQ9NE4/BIbaSs2b2DgeIK7Ed8N675AuSo73UOa6o7t+9pKeAAK5TQwgSvolihbUs8zjnScrLZD+nhvL3y5gpAqK9y//a+bTu6xPA1jdLjsswoCUq/lfVeVsB2GWV2h6eex/0fRKgN7xxNgdMn0a7msrvumhTawP8mPisPY2AAsHRIgQ9vdU5HbOPdGoIwI9n9rMdIRn9Dy7/gcX9Ic+RP2WwS/KnPHLu/CveY4W5bYqYoikWtJs9HsBCyWFiHIRrJF+FnXwtKdoptRfxTfJIkBoLrV6fDIyKo79iL+xxzgrzWs77KEJUJfexZBEGBCnrV2o7mo3SU197S0qx7HNvqrmeCj8CLxq8opXC71TNa+XE6BQUVyhMFxtW9LNxZUHRiNzrTSikArT4hzjyr3f9cb0kZVcs6XJQsm1EskU3WXo7ETD7nsukS9GfbwMn7tfYidB/yHSHl09ih871BcgByDmEKKdmamcNilW2bmTAqB5JmtaYT5/H8jRQWo/VGrEqlmiA4KmwSv7SZPlDnaDFrmzmMZZDSRgHe5KWl283XLmSeE8J0NPqwFH3PeOv4fIbOjJrnbnFBwSAsgsMe2K4OyFDh2COfrho7s8EP1Kl5lBkYJ+VRreGRerdSu24',
};
await expect(decryptConfig(config, repository)).rejects.toThrow(
CONFIG_VALIDATION
CONFIG_VALIDATION,
);
config.encrypted = {
// Missing org scope
token:
'wcFMAw+4H7SgaqGOAQ//W38A3PmaZnE9XTCHGDQFD52Kz78UYnaiYeAT13cEqYWTwEvQ57B7D7I6i4jCLe7KwkUCS90kyoqd7twD75W/sO70MyIveKnMlqqnpkagQkFgmzMaXXNHaJXEkjzsflTELZu6UsUs/kZYmab7r14YLl9HbH/pqN9exil/9s3ym9URCPOyw/l04KWntdMAy0D+c5M4mE+obv6fz6nDb8tkdeT5Rt2uU+qw3gH1OsB2yu+zTWpI/xTGwDt5nB5txnNTsVrQ/ZK85MSktacGVcYuU9hsEDmSrShmtqlg6Myq+Hjb7cYAp2g4n13C/I3gGGaczl0PZaHD7ALMjI7p6O1q+Ix7vMxipiKMVjS3omJoqBCz3FKc6DVhyX4tfhxgLxFo0DpixNwGbBRbMBO8qZfUk7bicAl/oCRc2Ijmay5DDYuvtkw3G3Ou+sZTe6DNpWUFy6VA4ai7hhcLvcAuiYmLdwPISRR/X4ePa8ZrmSVPyVOvbmmwLhcDYSDlC9Mw4++7ELomlve5kvjVSHvPv9BPVb5sJF7gX4vOT4FrcKalQRPmhNCZrE8tY2lvlrXwV2EEhya8EYv4QTd3JUYEYW5FXiJrORK5KDTnISw+U02nFZjFlnoz9+R6h+aIT1crS3/+YjCHE/EIKvSftOnieYb02Gk7M9nqU19EYL9ApYw4+IjSRgFM3DShIrvuDwDkAwUfaq8mKtr9Vjg/r+yox//GKS3u3r4I3+dfCljA3OwskTPfbSD+huBk4mylIvaL5v8Fngxo979wiLw',
};
await expect(decryptConfig(config, repository)).rejects.toThrow(
CONFIG_VALIDATION
CONFIG_VALIDATION,
);
config.encrypted = {
// Impossible to parse
token:
'wcFMAw+4H7SgaqGOAQ//Wa/gHgQdH7tj3LQdW6rWKjzmkYVKZW9EbexJExu4WLaMgEKodlRMilcqCKfQZpjzoiC31J8Ly/x6Soury+lQnLVbtIQ4KWa/uCIz4lXCpPpGNgN2jPfOmdwWBMOcXIT+BgAMxRu3rAmvTtunrkACJ3J92eYNwJhTzp2Azn9LpT7kHnZ64z2SPhbdUgMMhCBwBG5BPArPzF5fdaqa8uUSbKhY0GMiqPXq6Zeq+EBNoPc/RJp2urpYTknO+nRb39avKjihd9MCZ/1d3QYymbRj7SZC3LJhenVF0hil3Uk8TBASnGQiDmBcIXQFhJ0cxavXqKjx+AEALq+kTdwGu5vuE2+2B820/o3lAXR9OnJHr8GodJ2ZBpzOaPrQe5zvxL0gLEeUUPatSOwuLhdo/6+bRCl2wNz23jIjDEFFTmsLqfEHcdVYVTH2QqvLjnUYcCRRuM32vS4rCMOEe0l6p0CV2rk22UZDIPcxqXjKucxse2Sow8ATWiPoIw7zWj7XBLqUKHFnMpPV2dCIKFKBsOKYgLjF4BvKzZJyhmVEPgMcKQLYqeT/2uWDR77NSWH0Cyiwk9M3KbOIMmV3pWh9PiXk6CvumECELbJHYH0Mc+P//BnbDq2Ie9dHdmKhFgRyHU7gWvkPhic9BX36xyldPcnhTgr1XWRoVe0ETGLDPCcqrQ/SUQGrLiujSOgxGu2K/6LDJhi4IKz1/nf7FUSj5eTIDqQiSPP5pXDjlH7oYxXXrHI/aYOCZ5sBx7mOzlEcENIrYblCHO/CYMTWdCJ4Wrftqk7K/A=',
};
await expect(decryptConfig(config, repository)).rejects.toThrow(
CONFIG_VALIDATION
CONFIG_VALIDATION,
);
config.encrypted = {
token: 'too-short',
};
await expect(decryptConfig(config, repository)).rejects.toThrow(
CONFIG_VALIDATION
CONFIG_VALIDATION,
);
});

Expand All @@ -157,7 +157,7 @@ describe('config/decrypt', () => {
expect(res.encrypted).toBeUndefined();
expect(res.token).toBe('123');
await expect(decryptConfig(config, 'wrong/org')).rejects.toThrow(
CONFIG_VALIDATION
CONFIG_VALIDATION,
);
});

Expand All @@ -174,7 +174,7 @@ describe('config/decrypt', () => {
expect(res.encrypted).toBeUndefined();
expect(res.token).toBe('123');
await expect(decryptConfig(config, 'wrong/org')).rejects.toThrow(
CONFIG_VALIDATION
CONFIG_VALIDATION,
);
});

Expand All @@ -188,7 +188,7 @@ describe('config/decrypt', () => {
expect(res.encrypted).toBeUndefined();
expect(res.token).toBe('123');
await expect(decryptConfig(config, 'abc/defg')).rejects.toThrow(
CONFIG_VALIDATION
CONFIG_VALIDATION,
);
});

Expand All @@ -205,7 +205,7 @@ describe('config/decrypt', () => {
expect(res.encrypted).toBeUndefined();
expect(res.token).toBe('123');
await expect(decryptConfig(config, 'abc/defg')).rejects.toThrow(
CONFIG_VALIDATION
CONFIG_VALIDATION,
);
});
});
Expand Down