create-typescript-app 2.24.5 → 2.25.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.
package/lib/base.d.ts CHANGED
@@ -13,16 +13,16 @@ declare const base: bingo_stratum.Base<{
13
13
  name: z.ZodString;
14
14
  profile: z.ZodString;
15
15
  }, "strip", z.ZodTypeAny, {
16
+ name: string;
16
17
  avatar_url: string;
17
18
  contributions: string[];
18
19
  login: string;
19
- name: string;
20
20
  profile: string;
21
21
  }, {
22
+ name: string;
22
23
  avatar_url: string;
23
24
  contributions: string[];
24
25
  login: string;
25
- name: string;
26
26
  profile: string;
27
27
  }>, "many">>;
28
28
  description: z.ZodDefault<z.ZodString>;
@@ -97,11 +97,11 @@ declare const base: bingo_stratum.Base<{
97
97
  href: z.ZodString;
98
98
  title: z.ZodString;
99
99
  }, "strip", z.ZodTypeAny, {
100
- href: string;
101
100
  title: string;
102
- }, {
103
101
  href: string;
102
+ }, {
104
103
  title: string;
104
+ href: string;
105
105
  }>>;
106
106
  keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
107
107
  logo: z.ZodOptional<z.ZodObject<{
@@ -140,15 +140,15 @@ declare const base: bingo_stratum.Base<{
140
140
  }, "strip", z.ZodTypeAny, {
141
141
  dependencies?: Record<string, string> | undefined;
142
142
  devDependencies?: Record<string, string> | undefined;
143
+ scripts?: Record<string, string> | undefined;
143
144
  peerDependencies?: Record<string, string> | undefined;
144
145
  peerDependenciesMeta?: Record<string, unknown> | undefined;
145
- scripts?: Record<string, string> | undefined;
146
146
  }, {
147
147
  dependencies?: Record<string, string> | undefined;
148
148
  devDependencies?: Record<string, string> | undefined;
149
+ scripts?: Record<string, string> | undefined;
149
150
  peerDependencies?: Record<string, string> | undefined;
150
151
  peerDependenciesMeta?: Record<string, unknown> | undefined;
151
- scripts?: Record<string, string> | undefined;
152
152
  }>>;
153
153
  pnpm: z.ZodOptional<z.ZodString>;
154
154
  repository: z.ZodString;
@@ -2,7 +2,10 @@ import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockESLint: bingo_stratum.BlockWithAddons<{
4
4
  imports: {
5
- source: string;
5
+ source: string | {
6
+ version: string;
7
+ packageName: string;
8
+ };
6
9
  specifier: string;
7
10
  types?: boolean | undefined;
8
11
  }[];
@@ -43,7 +43,10 @@ const zExtension = z.object({
43
43
  settings: z.record(z.string(), z.unknown()).optional()
44
44
  });
45
45
  const zPackageImport = z.object({
46
- source: z.string(),
46
+ source: z.union([
47
+ z.string(),
48
+ z.object({ packageName: z.string(), version: z.string() })
49
+ ]),
47
50
  specifier: z.string(),
48
51
  types: z.boolean().optional()
49
52
  });
@@ -72,7 +75,7 @@ ${explanation2}
72
75
  'import eslint from "@eslint/js";',
73
76
  'import tseslint from "typescript-eslint";',
74
77
  ...imports.map(
75
- (packageImport) => `import ${packageImport.specifier} from "${packageImport.source}"`
78
+ (packageImport) => `import ${packageImport.specifier} from "${typeof packageImport.source === "string" ? packageImport.source : packageImport.source.packageName}"`
76
79
  )
77
80
  ].sort(
78
81
  (a, b) => a.replace(/.+from/, "").localeCompare(b.replace(/.+from/, ""))
@@ -154,16 +157,26 @@ Each should be shown in VS Code, and can be run manually on the command-line:
154
157
  }),
