diff --git a/scripts/smoke-init.sh b/scripts/smoke-init.sh index 1f261e6..4921321 100755 --- a/scripts/smoke-init.sh +++ b/scripts/smoke-init.sh @@ -172,5 +172,12 @@ node "$repo_root/dist/index.js" init python-api py-api > py.json test -f py-api/src/py_api/main.py node "$repo_root/dist/index.js" init next-app web-app > next.json test -f web-app/src/app/page.tsx +test -f web-app/eslint.config.mjs +( + cd web-app + npm install + npm run lint + bash scripts/validate.sh +) echo "smoke-init ok" diff --git a/src/index.ts b/src/index.ts index 37d2a53..3f90297 100644 --- a/src/index.ts +++ b/src/index.ts @@ -80,6 +80,7 @@ const templateScaffolds: Record = { { source: 'templates/repo-docs/README.md', destination: 'docs/README.md' }, { source: 'templates/repo-validate/validate.sh', destination: 'scripts/validate.sh' }, { destination: 'package.json', content: nextPackageJsonTemplate() }, + { destination: 'eslint.config.mjs', content: nextEslintConfigTemplate() }, { destination: 'src/app/page.tsx', content: "export default function Home() {\n return
{{PROJECT_NAME}}
;\n}\n" }, { destination: 'src/app/layout.tsx', content: "export default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n \n {children}\n \n );\n}\n" } ] @@ -518,7 +519,7 @@ function nextPackageJsonTemplate(): string { "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "eslint ." }, "dependencies": { "next": "latest", @@ -528,12 +529,25 @@ function nextPackageJsonTemplate(): string { "devDependencies": { "@types/node": "latest", "@types/react": "latest", + "eslint": "latest", + "eslint-config-next": "latest", "typescript": "latest" } } `; } +function nextEslintConfigTemplate(): string { + return `import { defineConfig, globalIgnores } from "eslint/config"; +import nextVitals from "eslint-config-next/core-web-vitals"; + +export default defineConfig([ + ...nextVitals, + globalIgnores([".next/**", "out/**", "build/**", "next-env.d.ts"]) +]); +`; +} + function pythonProjectTemplate(): string { return `[project] name = "{{PROJECT_NAME}}"