From 3a70d1c59646ac336b02b8379fb103ee8e546c0c Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 2 Oct 2023 17:23:43 +0200 Subject: [PATCH] feat: always run build || exit 0 before lint in CI --- .github/DEVELOPMENT.md | 2 ++ script/migrate-test-e2e.js | 1 - .../writing/creation/dotGitHub/createDevelopment.test.ts | 4 ++++ src/steps/writing/creation/dotGitHub/createDevelopment.ts | 2 ++ src/steps/writing/creation/dotGitHub/createWorkflows.test.ts | 2 ++ src/steps/writing/creation/dotGitHub/createWorkflows.ts | 2 +- 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/DEVELOPMENT.md b/.github/DEVELOPMENT.md index 9eba98768..f578754a2 100644 --- a/.github/DEVELOPMENT.md +++ b/.github/DEVELOPMENT.md @@ -56,6 +56,8 @@ For example, ESLint can be run with `--fix` to auto-fix some lint rule complaint pnpm run lint --fix ``` +Note that you'll likely need to run `pnpm build` before `pnpm lint` so that lint rules which check the file system can pick up on any built files. + ## Testing [Vitest](https://vitest.dev) is used for tests. diff --git a/script/migrate-test-e2e.js b/script/migrate-test-e2e.js index ad5082343..24afec867 100644 --- a/script/migrate-test-e2e.js +++ b/script/migrate-test-e2e.js @@ -35,7 +35,6 @@ const filesExpectedToBeChanged = new Set([ ".eslintignore", ".eslintrc.cjs", ".github/DEVELOPMENT.md", - ".github/workflows/lint.yml", ".github/workflows/lint-knip.yml", ".github/workflows/test.yml", ".gitignore", diff --git a/src/steps/writing/creation/dotGitHub/createDevelopment.test.ts b/src/steps/writing/creation/dotGitHub/createDevelopment.test.ts index ec8dac2fd..920f5d614 100644 --- a/src/steps/writing/creation/dotGitHub/createDevelopment.test.ts +++ b/src/steps/writing/creation/dotGitHub/createDevelopment.test.ts @@ -109,6 +109,8 @@ describe("createDevelopment", () => { pnpm run lint --fix \`\`\` + Note that you'll likely need to run \`pnpm build\` before \`pnpm lint\` so that lint rules which check the file system can pick up on any built files. + ## Testing [Vitest](https://vitest.dev) is used for tests. @@ -215,6 +217,8 @@ describe("createDevelopment", () => { pnpm run lint --fix \`\`\` + Note that you'll likely need to run \`pnpm build\` before \`pnpm lint\` so that lint rules which check the file system can pick up on any built files. + ## Testing [Vitest](https://vitest.dev) is used for tests. diff --git a/src/steps/writing/creation/dotGitHub/createDevelopment.ts b/src/steps/writing/creation/dotGitHub/createDevelopment.ts index 4cc160002..04bac2396 100644 --- a/src/steps/writing/creation/dotGitHub/createDevelopment.ts +++ b/src/steps/writing/creation/dotGitHub/createDevelopment.ts @@ -81,6 +81,8 @@ ESLint can be run with \`--fix\` to auto-fix some lint rule complaints:` pnpm run lint --fix \`\`\` +Note that you'll likely need to run \`pnpm build\` before \`pnpm lint\` so that lint rules which check the file system can pick up on any built files. + ${ !options.excludeTests && `## Testing diff --git a/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts b/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts index 1b076a18a..484c1bd44 100644 --- a/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts +++ b/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts @@ -192,6 +192,7 @@ describe("createWorkflows", () => { steps: - uses: actions/checkout@v4 - uses: ./.github/actions/prepare + - run: pnpm build || true - run: pnpm lint name: Lint @@ -363,6 +364,7 @@ describe("createWorkflows", () => { steps: - uses: actions/checkout@v4 - uses: ./.github/actions/prepare + - run: pnpm build || true - run: pnpm lint name: Lint diff --git a/src/steps/writing/creation/dotGitHub/createWorkflows.ts b/src/steps/writing/creation/dotGitHub/createWorkflows.ts index 84a1026f0..901cf4cf0 100644 --- a/src/steps/writing/creation/dotGitHub/createWorkflows.ts +++ b/src/steps/writing/creation/dotGitHub/createWorkflows.ts @@ -91,7 +91,7 @@ export function createWorkflows(options: Options) { }), "lint.yml": createWorkflowFile({ name: "Lint", - runs: ["pnpm lint"], + runs: ["pnpm build || true", "pnpm lint"], }), ...(!options.excludeLintKnip && { "lint-knip.yml": createWorkflowFile({