@typescript-eslint/rule-schema-to-typescript-types 8.63.1-alpha.8 → 8.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,7 +14,7 @@ export function generateArrayType(schema, refMap) {
|
|
|
14
14
|
throw new UnexpectedError('Unexpected missing items', schema);
|
|
15
15
|
}
|
|
16
16
|
if (!TSUtils.isArray(schema.items) && schema.additionalItems) {
|
|
17
|
-
throw new NotSupportedError('
|
|
17
|
+
throw new NotSupportedError('singly-typed array with additionalItems', schema);
|
|
18
18
|
}
|
|
19
19
|
const commentLines = getCommentLines(schema);
|
|
20
20
|
const minItems = schema.minItems ?? 0;
|
|
@@ -24,11 +24,11 @@ export function generateObjectType(schema, refMap) {
|
|
|
24
24
|
const propertyDefs = Object.entries(schema.properties);
|
|
25
25
|
for (const [propName, propSchema] of propertyDefs) {
|
|
26
26
|
const propType = generateType(propSchema, refMap);
|
|
27
|
-
const
|
|
27
|
+
const sanitizedPropName = requiresQuoting(propName)
|
|
28
28
|
? `'${propName}'`
|
|
29
29
|
: propName;
|
|
30
30
|
properties.push({
|
|
31
|
-
name:
|
|
31
|
+
name: sanitizedPropName,
|
|
32
32
|
optional: !required.has(propName),
|
|
33
33
|
type: propType,
|
|
34
34
|
});
|
package/dist/printAST.js
CHANGED
|
@@ -23,7 +23,7 @@ function printComment({ commentLines: commentLinesIn, }) {
|
|
|
23
23
|
function printAST(ast) {
|
|
24
24
|
switch (ast.type) {
|
|
25
25
|
case 'array': {
|
|
26
|
-
const code =
|
|
26
|
+
const code = printAndMaybeParenthesize(ast.elementType);
|
|
27
27
|
return {
|
|
28
28
|
code: `${code.code}[]`,
|
|
29
29
|
commentLines: [...ast.commentLines, ...code.commentLines],
|
|
@@ -59,7 +59,7 @@ function printAST(ast) {
|
|
|
59
59
|
elements.push(printASTWithComment(element));
|
|
60
60
|
}
|
|
61
61
|
if (ast.spreadType) {
|
|
62
|
-
const result =
|
|
62
|
+
const result = printAndMaybeParenthesize(ast.spreadType);
|
|
63
63
|
elements.push(`${printComment(result)}...${result.code}[]`);
|
|
64
64
|
}
|
|
65
65
|
return {
|
|
@@ -116,7 +116,7 @@ function compareElements(a, b) {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function printAndMaybeParenthesize(ast) {
|
|
120
120
|
const printed = printAST(ast);
|
|
121
121
|
if (ast.type === 'union') {
|
|
122
122
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/rule-schema-to-typescript-types",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.64.0",
|
|
4
4
|
"description": "Converts ESLint rule schemas to equivalent TypeScript type strings.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"natural-compare": "^1.4.0",
|
|
32
|
-
"@typescript-eslint/type-utils": "8.
|
|
33
|
-
"@typescript-eslint/utils": "8.
|
|
32
|
+
"@typescript-eslint/type-utils": "8.64.0",
|
|
33
|
+
"@typescript-eslint/utils": "8.64.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@typescript/native-preview": "7.0.0-dev.20260518.1",
|