chore: update eslint configuration and dependencies#448
chore: update eslint configuration and dependencies#448Mahmoud-s-Khedr wants to merge 5 commits intocameri:mainfrom
Conversation
- Simplified linting commands in package.json - Updated eslint and related packages to latest versions - Changed @typescript-eslint packages to a more recent version
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Upgrades the project’s lint tooling from ESLint v8 legacy config to ESLint v9 flat config, updating dependencies and npm scripts to keep linting working with ESLint v9’s configuration model.
Changes:
- Bumped ESLint and TypeScript-ESLint dependencies and added
@eslint/js+@eslint/eslintrc. - Replaced
.eslintrc.js/.eslintignorewith a neweslint.config.jsflat config (including ignore rules). - Updated
lintandlint:reportscripts to the ESLint v9 invocation style.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updates lint scripts and bumps ESLint / TS-ESLint dependencies. |
| package-lock.json | Locks upgraded lint dependency graph for ESLint v9 + TS-ESLint v8. |
| eslint.config.js | Introduces flat config using FlatCompat, and migrates rules/ignores. |
| .eslintrc.js | Removes legacy ESLint config. |
| .eslintignore | Removes legacy ignore file in favor of flat-config ignores. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
package.json
Outdated
| "lint": "eslint ./src ./test", | ||
| "lint:report": "eslint -o .lint-reports/eslint.json -f json ./src ./test", |
eslint.config.js
Outdated
| module.exports = [ | ||
| { | ||
| ignores: ['node_modules', 'dist', '.test-reports', '.coverage', '.nostr', 'tslint.json'], | ||
| }, | ||
| ...compat.config({ | ||
| parser: '@typescript-eslint/parser', | ||
| parserOptions: { | ||
| sourceType: 'module', | ||
| }, | ||
| plugins: ['@typescript-eslint'], | ||
| extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], | ||
| env: { |
eslint.config.js
Outdated
| '@typescript-eslint/no-explicit-any': 'off', | ||
| '@typescript-eslint/no-unused-vars': ['error', { | ||
| argsIgnorePattern: '^_', | ||
| caughtErrors: 'none', | ||
| }], | ||
| '@typescript-eslint/no-unused-expressions': 'off', | ||
| semi: ['error', 'never'], | ||
| quotes: ['error', 'single', { avoidEscape: true }], | ||
| 'sort-imports': ['error', { | ||
| ignoreCase: true, | ||
| allowSeparatedGroups: true, | ||
| }], | ||
| curly: [2, 'multi-line'], | ||
| 'max-len': [ | ||
| 'error', | ||
| { | ||
| code: 120, | ||
| ignoreStrings: true, | ||
| ignoreTemplateLiterals: true, | ||
| ignoreRegExpLiterals: true, | ||
| }, | ||
| ], | ||
| 'comma-dangle': ['error', { | ||
| arrays: 'always-multiline', | ||
| objects: 'always-multiline', | ||
| imports: 'always-multiline', | ||
| exports: 'always-multiline', | ||
| functions: 'ignore', | ||
| }], |
There was a problem hiding this comment.
@Mahmoud-s-Khedr Can we ensure there's a 1:1 between previous and new?
There was a problem hiding this comment.
I reverted to the legacy ESLint setup (.eslintrc.js and .eslintignore) and ran it with ESLINT_USE_FLAT_CONFIG=false so it still works under ESLint 9.
After doing that, the linter started reporting two categories of issues that were not clean before:
@typescript-eslint/no-unused-varsfor unusederrorbindings in manytry/catchblocks@typescript-eslint/no-unused-expressionsin test and*.spec.tsfiles
I patched both in .eslintrc.js to restore the previous behavior as closely as possible.
My suggestion is to keep the legacy config for now. It is still supported in ESLint 9, even though it is removed in ESLint 10, and since we are planning to move to Biome, this should be a reasonable short-term approach.
|
Please fix merge conflicts 🙏 |
Description
This PR upgrades the project linting stack from ESLint v8 (legacy config) to ESLint v9 (flat config) while preserving current lint behavior.
Changes included:
eslintto^9.39.4@typescript-eslint/eslint-pluginto^8.58.1@typescript-eslint/parserto^8.58.1@eslint/jsand@eslint/eslintrc.eslintrc.js.eslintignoreeslint.config.js(flat config) with migrated ignore rules and TypeScript setuplint:eslint ./src ./testlint:report:eslint -o .lint-reports/eslint.json -f json ./src ./testpackage-lock.jsonto reflect dependency changesRelated Issue
#443
Motivation and Context
ESLint v9 no longer supports
.eslintrc.*as the default config path and expects flat config (eslint.config.js).Without this migration, linting fails under ESLint v9 and blocks local hooks/CI lint steps.
This change modernizes the lint setup and keeps behavior aligned with the existing codebase.
How Has This Been Tested?
Executed locally on Node version from
.nvmrc(v24.14.1):npm installnpm run lintnpm run lint:reportnpm run build:checkAll commands completed successfully after migration.
Types of changes
Checklist: