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

Commit 8677c16

Browse files
committed
Generate simple property types
1 parent d7a4469 commit 8677c16

File tree

77 files changed

+261
-236
lines changed

Some content is hidden

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

77 files changed

+261
-236
lines changed

scripts/generate-files.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,31 @@ const generationMap: Record<string, Plugin> = {
4848
// Generating rule files
4949
const rulesDir: string = path.resolve(__dirname, '../src/rules');
5050

51+
function generateType(propertyDefinition: JSONSchema4): string {
52+
switch (propertyDefinition.type) {
53+
case 'string':
54+
case 'boolean':
55+
case 'number':
56+
return propertyDefinition.type;
57+
case 'integer':
58+
// TODO: Read further details
59+
return 'number';
60+
case 'array':
61+
// TODO: Handle array
62+
return 'any[]';
63+
case 'object':
64+
// TODO: Handle nested objects
65+
return 'Record<string, any>';
66+
case undefined:
67+
// TODO: Could be an object
68+
break;
69+
default:
70+
console.log(propertyDefinition.type);
71+
break;
72+
}
73+
return 'any';
74+
}
75+
5176
for (const pluginName in generationMap) {
5277
const { rules, name } = generationMap[pluginName]!;
5378

@@ -80,7 +105,7 @@ export type ${ruleNamePascalCase}Option = {`;
80105
/**
81106
* ${seeDocLink}
82107
*/
83-
'${propertyName}'?: any;\n`;
108+
'${propertyName}'?: ${generateType(propertyDefinition)};\n`;
84109
});
85110

86111
ruleContent += `}

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,87 +7,87 @@ export type CheckExamplesOption = {
77
/**
88
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
99
*/
10-
allowInlineConfig?: any;
10+
allowInlineConfig?: boolean;
1111

1212
/**
1313
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
1414
*/
15-
baseConfig?: any;
15+
baseConfig?: Record<string, any>;
1616

1717
/**
1818
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
1919
*/
20-
captionRequired?: any;
20+
captionRequired?: boolean;
2121

2222
/**
2323
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
2424
*/
25-
checkDefaults?: any;
25+
checkDefaults?: boolean;
2626

2727
/**
2828
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
2929
*/
30-
checkEslintrc?: any;
30+
checkEslintrc?: boolean;
3131

3232
/**
3333
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
3434
*/
35-
checkParams?: any;
35+
checkParams?: boolean;
3636

3737
/**
3838
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
3939
*/
40-
checkProperties?: any;
40+
checkProperties?: boolean;
4141

4242
/**
4343
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
4444
*/
45-
configFile?: any;
45+
configFile?: string;
4646

4747
/**
4848
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
4949
*/
50-
exampleCodeRegex?: any;
50+
exampleCodeRegex?: string;
5151

5252
/**
5353
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
5454
*/
55-
matchingFileName?: any;
55+
matchingFileName?: string;
5656

5757
/**
5858
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
5959
*/
60-
matchingFileNameDefaults?: any;
60+
matchingFileNameDefaults?: string;
6161

6262
/**
6363
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
6464
*/
65-
matchingFileNameParams?: any;
65+
matchingFileNameParams?: string;
6666

6767
/**
6868
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
6969
*/
70-
matchingFileNameProperties?: any;
70+
matchingFileNameProperties?: string;
7171

7272
/**
7373
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
7474
*/
75-
noDefaultExampleRules?: any;
75+
noDefaultExampleRules?: boolean;
7676

7777
/**
7878
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
7979
*/
80-
paddedIndent?: any;
80+
paddedIndent?: number;
8181

8282
/**
8383
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
8484
*/
85-
rejectExampleCodeRegex?: any;
85+
rejectExampleCodeRegex?: string;
8686

8787
/**
8888
* @see [check-examples](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples)
8989
*/
90-
reportUnusedDisableDirectives?: any;
90+
reportUnusedDisableDirectives?: boolean;
9191
};
9292

9393
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export type CheckIndentationOption = {
77
/**
88
* @see [check-indentation](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-indentation)
99
*/
10-
excludeTags?: any;
10+
excludeTags?: any[];
1111
};
1212

1313
/**

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@ export type CheckParamNamesOption = {
77
/**
88
* @see [check-param-names](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-param-names)
99
*/
10-
allowExtraTrailingParamDocs?: any;
10+
allowExtraTrailingParamDocs?: boolean;
1111

1212
/**
1313
* @see [check-param-names](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-param-names)
1414
*/
15-
checkDestructured?: any;
15+
checkDestructured?: boolean;
1616

1717
/**
1818
* @see [check-param-names](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-param-names)
1919
*/
20-
checkRestProperty?: any;
20+
checkRestProperty?: boolean;
2121

2222
/**
2323
* @see [check-param-names](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-param-names)
2424
*/
25-
checkTypesPattern?: any;
25+
checkTypesPattern?: string;
2626

2727
/**
2828
* @see [check-param-names](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-param-names)
2929
*/
30-
disableExtraPropertyReporting?: any;
30+
disableExtraPropertyReporting?: boolean;
3131

3232
/**
3333
* @see [check-param-names](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-param-names)
3434
*/
35-
enableFixer?: any;
35+
enableFixer?: boolean;
3636

3737
/**
3838
* @see [check-param-names](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-param-names)
3939
*/
40-
useDefaultObjectProperties?: any;
40+
useDefaultObjectProperties?: boolean;
4141
};
4242

4343
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export type CheckPropertyNamesOption = {
77
/**
88
* @see [check-property-names](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-property-names)
99
*/
10-
enableFixer?: any;
10+
enableFixer?: boolean;
1111
};
1212

1313
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ export type CheckTagNamesOption = {
77
/**
88
* @see [check-tag-names](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-tag-names)
99
*/
10-
definedTags?: any;
10+
definedTags?: any[];
1111

1212
/**
1313
* @see [check-tag-names](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-tag-names)
1414
*/
15-
jsxTags?: any;
15+
jsxTags?: boolean;
1616
};
1717

1818
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ export type CheckTypesOption = {
77
/**
88
* @see [check-types](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-types)
99
*/
10-
exemptTagContexts?: any;
10+
exemptTagContexts?: any[];
1111

1212
/**
1313
* @see [check-types](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-types)
1414
*/
15-
noDefaults?: any;
15+
noDefaults?: boolean;
1616

1717
/**
1818
* @see [check-types](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-types)
1919
*/
20-
unifyParentAndChildTypeChecks?: any;
20+
unifyParentAndChildTypeChecks?: boolean;
2121
};
2222

2323
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export type CheckValuesOption = {
77
/**
88
* @see [check-values](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-values)
99
*/
10-
allowedAuthors?: any;
10+
allowedAuthors?: any[];
1111

1212
/**
1313
* @see [check-values](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-values)
@@ -17,12 +17,12 @@ export type CheckValuesOption = {
1717
/**
1818
* @see [check-values](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-values)
1919
*/
20-
licensePattern?: any;
20+
licensePattern?: string;
2121

2222
/**
2323
* @see [check-values](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-values)
2424
*/
25-
numericOnlyVariation?: any;
25+
numericOnlyVariation?: boolean;
2626
};
2727

2828
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export type EmptyTagsOption = {
77
/**
88
* @see [empty-tags](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-empty-tags)
99
*/
10-
tags?: any;
10+
tags?: any[];
1111
};
1212

1313
/**

src/rules/jsdoc/implements-on-classes.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export type ImplementsOnClassesOption = {
77
/**
88
* @see [implements-on-classes](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-implements-on-classes)
99
*/
10-
contexts?: any;
10+
contexts?: any[];
1111
};
1212

1313
/**

0 commit comments

Comments
 (0)