Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 31, 2025

Adds CI pipeline for automated linting and build verification on push/PR to main branches.

Changes

  • GitHub Actions workflow (.github/workflows/ci.yml)

    • Lint job: runs ESLint
    • Build job: runs build script, verifies dist/manifest.json exists
    • Node.js 24.x
    • Minimal permissions (contents: read)
    • Uses npm install (no lock file in repo)
  • ESLint configuration (eslint.config.js)

    • Flat config format (ESLint 9.x)
    • ES modules with chrome global for extension scripts
    • CommonJS for scripts/ and icons/ (Node.js)
    • no-undef error, no-unused-vars warn
  • package.json

    • Added eslint@^9.17.0, globals@^15.14.0 dev dependencies
    • Added lint and lint:fix scripts

Usage

npm run lint      # Check for issues
npm run lint:fix  # Auto-fix where possible
Original prompt

生成一下ci吧,lint啊什么的


✨ 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 and others added 2 commits December 31, 2025 15:24
Co-authored-by: hugefiver <18693500+hugefiver@users.noreply.github.com>
Co-authored-by: hugefiver <18693500+hugefiver@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CI setup for linting tools Add CI workflow with ESLint linting and build verification Dec 31, 2025
Copilot AI requested a review from hugefiver December 31, 2025 15:28
@hugefiver hugefiver marked this pull request as ready for review December 31, 2025 15:32
Copilot AI review requested due to automatic review settings December 31, 2025 15:32
@hugefiver
Copy link
Collaborator

@copilot Error: Dependencies lock file is not found in /home/runner/work/request-helper/request-helper. Supported file patterns: package-lock.json,npm-shrinkwrap.json,yarn.lock

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a GitHub Actions CI workflow to automate linting and build verification for the RequestHelper extension. The implementation uses ESLint 9.x with flat config format and creates separate jobs for linting and build verification.

Key changes:

  • Adds GitHub Actions workflow with lint and build jobs triggered on push/PR to main/master branches
  • Configures ESLint 9.x with flat config format, separate configurations for ES modules (extension code) and CommonJS (Node.js scripts)
  • Adds npm scripts for linting with auto-fix capability

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/ci.yml GitHub Actions workflow with separate lint and build jobs using Node.js 20.x and npm caching
eslint.config.js ESLint flat config with browser/Node.js environment separation, custom rules for unused vars and semicolons
package.json Adds eslint and globals dev dependencies, adds lint and lint:fix scripts

cache: 'npm'

- name: Install dependencies
run: npm ci
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow uses npm ci which requires a package-lock.json file, but this file is gitignored according to .gitignore line 6. This will cause the CI to fail because npm ci cannot run without a lock file.

Consider either:

  1. Removing package-lock.json from .gitignore and committing it (recommended for reproducible builds)
  2. Changing npm ci to npm install in the workflow (less strict but works without lock file)

Copilot uses AI. Check for mistakes.
cache: 'npm'

- name: Install dependencies
run: npm ci
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow uses npm ci which requires a package-lock.json file, but this file is gitignored according to .gitignore line 6. This will cause the CI to fail because npm ci cannot run without a lock file.

Consider either:

  1. Removing package-lock.json from .gitignore and committing it (recommended for reproducible builds)
  2. Changing npm ci to npm install in the workflow (less strict but works without lock file)

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +17
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.es2021,
chrome: 'readonly',
},
},
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ESLint configuration treats all .js files as ES modules by default (sourceType: 'module'), but content scripts like content/interceptor.js use IIFE pattern and don't have imports/exports. This may cause linting issues.

Consider adding a separate configuration block for content scripts that sets sourceType to 'script' instead of 'module'.

Copilot uses AI. Check for mistakes.
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'no-undef': 'error',
'no-console': 'off',
'semi': ['warn', 'always'],
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The semi rule is set to 'warn' which encourages semicolon usage, but the existing codebase consistently uses semicolons everywhere. This should be set to 'error' for consistency, or consider using a more comprehensive style guide like StandardJS or Airbnb if the project wants to establish strict style rules.

Suggested change
'semi': ['warn', 'always'],
'semi': ['error', 'always'],

Copilot uses AI. Check for mistakes.
Co-authored-by: hugefiver <18693500+hugefiver@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 31, 2025

@copilot Error: Dependencies lock file is not found in /home/runner/work/request-helper/request-helper. Supported file patterns: package-lock.json,npm-shrinkwrap.json,yarn.lock

Fixed in b9b8767. Changed npm ci to npm install and removed npm caching since package-lock.json is gitignored in this project.

@icceey
Copy link
Owner

icceey commented Dec 31, 2025

@copilot 升级到node 24

Co-authored-by: icceey <33692766+icceey@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 31, 2025

@copilot 升级到node 24

Done in c99bb9c. Upgraded Node.js from 20.x to 24.x in both lint and build jobs.

Copilot AI requested a review from icceey December 31, 2025 16:35
@icceey icceey merged commit 22fd91c into master Dec 31, 2025
2 checks passed
@icceey icceey deleted the copilot/add-ci-linting-setup branch December 31, 2025 16:39
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.

3 participants