feat(): SMX-242 - migrate to ESLint 9 flat config#2804
Open
danielochoa-epam wants to merge 18 commits intomasterfrom
Open
feat(): SMX-242 - migrate to ESLint 9 flat config#2804danielochoa-epam wants to merge 18 commits intomasterfrom
danielochoa-epam wants to merge 18 commits intomasterfrom
Conversation
- 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
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
eslint.config.mjs: Flat config format using@bigcommerce/eslint-configvendor/folder with pre-built eslint-config tarballs for CI compatibilitypackage-lock.json: Updated lockfile with vendored tarball entries@typescript-eslint/eslint-plugin-tslint(incompatible with ESLint 9)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