Skip to content

feat(): SMX-242 - migrate to ESLint 9 flat config#2804

Open
danielochoa-epam wants to merge 18 commits intomasterfrom
SMX-242
Open

feat(): SMX-242 - migrate to ESLint 9 flat config#2804
danielochoa-epam wants to merge 18 commits intomasterfrom
SMX-242

Conversation

@danielochoa-epam
Copy link

@danielochoa-epam danielochoa-epam commented Feb 3, 2026

What/Why?

Migrates checkout-js from ESLint 8 (legacy eslintrc format) to ESLint 9 (flat config format) as part of the organization-wide ESLint 9 migration initiative.

Changes:

  • New eslint.config.mjs: Flat config format using @bigcommerce/eslint-config
  • Vendored dependencies: Added vendor/ folder with pre-built eslint-config tarballs for CI compatibility
  • Regenerated package-lock.json: Updated lockfile with vendored tarball entries
  • Removed legacy dependency: Removed unused @typescript-eslint/eslint-plugin-tslint (incompatible with ESLint 9)
  • Merged latest master: Resolved merge conflicts with upstream changes
  • Code fixes: Updated source files to comply with new ESLint 9 rules

Key dependency changes:

  • eslint: 8.x → 9.x
  • @bigcommerce/eslint-config: npm (2.6.1) → vendored tarball (2.12.0)
  • @bigcommerce/eslint-plugin: npm (1.4.0) → vendored tarball (1.4.0)
  • @typescript-eslint/eslint-plugin-tslint: removed (ESLint 8 only)

Rollout/Rollback

Rollout: Standard PR merge process. No feature flags needed.

Rollback: Revert PR if issues arise. No database migrations.

Testing

  • CI lint passes
  • CI tests pass
  • CI build passes
  • Manual verification of linting in local dev environment

@danielochoa-epam danielochoa-epam requested review from a team as code owners February 3, 2026 00:50
- Merge latest master to resolve conflicts
- Add vendor/ folder with eslint-config and eslint-plugin tarballs
- Update package.json to reference vendored tarballs
- Remove unused @typescript-eslint/eslint-plugin-tslint (incompatible with ESLint 9)
- Regenerate package-lock.json with vendored tarballs
- Remove all 47 per-package .eslintrc.json files that extended
  the now-deleted root .eslintrc.json
- Add core package rule overrides directly to eslint.config.mjs
- ESLint 9 uses flat config (eslint.config.mjs) at the root
@danielochoa-epam danielochoa-epam requested a review from a team as a code owner February 3, 2026 02:33
Each package needs its own eslint config file for Nx's lint executor
to find files to lint. These minimal configs import from the root.
Nx's @nx/eslint:lint executor needs explicit file patterns to know
which files to lint in each package.
Each package's eslint.config.mjs now:
- Imports base config from @bigcommerce/eslint-config
- Sets up parserOptions.project relative to the package directory
- Uses import.meta.dirname for tsconfigRootDir

This fixes "The keyword 'import' is reserved" parsing errors
that occurred when running ESLint from package directories.
The base config's hasPackage('typescript') detection fails in monorepo
environments due to module hoisting. Each package now explicitly imports
and configures @typescript-eslint/parser for .ts and .tsx files.
Removed dependency on @bigcommerce/eslint-config's conditional loading.
Each package now has a standalone flat config that directly imports and
configures @typescript-eslint/parser. This fixes parsing errors in CI.
Nx runs ESLint from the workspace root, so per-package configs weren't
being used. Updated root eslint.config.mjs to directly import and
configure @typescript-eslint/parser instead of relying on the
conditional hasPackage() check in @bigcommerce/eslint-config.

- Removed unused per-package eslint.config.mjs files
- Updated nx.json to reference eslint.config.mjs instead of .eslintrc.json
- Import shared config from @bigcommerce/eslint-config and spread it
- Use projectService instead of project for better monorepo memory efficiency
- Configure import resolver for TypeScript path mappings
- Add jest globals for test files and mock files
- Use nx:run-commands executor instead of @nx/eslint:lint to bypass
  Nx's legacy config mode incompatibility with ESLint 9 flat config
- Remove .eslintignore (rules moved to eslint.config.mjs ignores)

All rules from the shared config remain enabled.
- Import and configure eslint-plugin-testing-library for test files
- Add 'process' global for files using process.env
- Configure testing-library/no-container and testing-library/no-node-access rules
- Create standalone ESLint 9 flat config without depending on shared config
  (shared config requires type-aware parsing which causes issues)
- Auto-fix ~30,000 prettier/formatting warnings
- Add all required plugins: @typescript-eslint, react, jsx-a11y, import,
  testing-library, jest-dom
- Turn off type-aware rules that require project config (can be re-enabled later)
- Disable react-hooks/exhaustive-deps and rules-of-hooks due to plugin
  incompatibility with ESLint 9 (uses deprecated context.getSource API)
- Add global definitions for process, google, Sentry, webpack, etc.
- Ignore file with pre-existing syntax error (Payment.test.tsx)

Lint now passes with 0 errors and ~500 warnings (mostly unused vars)
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.

1 participant