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

Commit 253739d

Browse files
committed
Generate string arrays
1 parent 9514ede commit 253739d

25 files changed

+38
-33
lines changed

scripts/generate-files.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,17 @@ function generateType(propertyDefinition: JSONSchema4): string {
5757
case 'integer':
5858
// TODO: Read further details
5959
return 'number';
60-
case 'array':
60+
case 'array': {
61+
const items: JSONSchema4 | JSONSchema4[] | undefined = propertyDefinition.items;
62+
if (items && !Array.isArray(items)) {
63+
if (items.type === 'string') {
64+
return 'string[]';
65+
}
66+
// TODO: Could be enum or something else
67+
}
6168
// TODO: Handle array
6269
return 'any[]';
70+
}
6371
case 'object':
6472
// TODO: Handle nested objects
6573
return 'Record<string, any>';
@@ -132,9 +140,6 @@ for (const pluginName in generationMap) {
132140
const mainSchema: JSONSchema4 | undefined = Array.isArray(schema) ? schema[0] : schema;
133141
const sideSchema: JSONSchema4 | undefined =
134142
schema && Array.isArray(schema) && schema.length > 1 ? schema[1] : undefined;
135-
if (sideSchema) {
136-
// console.log(pluginName, ruleName, mainSchema, sideSchema);
137-
}
138143
// TODO: vue/max-len has also a third schema
139144
if (mainSchema) {
140145
if (sideSchema) {
@@ -161,7 +166,7 @@ export type ${ruleNamePascalCase}Options = [${ruleNamePascalCase}Option?${
161166
}];`;
162167
}
163168

164-
// TODO: Add side and third option
169+
// TODO: Add third option
165170

166171
ruleContent += `
167172

src/rules/jsdoc/check-indentation.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { RuleConfig } from '../rule-config';
44
* Option.
55
*/
66
export type CheckIndentationOption = {
7-
excludeTags?: any[];
7+
excludeTags?: string[];
88
};
99

1010
/**

src/rules/jsdoc/check-line-alignment.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { RuleConfig } from '../rule-config';
66
export type CheckLineAlignmentConfig = {
77
customSpacings?: any;
88
preserveMainDescriptionPostDelimiter?: boolean;
9-
tags?: any[];
9+
tags?: string[];
1010
};
1111

1212
/**

src/rules/jsdoc/check-tag-names.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { RuleConfig } from '../rule-config';
44
* Option.
55
*/
66
export type CheckTagNamesOption = {
7-
definedTags?: any[];
7+
definedTags?: string[];
88
jsxTags?: boolean;
99
};
1010

src/rules/jsdoc/check-values.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { RuleConfig } from '../rule-config';
44
* Option.
55
*/
66
export type CheckValuesOption = {
7-
allowedAuthors?: any[];
7+
allowedAuthors?: string[];
88
allowedLicenses?: any;
99
licensePattern?: string;
1010
numericOnlyVariation?: boolean;

src/rules/jsdoc/empty-tags.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { RuleConfig } from '../rule-config';
44
* Option.
55
*/
66
export type EmptyTagsOption = {
7-
tags?: any[];
7+
tags?: string[];
88
};
99

1010
/**

src/rules/jsdoc/multiline-blocks.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type MultilineBlocksOption = {
1111
noMultilineBlocks?: boolean;
1212
noSingleLineBlocks?: boolean;
1313
noZeroLineText?: boolean;
14-
singleLineTags?: any[];
14+
singleLineTags?: string[];
1515
};
1616

1717
/**

src/rules/jsdoc/no-bad-blocks.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { RuleConfig } from '../rule-config';
44
* Option.
55
*/
66
export type NoBadBlocksOption = {
7-
ignore?: any[];
7+
ignore?: string[];
88
preventAllMultiAsteriskBlocks?: boolean;
99
};
1010

src/rules/jsdoc/no-undefined-types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { RuleConfig } from '../rule-config';
44
* Option.
55
*/
66
export type NoUndefinedTypesOption = {
7-
definedTypes?: any[];
7+
definedTypes?: string[];
88
};
99

1010
/**

src/rules/jsdoc/require-description-complete-sentence.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import type { RuleConfig } from '../rule-config';
44
* Option.
55
*/
66
export type RequireDescriptionCompleteSentenceOption = {
7-
abbreviations?: any[];
7+
abbreviations?: string[];
88
newlineBeforeCapsAssumesBadSentenceEnd?: boolean;
9-
tags?: any[];
9+
tags?: string[];
1010
};
1111

1212
/**

0 commit comments

Comments
 (0)