create-typescript-app 2.33.0 → 2.34.1
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.
- package/lib/blocks/blockESLint.js +13 -38
- package/lib/blocks/blockESLintMoreStyling.d.ts +2 -1
- package/lib/blocks/blockESLintMoreStyling.js +4 -2
- package/lib/blocks/eslint/blockESLintIntake.d.ts +9 -0
- package/lib/blocks/eslint/blockESLintIntake.js +116 -0
- package/lib/blocks/eslint/schemas.d.ts +97 -0
- package/lib/blocks/eslint/schemas.js +44 -0
- package/lib/blocks/intake/intakeFile.d.ts +1 -1
- package/lib/blocks/intake/intakeFile.js +8 -1
- package/lib/data/packageData.d.ts +2 -1
- package/lib/utils/tryCatch.d.ts +3 -0
- package/lib/utils/tryCatch.js +10 -0
- package/package.json +2 -1
|
@@ -10,45 +10,14 @@ import { blockRemoveDependencies } from "./blockRemoveDependencies.js";
|
|
|
10
10
|
import { blockRemoveFiles } from "./blockRemoveFiles.js";
|
|
11
11
|
import { blockRemoveWorkflows } from "./blockRemoveWorkflows.js";
|
|
12
12
|
import { blockVSCode } from "./blockVSCode.js";
|
|
13
|
+
import { blockESLintIntake } from "./eslint/blockESLintIntake.js";
|
|
14
|
+
import {
|
|
15
|
+
zExtension,
|
|
16
|
+
zExtensionRules,
|
|
17
|
+
zPackageImport
|
|
18
|
+
} from "./eslint/schemas.js";
|
|
19
|
+
import { intakeFile } from "./intake/intakeFile.js";
|
|
13
20
|
import { CommandPhase } from "./phases.js";
|
|
14
|
-
const zRuleOptions = z.union([
|
|
15
|
-
z.literal("error"),
|
|
16
|
-
z.literal("off"),
|
|
17
|
-
z.literal("warn"),
|
|
18
|
-
z.union([
|
|
19
|
-
z.tuple([z.union([z.literal("error"), z.literal("warn")]), z.unknown()]),
|
|
20
|
-
z.tuple([
|
|
21
|
-
z.union([z.literal("error"), z.literal("warn")]),
|
|
22
|
-
z.unknown(),
|
|
23
|
-
z.unknown()
|
|
24
|
-
])
|
|
25
|
-
])
|
|
26
|
-
]);
|
|
27
|
-
const zExtensionRuleGroup = z.object({
|
|
28
|
-
comment: z.string().optional(),
|
|
29
|
-
entries: z.record(z.string(), zRuleOptions)
|
|
30
|
-
});
|
|
31
|
-
const zExtensionRules = z.union([
|
|
32
|
-
z.record(z.string(), zRuleOptions),
|
|
33
|
-
z.array(zExtensionRuleGroup)
|
|
34
|
-
]);
|
|
35
|
-
const zExtension = z.object({
|
|
36
|
-
extends: z.array(z.string()).optional(),
|
|
37
|
-
files: z.array(z.string()).optional(),
|
|
38
|
-
languageOptions: z.unknown().optional(),
|
|
39
|
-
linterOptions: z.unknown().optional(),
|
|
40
|
-
plugins: z.record(z.string(), z.string()).optional(),
|
|
41
|
-
rules: zExtensionRules.optional(),
|
|
42
|
-
settings: z.record(z.string(), z.unknown()).optional()
|
|
43
|
-
});
|
|
44
|
-
const zPackageImport = z.object({
|
|
45
|
-
source: z.union([
|
|
46
|
-
z.string(),
|
|
47
|
-
z.object({ packageName: z.string(), version: z.string() })
|
|
48
|
-
]),
|
|
49
|
-
specifier: z.string(),
|
|
50
|
-
types: z.boolean().optional()
|
|
51
|
-
});
|
|
52
21
|
const blockESLint = base.createBlock({
|
|
53
22
|
about: {
|
|
54
23
|
name: "ESLint"
|
|
@@ -62,6 +31,12 @@ const blockESLint = base.createBlock({
|
|
|
62
31
|
rules: zExtensionRules.optional(),
|
|
63
32
|
settings: z.record(z.string(), z.unknown()).optional()
|
|
64
33
|
},
|
|
34
|
+
intake({ files }) {
|
|
35
|
+
const eslintConfigRaw = intakeFile(files, [
|
|
36
|
+
["eslint.config.js", "eslint.config.mjs"]
|
|
37
|
+
]);
|
|
38
|
+
return eslintConfigRaw ? blockESLintIntake(eslintConfigRaw[0]) : void 0;
|
|
39
|
+
},
|
|
65
40
|
produce({ addons, options }) {
|
|
66
41
|
const { explanations, extensions, ignores, imports, rules, settings } = addons;
|
|
67
42
|
const [configFileName, fileExtensions] = options.type === "commonjs" ? ["eslint.config.mjs", "js,mjs,ts"] : ["eslint.config.js", "js,ts"];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as bingo_stratum from 'bingo-stratum';
|
|
2
2
|
|
|
3
|
+
declare const stylisticComment = "Stylistic concerns that don't interfere with Prettier";
|
|
3
4
|
declare const blockESLintMoreStyling: bingo_stratum.BlockWithoutAddons<{
|
|
4
5
|
access: "public" | "restricted";
|
|
5
6
|
description: string;
|
|
@@ -69,4 +70,4 @@ declare const blockESLintMoreStyling: bingo_stratum.BlockWithoutAddons<{
|
|
|
69
70
|
}>> | undefined;
|
|
70
71
|
}>;
|
|
71
72
|
|
|
72
|
-
export { blockESLintMoreStyling };
|
|
73
|
+
export { blockESLintMoreStyling, stylisticComment };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { base } from "../base.js";
|
|
2
2
|
import { blockESLint } from "./blockESLint.js";
|
|
3
|
+
const stylisticComment = "Stylistic concerns that don't interfere with Prettier";
|
|
3
4
|
const blockESLintMoreStyling = base.createBlock({
|
|
4
5
|
about: {
|
|
5
6
|
name: "ESLint More Styling"
|
|
@@ -10,7 +11,7 @@ const blockESLintMoreStyling = base.createBlock({
|
|
|
10
11
|
blockESLint({
|
|
11
12
|
rules: [
|
|
12
13
|
{
|
|
13
|
-
comment:
|
|
14
|
+
comment: stylisticComment,
|
|
14
15
|
entries: {
|
|
15
16
|
"logical-assignment-operators": [
|
|
16
17
|
"error",
|
|
@@ -29,5 +30,6 @@ const blockESLintMoreStyling = base.createBlock({
|
|
|
29
30
|
}
|
|
30
31
|
});
|
|
31
32
|
export {
|
|
32
|
-
blockESLintMoreStyling
|
|
33
|
+
blockESLintMoreStyling,
|
|
34
|
+
stylisticComment
|
|
33
35
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function blockESLintIntake(sourceText: string): {
|
|
2
|
+
ignores: string[];
|
|
3
|
+
rules: {
|
|
4
|
+
entries: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]>;
|
|
5
|
+
comment?: string | undefined;
|
|
6
|
+
}[];
|
|
7
|
+
} | undefined;
|
|
8
|
+
|
|
9
|
+
export { blockESLintIntake };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AST_NODE_TYPES,
|
|
3
|
+
parse as parseAST
|
|
4
|
+
} from "@typescript-eslint/typescript-estree";
|
|
5
|
+
import JSON5 from "json5";
|
|
6
|
+
import { tryCatch } from "../../utils/tryCatch.js";
|
|
7
|
+
import { stylisticComment } from "../blockESLintMoreStyling.js";
|
|
8
|
+
import { zRuleOptions } from "./schemas.js";
|
|
9
|
+
function blockESLintIntake(sourceText) {
|
|
10
|
+
const ast = tryCatch(
|
|
11
|
+
() => parseAST(sourceText, {
|
|
12
|
+
comment: true,
|
|
13
|
+
loc: true,
|
|
14
|
+
range: true
|
|
15
|
+
})
|
|
16
|
+
);
|
|
17
|
+
const configExport = ast?.body.find(nodeIsConfigExport);
|
|
18
|
+
if (!configExport) {
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
const configArguments = configExport.declaration.arguments;
|
|
22
|
+
if (configArguments.length < 2) {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
const ignores = getConfigIgnores(configArguments[0]);
|
|
26
|
+
if (!ignores) {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
const rulesObject = getConfigRulesObject(configArguments.slice(1));
|
|
30
|
+
if (!rulesObject) {
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
const rules = collectRulesObjectGroups(sourceText, rulesObject);
|
|
34
|
+
if (!rules) {
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
37
|
+
return { ignores, rules };
|
|
38
|
+
function areArraysEqual(a, b) {
|
|
39
|
+
if (a.length !== b.length) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
for (let i = 0; i < a.length; i++) {
|
|
43
|
+
if (a[i] !== b[i]) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
function collectRuleFromProperty(property) {
|
|
50
|
+
if (property.type !== AST_NODE_TYPES.Property || property.key.type !== AST_NODE_TYPES.Literal || typeof property.key.value !== "string") {
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
53
|
+
const name = property.key.value;
|
|
54
|
+
const { data } = zRuleOptions.safeParse(
|
|
55
|
+
JSON5.parse(sourceText.slice(...property.value.range))
|
|
56
|
+
);
|
|
57
|
+
return data && { entry: data, name };
|
|
58
|
+
}
|
|
59
|
+
function collectRulesObjectGroups(sourceText2, rulesObject2) {
|
|
60
|
+
let previousNode;
|
|
61
|
+
let currentGroup;
|
|
62
|
+
const groups = [];
|
|
63
|
+
for (const property of rulesObject2.properties) {
|
|
64
|
+
const precedingText = sourceText2.slice(
|
|
65
|
+
(previousNode?.range[1] ?? rulesObject2.range[0]) + 1,
|
|
66
|
+
property.range[0]
|
|
67
|
+
);
|
|
68
|
+
const comment = precedingText.replaceAll(/\/\/|\n/g, "").trim() || void 0;
|
|
69
|
+
if (comment === stylisticComment) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
const rule = collectRuleFromProperty(property);
|
|
73
|
+
if (!rule) {
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
if (!currentGroup || comment) {
|
|
77
|
+
currentGroup = { comment, entries: {} };
|
|
78
|
+
groups.push(currentGroup);
|
|
79
|
+
}
|
|
80
|
+
currentGroup.entries[rule.name] = rule.entry;
|
|
81
|
+
previousNode = property;
|
|
82
|
+
}
|
|
83
|
+
return groups;
|
|
84
|
+
}
|
|
85
|
+
function getConfigIgnores(node) {
|
|
86
|
+
return node.type === AST_NODE_TYPES.ObjectExpression && node.properties.length === 1 && node.properties[0].type === AST_NODE_TYPES.Property && node.properties[0].key.type === AST_NODE_TYPES.Identifier && node.properties[0].key.name === "ignores" && node.properties[0].value.type === AST_NODE_TYPES.ArrayExpression && node.properties[0].value.elements.every(
|
|
87
|
+
(element) => element?.type === AST_NODE_TYPES.Literal && typeof element.value === "string"
|
|
88
|
+
) && node.properties[0].value.elements.map(
|
|
89
|
+
(element) => element.value
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function getConfigRulesObject(nodes) {
|
|
93
|
+
const configObject = nodes.find(
|
|
94
|
+
(node) => node.type === AST_NODE_TYPES.ObjectExpression && areArraysEqual(
|
|
95
|
+
node.properties.map(
|
|
96
|
+
(property) => property.type === AST_NODE_TYPES.Property && property.key.type === AST_NODE_TYPES.Identifier ? property.key.name : void 0
|
|
97
|
+
),
|
|
98
|
+
["extends", "files", "languageOptions", "rules", "settings"]
|
|
99
|
+
)
|
|
100
|
+
);
|
|
101
|
+
if (!configObject) {
|
|
102
|
+
return void 0;
|
|
103
|
+
}
|
|
104
|
+
const rulesObject2 = configObject.properties[3];
|
|
105
|
+
return rulesObject2.type === AST_NODE_TYPES.Property && rulesObject2.value.type === AST_NODE_TYPES.ObjectExpression && rulesObject2.value;
|
|
106
|
+
}
|
|
107
|
+
function nodeIsConfigExport(node) {
|
|
108
|
+
return node.type === AST_NODE_TYPES.ExportDefaultDeclaration && node.declaration.type === AST_NODE_TYPES.CallExpression && nodeIsConfigFunction(node.declaration.callee);
|
|
109
|
+
}
|
|
110
|
+
function nodeIsConfigFunction(node) {
|
|
111
|
+
return node.type === AST_NODE_TYPES.MemberExpression && node.object.type === AST_NODE_TYPES.Identifier && node.object.name === "tseslint" && node.property.type === AST_NODE_TYPES.Identifier && node.property.name === "config";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
blockESLintIntake
|
|
116
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const zRuleOptions: z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"off">, z.ZodLiteral<"warn">, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown], null>, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown, z.ZodUnknown], null>]>;
|
|
4
|
+
type RuleOptions = z.infer<typeof zRuleOptions>;
|
|
5
|
+
declare const zExtensionRuleGroup: z.ZodObject<{
|
|
6
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
7
|
+
entries: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"off">, z.ZodLiteral<"warn">, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown], null>, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown, z.ZodUnknown], null>]>>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
entries: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]>;
|
|
10
|
+
comment?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
entries: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]>;
|
|
13
|
+
comment?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
type ExtensionRuleGroup = z.infer<typeof zExtensionRuleGroup>;
|
|
16
|
+
declare const zExtensionRules: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"off">, z.ZodLiteral<"warn">, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown], null>, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown, z.ZodUnknown], null>]>>, z.ZodArray<z.ZodObject<{
|
|
17
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
18
|
+
entries: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"off">, z.ZodLiteral<"warn">, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown], null>, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown, z.ZodUnknown], null>]>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
entries: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]>;
|
|
21
|
+
comment?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
entries: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]>;
|
|
24
|
+
comment?: string | undefined;
|
|
25
|
+
}>, "many">]>;
|
|
26
|
+
type ExtensionRules = z.infer<typeof zExtensionRules>;
|
|
27
|
+
declare const zExtension: z.ZodObject<{
|
|
28
|
+
extends: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
29
|
+
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
30
|
+
languageOptions: z.ZodOptional<z.ZodUnknown>;
|
|
31
|
+
linterOptions: z.ZodOptional<z.ZodUnknown>;
|
|
32
|
+
plugins: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
33
|
+
rules: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"off">, z.ZodLiteral<"warn">, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown], null>, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown, z.ZodUnknown], null>]>>, z.ZodArray<z.ZodObject<{
|
|
34
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
35
|
+
entries: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"off">, z.ZodLiteral<"warn">, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown], null>, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown, z.ZodUnknown], null>]>>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
entries: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]>;
|
|
38
|
+
comment?: string | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
entries: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]>;
|
|
41
|
+
comment?: string | undefined;
|
|
42
|
+
}>, "many">]>>;
|
|
43
|
+
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
files?: string[] | undefined;
|
|
46
|
+
rules?: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]> | {
|
|
47
|
+
entries: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]>;
|
|
48
|
+
comment?: string | undefined;
|
|
49
|
+
}[] | undefined;
|
|
50
|
+
settings?: Record<string, unknown> | undefined;
|
|
51
|
+
extends?: string[] | undefined;
|
|
52
|
+
languageOptions?: unknown;
|
|
53
|
+
linterOptions?: unknown;
|
|
54
|
+
plugins?: Record<string, string> | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
files?: string[] | undefined;
|
|
57
|
+
rules?: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]> | {
|
|
58
|
+
entries: Record<string, "off" | "error" | "warn" | ["error" | "warn", unknown] | ["error" | "warn", unknown, unknown]>;
|
|
59
|
+
comment?: string | undefined;
|
|
60
|
+
}[] | undefined;
|
|
61
|
+
settings?: Record<string, unknown> | undefined;
|
|
62
|
+
extends?: string[] | undefined;
|
|
63
|
+
languageOptions?: unknown;
|
|
64
|
+
linterOptions?: unknown;
|
|
65
|
+
plugins?: Record<string, string> | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
type Extension = z.infer<typeof zExtension>;
|
|
68
|
+
declare const zPackageImport: z.ZodObject<{
|
|
69
|
+
source: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
70
|
+
packageName: z.ZodString;
|
|
71
|
+
version: z.ZodString;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
version: string;
|
|
74
|
+
packageName: string;
|
|
75
|
+
}, {
|
|
76
|
+
version: string;
|
|
77
|
+
packageName: string;
|
|
78
|
+
}>]>;
|
|
79
|
+
specifier: z.ZodString;
|
|
80
|
+
types: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
source: string | {
|
|
83
|
+
version: string;
|
|
84
|
+
packageName: string;
|
|
85
|
+
};
|
|
86
|
+
specifier: string;
|
|
87
|
+
types?: boolean | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
source: string | {
|
|
90
|
+
version: string;
|
|
91
|
+
packageName: string;
|
|
92
|
+
};
|
|
93
|
+
specifier: string;
|
|
94
|
+
types?: boolean | undefined;
|
|
95
|
+
}>;
|
|
96
|
+
|
|
97
|
+
export { type Extension, type ExtensionRuleGroup, type ExtensionRules, type RuleOptions, zExtension, zExtensionRuleGroup, zExtensionRules, zPackageImport, zRuleOptions };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const zRuleOptions = z.union([
|
|
3
|
+
z.literal("error"),
|
|
4
|
+
z.literal("off"),
|
|
5
|
+
z.literal("warn"),
|
|
6
|
+
z.tuple([z.union([z.literal("error"), z.literal("warn")]), z.unknown()]),
|
|
7
|
+
z.tuple([
|
|
8
|
+
z.union([z.literal("error"), z.literal("warn")]),
|
|
9
|
+
z.unknown(),
|
|
10
|
+
z.unknown()
|
|
11
|
+
])
|
|
12
|
+
]);
|
|
13
|
+
const zExtensionRuleGroup = z.object({
|
|
14
|
+
comment: z.string().optional(),
|
|
15
|
+
entries: z.record(z.string(), zRuleOptions)
|
|
16
|
+
});
|
|
17
|
+
const zExtensionRules = z.union([
|
|
18
|
+
z.record(z.string(), zRuleOptions),
|
|
19
|
+
z.array(zExtensionRuleGroup)
|
|
20
|
+
]);
|
|
21
|
+
const zExtension = z.object({
|
|
22
|
+
extends: z.array(z.string()).optional(),
|
|
23
|
+
files: z.array(z.string()).optional(),
|
|
24
|
+
languageOptions: z.unknown().optional(),
|
|
25
|
+
linterOptions: z.unknown().optional(),
|
|
26
|
+
plugins: z.record(z.string(), z.string()).optional(),
|
|
27
|
+
rules: zExtensionRules.optional(),
|
|
28
|
+
settings: z.record(z.string(), z.unknown()).optional()
|
|
29
|
+
});
|
|
30
|
+
const zPackageImport = z.object({
|
|
31
|
+
source: z.union([
|
|
32
|
+
z.string(),
|
|
33
|
+
z.object({ packageName: z.string(), version: z.string() })
|
|
34
|
+
]),
|
|
35
|
+
specifier: z.string(),
|
|
36
|
+
types: z.boolean().optional()
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
zExtension,
|
|
40
|
+
zExtensionRuleGroup,
|
|
41
|
+
zExtensionRules,
|
|
42
|
+
zPackageImport,
|
|
43
|
+
zRuleOptions
|
|
44
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntakeDirectory, IntakeFileEntry } from 'bingo-fs';
|
|
2
2
|
|
|
3
|
-
declare function intakeFile(files: IntakeDirectory, filePath: string[]): IntakeFileEntry | undefined;
|
|
3
|
+
declare function intakeFile(files: IntakeDirectory, filePath: (string | string[])[]): IntakeFileEntry | undefined;
|
|
4
4
|
|
|
5
5
|
export { intakeFile };
|
|
@@ -2,7 +2,14 @@ function intakeFile(files, filePath) {
|
|
|
2
2
|
if (!filePath.length) {
|
|
3
3
|
return void 0;
|
|
4
4
|
}
|
|
5
|
-
const
|
|
5
|
+
const nextPathCandidates = typeof filePath[0] === "string" ? [filePath[0]] : filePath[0];
|
|
6
|
+
const nextFilePath = nextPathCandidates.find(
|
|
7
|
+
(candidate) => candidate in files
|
|
8
|
+
);
|
|
9
|
+
if (!nextFilePath) {
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
12
|
+
const entry = files[nextFilePath];
|
|
6
13
|
if (filePath.length === 1) {
|
|
7
14
|
return Array.isArray(entry) ? entry : void 0;
|
|
8
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var name = "create-typescript-app";
|
|
2
|
-
var version = "2.
|
|
2
|
+
var version = "2.34.0";
|
|
3
3
|
var description = "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁";
|
|
4
4
|
var repository = {
|
|
5
5
|
type: "git",
|
|
@@ -33,6 +33,7 @@ var scripts = {
|
|
|
33
33
|
tsc: "tsc"
|
|
34
34
|
};
|
|
35
35
|
var dependencies = {
|
|
36
|
+
"@typescript-eslint/typescript-estree": "^8.29.1",
|
|
36
37
|
bingo: "^0.5.14",
|
|
37
38
|
"bingo-fs": "^0.5.5",
|
|
38
39
|
"bingo-stratum": "^0.5.11",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-typescript-app",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.34.1",
|
|
4
4
|
"description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"*": "prettier --ignore-unknown --write"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@typescript-eslint/typescript-estree": "^8.29.1",
|
|
40
41
|
"bingo": "^0.5.14",
|
|
41
42
|
"bingo-fs": "^0.5.5",
|
|
42
43
|
"bingo-stratum": "^0.5.11",
|