155
158
  blockPackageJson({
156
159
  properties: {
157
- devDependencies: getPackageDependencies(
158
- "@eslint/js",
159
- "@types/node",
160
- "eslint",
161
- "typescript-eslint",
162
- ...imports.flatMap(({ source, types }) => {
163
- const { name } = parsePackageName(source);
164
- return types ? [name, `@types/${name}`] : [name];
165
- })
166
- ),
160
+ devDependencies: {
161
+ ...getPackageDependencies(
162
+ "@eslint/js",
163
+ "@types/node",
164
+ "eslint",
165
+ "typescript-eslint",
166
+ ...imports.filter((imported) => typeof imported.source === "string").flatMap(({ source, types }) => {
167
+ const { name } = parsePackageName(source);
168
+ return types ? [name, `@types/${name}`] : [name];
169
+ })
170
+ ),
171
+ ...Object.fromEntries(
172
+ imports.filter(
173
+ (imported) => typeof imported.source === "object"
174
+ ).map((imported) => [
175
+ imported.source.packageName,
176
+ imported.source.version
177
+ ])
178
+ )
179
+ },
167
180
  scripts: {
168
181
  lint: "eslint . --max-warnings 0"
169
182
  }
@@ -0,0 +1,72 @@
1
+ import * as bingo_stratum from 'bingo-stratum';
2
+
3
+ declare const blockESLintPlugin: bingo_stratum.BlockWithoutAddons<{
4
+ access: "public" | "restricted";
5
+ description: string;
6
+ directory: string;
7
+ documentation: {
8
+ readme: {
9
+ usage: string;
10
+ additional?: string | undefined;
11
+ explainer?: string | undefined;
12
+ footnotes?: string | undefined;
13
+ };
14
+ development?: string | undefined;
15
+ };
16
+ email: {
17
+ github: string;
18
+ npm: string;
19
+ };
20
+ title: string;
21
+ node: {
22
+ minimum: string;
23
+ pinned?: string | undefined;
24
+ };
25
+ owner: string;
26
+ repository: string;
27
+ type?: "commonjs" | "module" | undefined;
28
+ author?: string | undefined;
29
+ bin?: string | Record<string, string> | undefined;
30
+ contributors?: {
31
+ avatar_url: string;
32
+ contributions: string[];
33
+ login: string;
34
+ name: string;
35
+ profile: string;
36
+ }[] | undefined;
37
+ emoji?: string | undefined;
38
+ existingLabels?: {
39
+ name: string;
40
+ description: string;
41
+ color: string;
42
+ }[] | undefined;
43
+ funding?: string | undefined;
44
+ guide?: {
45
+ href: string;
46
+ title: string;
47
+ } | undefined;
48
+ keywords?: string[] | undefined;
49
+ logo?: {
50
+ alt: string;
51
+ src: string;
52
+ height?: number | undefined;
53
+ width?: number | undefined;
54
+ } | undefined;
55
+ packageData?: {
56
+ dependencies?: Record<string, string> | undefined;
57
+ devDependencies?: Record<string, string> | undefined;
58
+ peerDependencies?: Record<string, string> | undefined;
59
+ peerDependenciesMeta?: Record<string, unknown> | undefined;
60
+ scripts?: Record<string, string> | undefined;
61
+ } | undefined;
62
+ pnpm?: string | undefined;
63
+ rulesetId?: string | undefined;
64
+ version?: string | undefined;
65
+ words?: string[] | undefined;
66
+ workflowsVersions?: Record<string, Record<string, {
67
+ pinned?: boolean | undefined;
68
+ hash?: string | undefined;
69
+ }>> | undefined;
70
+ }>;
71
+
72
+ export { blockESLintPlugin };
@@ -0,0 +1,226 @@
1
+ import { base } from "../base.js";
2
+ import { blockCSpell } from "./blockCSpell.js";
3
+ import { blockDevelopmentDocs } from "./blockDevelopmentDocs.js";
4
+ import { blockESLint } from "./blockESLint.js";
5
+ import { blockGitHubActionsCI } from "./blockGitHubActionsCI.js";
6
+ import { blockPackageJson } from "./blockPackageJson.js";
7
+ import { blockVitest } from "./blockVitest.js";
8
+ const blockESLintPlugin = base.createBlock({
9
+ about: {
10
+ name: "ESLint Plugin"
11
+ },
12
+ produce() {
13
+ return {
14
+ addons: [
15
+ blockCSpell({
16
+ words: ["eslint-doc-generatorrc.js"]
17
+ }),
18
+ blockDevelopmentDocs({
19
+ sections: {
20
+ Building: {
21
+ innerSections: [
22
+ {
23
+ contents: `
24
+ Run [\`eslint-doc-generator\`](https://github.com/bmish/eslint-doc-generator) to generate Markdown files documenting rules.
25
+
26
+ \`\`\`shell
27
+ pnpm build:docs
28
+ \`\`\`
29
+ `,
30
+ heading: "Building Docs"
31
+ }
32
+ ]
33
+ },
34
+ Linting: {
35
+ contents: {
36
+ items: [
37
+ `- \`pnpm lint:docs\` ([eslint-doc-generator](https://github.com/bmish/eslint-doc-generator)): Generates and validates documentation for ESLint rules`
38
+ ]
39
+ }
40
+ }
41
+ }
42
+ }),
43
+ blockESLint({
44
+ extensions: ['eslintPlugin.configs["flat/recommended"]'],
45
+ ignores: [".eslint-doc-generatorrc.js", "docs/rules/*/*.ts"],
46
+ imports: [
47
+ {
48
+ source: {
49
+ packageName: "eslint-plugin-eslint-plugin",
50
+ version: "6.4.0"
51
+ },
52
+ specifier: "eslintPlugin"
53
+ }
54
+ ]
55
+ }),
56
+ blockGitHubActionsCI({
57
+ jobs: [
58
+ {
59
+ name: "Lint Docs",
60
+ steps: [
61
+ { run: "pnpm build || exit 0" },
62
+ { run: "pnpm lint:docs" }
63
+ ]
64
+ }
65
+ ]
66
+ }),
67
+ blockPackageJson({
68
+ properties: {
69
+ devDependencies: {
70
+ "eslint-doc-generator": "2.1.0",
71
+ "eslint-plugin-eslint-plugin": "6.4.0"
72
+ },
73
+ peerDependencies: {
74
+ "@typescript-eslint/parser": ">=8",
75
+ eslint: ">=9",
76
+ typescript: ">=5"
77
+ },
78
+ scripts: {
79
+ "build:docs": "eslint-doc-generator",
80
+ "lint:docs": "eslint-doc-generator --check"
81
+ }
82
+ }
83
+ }),
84
+ blockVitest({
85
+ coverage: {
86
+ exclude: ["src/index.ts", "src/rules/index.ts"]
87
+ }
88
+ })
89
+ ],
90
+ files: {
91
+ ".eslint-doc-generatorrc.js": `import prettier from "prettier";
92
+
93
+ /** @type {import('eslint-doc-generator').GenerateOptions} */
94
+ const config = {
95
+ postprocess: async (content, path) =>
96
+ prettier.format(content, {
97
+ ...(await prettier.resolveConfig(path)),
98
+ parser: "markdown",
99
+ }),
100
+ ruleDocTitleFormat: "prefix-name",
101
+ };
102
+
103
+ export default config;
104
+ `
105
+ }
106
+ };
107
+ },
108
+ setup({ options }) {
109
+ const pluginName = options.repository.replace("eslint-plugin-", "");
110
+ return {
111
+ files: {
112
+ src: {
113
+ "index.ts": `import Module from "node:module";
114
+
115
+ import { rules } from "./rules/index.js";
116
+
117
+ const require = Module.createRequire(import.meta.url);
118
+
119
+ const { name, version } =
120
+ // \`import\`ing here would bypass the TSConfig's \`"rootDir": "src"\`
121
+ require("../package.json") as typeof import("../package.json");
122
+
123
+ export const plugin = {
124
+ configs: {
125
+ get recommended() {
126
+ return recommended;
127
+ },
128
+ },
129
+ meta: { name, version },
130
+ rules,
131
+ };
132
+
133
+ const recommended = {
134
+ plugins: {
135
+ "${pluginName}": plugin,
136
+ },
137
+ rules: Object.fromEntries(
138
+ Object.keys(rules).map((rule) => [\`${pluginName}/\${rule}\`, "error"]),
139
+ ),
140
+ };
141
+
142
+ export { rules };
143
+
144
+ export default plugin;
145
+ `,
146
+ rules: {
147
+ "example.test.ts": `import { rule } from "./enums.js";
148
+ import { ruleTester } from "./ruleTester.js";
149
+
150
+ ruleTester.run("enums", rule, {
151
+ invalid: [
152
+ {
153
+ code: \`enum Values {}\`,
154
+ errors: [
155
+ {
156
+ column: 1,
157
+ endColumn: 15,
158
+ endLine: 1,
159
+ line: 1,
160
+ messageId: "enum",
161
+ },
162
+ ],
163
+ },
164
+ ],
165
+ valid: [\`const Values = {};\`, \`const Values = {} as const;\`],
166
+ });
167
+ `,
168
+ "example.ts": `import { createRule } from "../utils.js";
169
+
170
+ export const rule = createRule({
171
+ create(context) {
172
+ return {
173
+ TSEnumDeclaration(node) {
174
+ context.report({
175
+ messageId: "enum",
176
+ node,
177
+ });
178
+ },
179
+ };
180
+ },
181
+ defaultOptions: [],
182
+ meta: {
183
+ docs: {
184
+ description: "Avoid using TypeScript's enums.",
185
+ },
186
+ messages: {
187
+ enum: "This enum will not be allowed under TypeScript's --erasableSyntaxOnly.",
188
+ },
189
+ schema: [],
190
+ type: "problem",
191
+ },
192
+ name: "enums",
193
+ });
194
+ `,
195
+ "index.ts": `import { rule as example } from "./example.js";
196
+
197
+ export const rules = {
198
+ example,
199
+ };
200
+ `,
201
+ "ruleTester.ts": `import { RuleTester } from "@typescript-eslint/rule-tester";
202
+ import * as vitest from "vitest";
203
+
204
+ RuleTester.afterAll = vitest.afterAll;
205
+ RuleTester.it = vitest.it;
206
+ RuleTester.itOnly = vitest.it.only;
207
+ RuleTester.describe = vitest.describe;
208
+
209
+ export const ruleTester = new RuleTester();
210
+ `
211
+ },
212
+ "utils.ts": `import { ESLintUtils } from "@typescript-eslint/utils";
213
+
214
+ export const createRule = ESLintUtils.RuleCreator(
215
+ (name) =>
216
+ \`https://github.com/${options.owner}/${options.repository}/blob/main/docs/rules/\${name}.md\`,
217
+ );
218
+ `
219
+ }
220
+ }
221
+ };
222
+ }
223
+ });
224
+ export {
225
+ blockESLintPlugin
226
+ };
@@ -16,6 +16,7 @@ export { blockESLintMoreStyling } from './blockESLintMoreStyling.js';
16
16
  export { blockESLintNode } from './blockESLintNode.js';
17
17
  export { blockESLintPackageJson } from './blockESLintPackageJson.js';
18
18
  export { blockESLintPerfectionist } from './blockESLintPerfectionist.js';
19
+ export { blockESLintPlugin } from './blockESLintPlugin.js';
19
20
  export { blockESLintRegexp } from './blockESLintRegexp.js';
20
21
  export { blockESLintYML } from './blockESLintYML.js';
21
22
  export { blockFunding } from './blockFunding.js';
@@ -545,7 +546,10 @@ declare const blocks: {
545
546
  }>;
546
547
  blockESLint: bingo_stratum.BlockWithAddons<{
547
548
  imports: {
548
- source: string;
549
+ source: string | {
550
+ version: string;
551
+ packageName: string;
552
+ };
549
553
  specifier: string;
550
554
  types?: boolean | undefined;
551
555
  }[];
@@ -1181,6 +1185,74 @@ declare const blocks: {
1181
1185
  hash?: string | undefined;
1182
1186
  }>> | undefined;
1183
1187
  }>;
1188
+ blockESLintPlugin: bingo_stratum.BlockWithoutAddons<{
1189
+ access: "public" | "restricted";
1190
+ description: string;
1191
+ directory: string;
1192
+ documentation: {
1193
+ readme: {
1194
+ usage: string;
1195
+ additional?: string | undefined;
1196
+ explainer?: string | undefined;
1197
+ footnotes?: string | undefined;
1198
+ };
1199
+ development?: string | undefined;
1200
+ };
1201
+ email: {
1202
+ github: string;
1203
+ npm: string;
1204
+ };
1205
+ title: string;
1206
+ node: {
1207
+ minimum: string;
1208
+ pinned?: string | undefined;
1209
+ };
1210
+ owner: string;
1211
+ repository: string;
1212
+ type?: "commonjs" | "module" | undefined;
1213
+ author?: string | undefined;
1214
+ bin?: string | Record<string, string> | undefined;
1215
+ contributors?: {
1216
+ avatar_url: string;
1217
+ contributions: string[];
1218
+ login: string;
1219
+ name: string;
1220
+ profile: string;
1221
+ }[] | undefined;
1222
+ emoji?: string | undefined;
1223
+ existingLabels?: {
1224
+ name: string;
1225
+ description: string;
1226
+ color: string;
1227
+ }[] | undefined;
1228
+ funding?: string | undefined;
1229
+ guide?: {
1230
+ href: string;
1231
+ title: string;
1232
+ } | undefined;
1233
+ keywords?: string[] | undefined;
1234
+ logo?: {
1235
+ alt: string;
1236
+ src: string;
1237
+ height?: number | undefined;
1238
+ width?: number | undefined;
1239
+ } | undefined;
1240
+ packageData?: {
1241
+ dependencies?: Record<string, string> | undefined;
1242
+ devDependencies?: Record<string, string> | undefined;
1243
+ peerDependencies?: Record<string, string> | undefined;
1244
+ peerDependenciesMeta?: Record<string, unknown> | undefined;
1245
+ scripts?: Record<string, string> | undefined;
1246
+ } | undefined;
1247
+ pnpm?: string | undefined;
1248
+ rulesetId?: string | undefined;
1249
+ version?: string | undefined;
1250
+ words?: string[] | undefined;
1251
+ workflowsVersions?: Record<string, Record<string, {
1252
+ pinned?: boolean | undefined;
1253
+ hash?: string | undefined;
1254
+ }>> | undefined;
1255
+ }>;
1184
1256
  blockESLintRegexp: bingo_stratum.BlockWithoutAddons<{
1185
1257
  access: "public" | "restricted";
1186
1258
  description: string;
@@ -14,6 +14,7 @@ import { blockESLintMoreStyling } from "./blockESLintMoreStyling.js";
14
14
  import { blockESLintNode } from "./blockESLintNode.js";
15
15
  import { blockESLintPackageJson } from "./blockESLintPackageJson.js";
16
16
  import { blockESLintPerfectionist } from "./blockESLintPerfectionist.js";
17
+ import { blockESLintPlugin } from "./blockESLintPlugin.js";
17
18
  import { blockESLintRegexp } from "./blockESLintRegexp.js";
18
19
  import { blockESLintYML } from "./blockESLintYML.js";
19
20
  import { blockFunding } from "./blockFunding.js";
@@ -60,6 +61,7 @@ const blocks = {
60
61
  blockESLintNode,
61
62
  blockESLintPackageJson,
62
63
  blockESLintPerfectionist,
64
+ blockESLintPlugin,
63
65
  blockESLintRegexp,
64
66
  blockESLintYML,
65
67
  blockFunding,
@@ -107,6 +109,7 @@ import { blockESLintMoreStyling as blockESLintMoreStyling2 } from "./blockESLint
107
109
  import { blockESLintNode as blockESLintNode2 } from "./blockESLintNode.js";
108
110
  import { blockESLintPackageJson as blockESLintPackageJson2 } from "./blockESLintPackageJson.js";
109
111
  import { blockESLintPerfectionist as blockESLintPerfectionist2 } from "./blockESLintPerfectionist.js";
112
+ import { blockESLintPlugin as blockESLintPlugin2 } from "./blockESLintPlugin.js";
110
113
  import { blockESLintRegexp as blockESLintRegexp2 } from "./blockESLintRegexp.js";
111
114
  import { blockESLintYML as blockESLintYML2 } from "./blockESLintYML.js";
112
115
  import { blockFunding as blockFunding2 } from "./blockFunding.js";
@@ -154,6 +157,7 @@ export {
154
157
  blockESLintNode2 as blockESLintNode,
155
158
  blockESLintPackageJson2 as blockESLintPackageJson,
156
159
  blockESLintPerfectionist2 as blockESLintPerfectionist,
160
+ blockESLintPlugin2 as blockESLintPlugin,
157
161
  blockESLintRegexp2 as blockESLintRegexp,
158
162
  blockESLintYML2 as blockESLintYML,
159
163
  blockFunding2 as blockFunding,
@@ -1,5 +1,5 @@
1
1
  var name = "create-typescript-app";
2
- var version = "2.24.4";
2
+ var version = "2.24.5";
3
3
  var description = "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁";
4
4
  var repository = {
5
5
  type: "git",
package/lib/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export { blockESLintMoreStyling } from './blocks/blockESLintMoreStyling.js';
23
23
  export { blockESLintNode } from './blocks/blockESLintNode.js';
24
24
  export { blockESLintPackageJson } from './blocks/blockESLintPackageJson.js';
25
25
  export { blockESLintPerfectionist } from './blocks/blockESLintPerfectionist.js';
26
+ export { blockESLintPlugin } from './blocks/blockESLintPlugin.js';
26
27
  export { blockESLintRegexp } from './blocks/blockESLintRegexp.js';
27
28
  export { blockESLintYML } from './blocks/blockESLintYML.js';
28
29
  export { blockFunding } from './blocks/blockFunding.js';
package/lib/schemas.d.ts CHANGED
@@ -7,16 +7,16 @@ declare const zContributor: z.ZodObject<{
7
7
  name: z.ZodString;
8
8
  profile: z.ZodString;
9
9
  }, "strip", z.ZodTypeAny, {
10
+ name: string;
10
11
  avatar_url: string;
11
12
  contributions: string[];
12
13
  login: string;
13
- name: string;
14
14
  profile: string;
15
15
  }, {
16
+ name: string;
16
17
  avatar_url: string;
17
18
  contributions: string[];
18
19
  login: string;
19
- name: string;
20
20
  profile: string;
21
21
  }>;
22
22
  type Contributor = z.infer<typeof zContributor>;
package/lib/template.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { base } from "./base.js";
2
2
  import { blockAreTheTypesWrong } from "./blocks/blockAreTheTypesWrong.js";
3
3
  import { blockCTATransitions } from "./blocks/blockCTATransitions.js";
4
+ import { blockESLintPlugin } from "./blocks/blockESLintPlugin.js";
4
5
  import { blockNcc } from "./blocks/blockNcc.js";
5
6
  import { blockRemoveDependencies } from "./blocks/blockRemoveDependencies.js";
6
7
  import { blockRemoveFiles } from "./blocks/blockRemoveFiles.js";
@@ -18,6 +19,7 @@ const template = base.createStratumTemplate({
18
19
  blocks: [
19
20
  blockAreTheTypesWrong,
20
21
  blockCTATransitions,
22
+ blockESLintPlugin,
21
23
  blockNcc,
22
24
  blockRemoveDependencies,
23
25
  blockRemoveFiles
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.24.5",
3
+ "version": "2.25.0",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
5
5
  "repository": {
6
6
  "type": "git",