Skip to content

Commit 2e7f410

Browse files
committed
fix: make mapESLintTemplate optional with default value
1 parent 9baa657 commit 2e7f410

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@ export async function create({
234234
skipFiles?: string[];
235235
templates: string[];
236236
getTemplateName: (argv: Argv) => Promise<string>;
237-
mapESLintTemplate: (
237+
/**
238+
* Map the template name to the ESLint template name.
239+
* @default () => 'vanilla-ts'
240+
*/
241+
mapESLintTemplate?: (
238242
templateName: string,
239243
context: { distFolder: string },
240244
) => ESLintTemplateName | null;
@@ -351,9 +355,11 @@ export async function create({
351355
const toolFolder = path.join(packageRoot, `template-${tool}`);
352356

353357
if (tool === 'eslint') {
354-
const eslintTemplateName = mapESLintTemplate(templateName, {
355-
distFolder,
356-
});
358+
const eslintTemplateName = mapESLintTemplate
359+
? mapESLintTemplate(templateName, {
360+
distFolder,
361+
})
362+
: 'vanilla-ts';
357363

358364
if (!eslintTemplateName) {
359365
continue;

test/agents.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ test('should generate AGENTS.md with no tools selected', async () => {
3737
root: fixturesDir,
3838
templates: ['vanilla'],
3939
getTemplateName: async () => 'vanilla',
40-
mapESLintTemplate: () => null,
4140
});
4241

4342
const agentsPath = path.join(projectDir, 'AGENTS.md');
@@ -92,7 +91,6 @@ test('should generate AGENTS.md with single tool selected', async () => {
9291
root: fixturesDir,
9392
templates: ['vanilla'],
9493
getTemplateName: async () => 'vanilla',
95-
mapESLintTemplate: () => null,
9694
});
9795

9896
const agentsPath = path.join(projectDir, 'AGENTS.md');
@@ -205,7 +203,6 @@ test('should merge top-level sections from AGENTS.md files', async () => {
205203
root: fixturesDir,
206204
templates: ['vanilla'],
207205
getTemplateName: async () => 'vanilla',
208-
mapESLintTemplate: () => null,
209206
});
210207

211208
const agentsPath = path.join(projectDir, 'AGENTS.md');

test/custom-tools.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ test('should run extra tool action', async () => {
4545
root: fixturesDir,
4646
templates: ['vanilla'],
4747
getTemplateName: async () => 'vanilla',
48-
mapESLintTemplate: () => null,
4948
extraTools: [
5049
{
5150
value: 'custom-action',
@@ -82,7 +81,6 @@ test('should run extra tool command', async () => {
8281
root: fixturesDir,
8382
templates: ['vanilla'],
8483
getTemplateName: async () => 'vanilla',
85-
mapESLintTemplate: () => null,
8684
extraTools: [
8785
{
8886
value: 'custom-command',

0 commit comments

Comments
 (0)