Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.

Commit 1f4ed88

Browse files
committed
apply formatting rules
1 parent 0b5442e commit 1f4ed88

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

projects/standard-rulesets/src/breaking-changes/__tests__/breaking-changes.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,9 +1274,9 @@ describe('breaking change ruleset configuration', () => {
12741274
};
12751275
const results = await TestHelpers.runRulesWithInputs(
12761276
[
1277-
await BreakingChangesRuleset.fromOpticConfig({
1277+
(await BreakingChangesRuleset.fromOpticConfig({
12781278
exclude_operations_with_extension: 'x-legacy',
1279-
}) as any,
1279+
})) as any,
12801280
],
12811281
beforeJson,
12821282
afterJson
@@ -1311,16 +1311,16 @@ describe('breaking change ruleset configuration', () => {
13111311
};
13121312
const results = await TestHelpers.runRulesWithInputs(
13131313
[
1314-
await BreakingChangesRuleset.fromOpticConfig({
1314+
(await BreakingChangesRuleset.fromOpticConfig({
13151315
exclude_operations_with_extension: [
13161316
{ 'x-stability-level': ['draft'] },
13171317
],
1318-
}) as any,
1318+
})) as any,
13191319
],
13201320
beforeJson,
13211321
afterJson
13221322
);
1323-
expect(results.length).toBe(0)
1323+
expect(results.length).toBe(0);
13241324
});
13251325

13261326
test('breaking changes applies a matches function for object extension value mismatch', async () => {
@@ -1350,19 +1350,19 @@ describe('breaking change ruleset configuration', () => {
13501350
};
13511351
const results = await TestHelpers.runRulesWithInputs(
13521352
[
1353-
await BreakingChangesRuleset.fromOpticConfig({
1353+
(await BreakingChangesRuleset.fromOpticConfig({
13541354
exclude_operations_with_extension: [
13551355
{ 'x-stability-level': ['draft'] },
13561356
],
1357-
}) as any,
1357+
})) as any,
13581358
],
13591359
beforeJson,
13601360
afterJson
13611361
);
13621362
expect(results.length).toEqual(1);
13631363
});
13641364

1365-
test('breaking changes applies a matches function for object extension value missing', async () => {
1365+
test('breaking changes applies a matches function for object extension value missing', async () => {
13661366
const beforeJson: OpenAPIV3.Document = {
13671367
...TestHelpers.createEmptySpec(),
13681368
paths: {
@@ -1388,11 +1388,11 @@ describe('breaking change ruleset configuration', () => {
13881388
};
13891389
const results = await TestHelpers.runRulesWithInputs(
13901390
[
1391-
await BreakingChangesRuleset.fromOpticConfig({
1391+
(await BreakingChangesRuleset.fromOpticConfig({
13921392
exclude_operations_with_extension: [
13931393
{ 'x-stability-level': ['draft'] },
13941394
],
1395-
}) as any,
1395+
})) as any,
13961396
],
13971397
beforeJson,
13981398
afterJson

projects/standard-rulesets/src/breaking-changes/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ import { preventResponseNarrowingInUnionTypes } from './preventResponseNarrowing
3737
import { excludeOperationWithExtensionMatches } from '../utils';
3838

3939
type YamlConfig = {
40-
exclude_operations_with_extension?: string | string[] | { [key: string]: string[] }[];
40+
exclude_operations_with_extension?:
41+
| string
42+
| string[]
43+
| { [key: string]: string[] }[];
4144
skip_when_major_version_changes?: boolean;
4245
docs_link?: string;
4346
severity?: SeverityText;
@@ -49,8 +52,8 @@ const configSchema = {
4952
properties: {
5053
exclude_operations_with_extension: {
5154
oneOf: [
52-
{ type: 'string' },
53-
{ type: 'array', items: { type: 'string' }},
55+
{ type: 'string' },
56+
{ type: 'array', items: { type: 'string' } },
5457
{
5558
type: 'array',
5659
items: {

projects/standard-rulesets/src/utils.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ function extensionIsTruthy(extension: any) {
1010
}
1111

1212
export const excludeOperationWithExtensionMatches = (
13-
excludeOperationWithExtensions: string | string[] | { [key: string]: string[] }[]
13+
excludeOperationWithExtensions:
14+
| string
15+
| string[]
16+
| { [key: string]: string[] }[]
1417
) => {
1518
return (context: RuleContext): boolean => {
1619
const operation = context.operation.raw as any;
@@ -33,10 +36,7 @@ export const excludeOperationWithExtensionMatches = (
3336
else if (typeof exclusion === 'object' && exclusion !== null) {
3437
for (const [key, values] of Object.entries(exclusion)) {
3538
const extensionValue = operation[key];
36-
if (
37-
extensionValue &&
38-
values.includes(String(extensionValue))
39-
) {
39+
if (extensionValue && values.includes(String(extensionValue))) {
4040
return false; // Exclude if the extension value matches
4141
}
4242
}
@@ -46,4 +46,3 @@ export const excludeOperationWithExtensionMatches = (
4646
return true; // Include by default
4747
};
4848
};
49-

0 commit comments

Comments
 (0)