Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit e03d3c8

Browse files
committed
Fix generation of non array main schema
1 parent 4fc5bf7 commit e03d3c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+62
-59
lines changed

scripts/generate-rule-files.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ async function main(): Promise<void> {
8787
const deprecated: boolean | undefined = meta?.deprecated;
8888

8989
const schema: JSONSchema4 | JSONSchema4[] | undefined = meta?.schema;
90+
const schemaIsObject: boolean = !Array.isArray(schema);
9091
const mainSchema: JSONSchema4 | undefined = Array.isArray(schema) ? schema[0] : schema;
9192
const sideSchema: JSONSchema4 | undefined =
9293
schema && Array.isArray(schema) && schema.length > 1 ? schema[1] : undefined;
@@ -160,9 +161,15 @@ ${ruleOption}
160161
/**
161162
* Options.
162163
*/
163-
export type ${ruleNamePascalCase}Options = [${ruleNamePascalCase}Option?${
164-
sideSchema ? `, ${ruleNamePascalCase}Config?${thirdSchema ? `, ${ruleNamePascalCase}Setting?` : ''}` : ''
165-
}];`;
164+
export type ${ruleNamePascalCase}Options = ${
165+
schemaIsObject
166+
? `${ruleNamePascalCase}Option`
167+
: `[${ruleNamePascalCase}Option?${
168+
sideSchema
169+
? `, ${ruleNamePascalCase}Config?${thirdSchema ? `, ${ruleNamePascalCase}Setting?` : ''}`
170+
: ''
171+
}]`
172+
};`;
166173
}
167174

168175
// TODO: Add third option

src/rules/eslint/array-element-newline.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export type BasicConfig =
2222
/**
2323
* Options.
2424
*/
25-
export type ArrayElementNewlineOptions = [ArrayElementNewlineOption?];
25+
export type ArrayElementNewlineOptions = ArrayElementNewlineOption;
2626

2727
/**
2828
* Enforce line breaks after each array element.

src/rules/eslint/arrow-body-style.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type ArrowBodyStyleOption =
1818
/**
1919
* Options.
2020
*/
21-
export type ArrowBodyStyleOptions = [ArrowBodyStyleOption?];
21+
export type ArrowBodyStyleOptions = ArrowBodyStyleOption;
2222

2323
/**
2424
* Require braces around arrow function bodies.

src/rules/eslint/comma-dangle.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export type ValueWithIgnore = 'always-multiline' | 'always' | 'ignore' | 'never'
2121
/**
2222
* Options.
2323
*/
24-
export type CommaDangleOptions = [CommaDangleOption?];
24+
export type CommaDangleOptions = CommaDangleOption;
2525

2626
/**
2727
* Require or disallow trailing commas.

src/rules/eslint/consistent-this.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type ConsistentThisOption = string[];
88
/**
99
* Options.
1010
*/
11-
export type ConsistentThisOptions = [ConsistentThisOption?];
11+
export type ConsistentThisOptions = ConsistentThisOption;
1212

1313
/**
1414
* Enforce consistent naming when capturing the current execution context.

src/rules/eslint/curly.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type CurlyOption =
1313
/**
1414
* Options.
1515
*/
16-
export type CurlyOptions = [CurlyOption?];
16+
export type CurlyOptions = CurlyOption;
1717

1818
/**
1919
* Enforce consistent brace style for all control statements.

src/rules/eslint/eqeqeq.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type EqeqeqOption =
1818
/**
1919
* Options.
2020
*/
21-
export type EqeqeqOptions = [EqeqeqOption?];
21+
export type EqeqeqOptions = EqeqeqOption;
2222

2323
/**
2424
* Require the use of `===` and `!==`.

src/rules/eslint/func-call-spacing.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type FuncCallSpacingOption =
1818
/**
1919
* Options.
2020
*/
21-
export type FuncCallSpacingOptions = [FuncCallSpacingOption?];
21+
export type FuncCallSpacingOptions = FuncCallSpacingOption;
2222

2323
/**
2424
* Require or disallow spacing between function identifiers and their invocations.

src/rules/eslint/func-name-matching.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type FuncNameMatchingOption =
2424
/**
2525
* Options.
2626
*/
27-
export type FuncNameMatchingOptions = [FuncNameMatchingOption?];
27+
export type FuncNameMatchingOptions = FuncNameMatchingOption;
2828

2929
/**
3030
* Require function names to match the name of the variable or property to which they are assigned.

src/rules/eslint/func-names.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type Value = 'always' | 'as-needed' | 'never';
1717
/**
1818
* Options.
1919
*/
20-
export type FuncNamesOptions = [FuncNamesOption?];
20+
export type FuncNamesOptions = FuncNamesOption;
2121

2222
/**
2323
* Require or disallow named `function` expressions.

0 commit comments

Comments
 (0)