Skip to content

Add GitHub Actions workflow to enforce ESLint on PRs#6

Merged
JohnMarsden24 merged 8 commits into
mainfrom
copilot/add-linting-workflow
Jan 2, 2026
Merged

Add GitHub Actions workflow to enforce ESLint on PRs#6
JohnMarsden24 merged 8 commits into
mainfrom
copilot/add-linting-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 2, 2026

Adds automated linting checks that block PR merges when code style violations are detected.

Changes

  • .github/workflows/lint.yml: New workflow that runs linting on all PRs
    • Uses Node.js 20 with npm caching
    • Explicit contents: read permissions per security best practices
    • Runs npm run lint to check for linting errors
    • Fails workflow on non-zero exit from ESLint

Behavior

The workflow runs automatically on PR creation and updates. It will:

  1. Check code for linting errors using ESLint
  2. Block merge via required status checks if linting errors are found (requires branch protection configuration in repository settings)

The workflow does not attempt to automatically fix linting issues - developers must fix any reported errors manually before the PR can be merged.

Original prompt

create a workflow which runs on PRs which checks linting and blocks merging if linting fails


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add linting workflow to block PR merges on failure Add GitHub Actions workflow to enforce ESLint on PRs Jan 2, 2026
Copilot AI requested a review from JohnMarsden24 January 2, 2026 11:20
@JohnMarsden24
Copy link
Copy Markdown
Owner

@copilot check the workflow, it's failing I think we need to add a command to fix linting issues

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 2, 2026

@copilot check the workflow, it's failing I think we need to add a command to fix linting issues

I've updated the workflow to automatically fix linting issues that can be auto-fixed. The changes include:

  1. Added lint:fix script to package.json (commit 1754b08)
  2. Updated workflow to run npm run lint:fix before the final check (commit 1754b08)
  3. The workflow now commits and pushes any auto-fixes (commit 28788ec)
  4. Final lint check still runs to ensure all issues are resolved

The workflow will now:

  • Attempt to auto-fix fixable issues
  • Commit and push those fixes automatically
  • Still fail if there are non-fixable linting errors (like the current react-refresh/only-export-components error in CartContext.tsx)

You can also manually run npm run lint:fix locally to fix issues before committing.

Copilot AI changed the title Add GitHub Actions workflow to enforce ESLint on PRs Add GitHub Actions workflow to enforce ESLint on PRs with auto-fix Jan 2, 2026
Copilot AI requested a review from JohnMarsden24 January 2, 2026 11:29
@JohnMarsden24
Copy link
Copy Markdown
Owner

@copilot the lint fix script was added in another PR so rebase and remove it from this PR commit. We also just want to check linting in the workflow, not fix it, go back to the original commit

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 2, 2026

@copilot the lint fix script was added in another PR so rebase and remove it from this PR commit. We also just want to check linting in the workflow, not fix it, go back to the original commit

Reverted the workflow and package.json to the original simple linting check (commit 6a3118e). The changes:

  • Removed lint:fix script from package.json
  • Reverted workflow to just run npm run lint without auto-fixing
  • Changed permissions back to contents: read
  • Removed all auto-fix and commit/push logic

The workflow now only checks linting and blocks merging if it fails.

@JohnMarsden24 JohnMarsden24 marked this pull request as ready for review January 2, 2026 11:36
Copilot AI changed the title Add GitHub Actions workflow to enforce ESLint on PRs with auto-fix Add GitHub Actions workflow to enforce ESLint on PRs Jan 2, 2026
Copilot AI and others added 8 commits January 2, 2026 11:36
Co-authored-by: JohnMarsden24 <55828757+JohnMarsden24@users.noreply.github.com>
Co-authored-by: JohnMarsden24 <55828757+JohnMarsden24@users.noreply.github.com>
Co-authored-by: JohnMarsden24 <55828757+JohnMarsden24@users.noreply.github.com>
Co-authored-by: JohnMarsden24 <55828757+JohnMarsden24@users.noreply.github.com>
Co-authored-by: JohnMarsden24 <55828757+JohnMarsden24@users.noreply.github.com>
Co-authored-by: JohnMarsden24 <55828757+JohnMarsden24@users.noreply.github.com>
@JohnMarsden24 JohnMarsden24 force-pushed the copilot/add-linting-workflow branch from 6a3118e to 5b24f07 Compare January 2, 2026 11:37
@JohnMarsden24 JohnMarsden24 merged commit 59d467d into main Jan 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants