Repository navigation
Conversation
Raises eslint to ^9.39.5 (the line eslint-config-next 16 is tested against; 10.x is blocked upstream by next's vendored parser), stops the base no-unused-vars from double-reporting on TypeScript, allows console.warn/error and prunes ignores eslint already applies. Closes SwiftChainn#999
|
@kazeemamudalat3-collab Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Kindly resolve conflicts |
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.
Closes #999
What changed
eslint:^9.0.0->^9.39.5inpackage.json, withpnpm-lock.yamlregenerated by pnpm 9 so CI'spnpm install --frozen-lockfilekeeps working.eslint.config.mjsno-unused-varsoff for**/*.{ts,tsx,mts,cts}and move the^_options onto the TS-aware@typescript-eslint/no-unused-vars(whicheslint-config-nextalready enables). The base rule misreports on TypeScript-only syntax and both rules fired on the same binding.no-consolenow allowsconsole.warn/console.error, so diagnostics no longer needeslint-disablenoise.node_modules/**,.next/**-eslint-config-nextignores.next,out,build,next-env.d.tsitself) and generalisedtsconfig.tsbuildinfoto**/*.tsbuildinfo, addingcoverage/**.services/deliverySocketService.ts+services/driverTrackingService.ts: deleted the 8// eslint-disable-next-line no-consoledirectives that the allow-list made redundant (ESLint began flagging them as unused). The 3 directives that still guard a realconsole.logwere kept.__tests__/eslintConfig.test.ts(new): drives the realeslintCLI over synthetic sources and asserts console filtering, exactly-one unused-var report for TS,_placeholders in args/catch/destructuring, and that generated output is skipped whilelib/*.tsis not.Why not ESLint 10
I installed and ran 10.13.0 on this repo. It cannot work with
eslint-config-nextyet - not at 16.1.6 and not at the current 16.4.2:eslint-config-next's parser isnext/dist/compiled/babel/eslint-parser, whose vendoredScopeManagerhas noaddGlobals(). ESLint 10 calls it inSourceCode#finalize, so every lintable file fails:TypeError: scopeManager.addGlobals is not a function.eslint-plugin-react@7.37.5(latest) still calls the removedcontext.getFilename(), so loadingreact/display-namedies withcontextOrFilename.getFilename is not a functionunlesssettings.react.versionis pinned by hand.Both need releases from Next.js / eslint-plugin-react first. 9.39.5 is the highest version that actually lints this repo.
Measured effect (
pnpm run lint, same eslint build both sides)271 warnings gone: duplicate/false
no-unused-vars(384 -> 157),no-console(56 -> 12) and the 8 disable directives that the new allow-list made redundant. The 12 errors are the identical set of pre-existingreact-hooksv7 findings (hooks/useAnalyticsCharts.ts,hooks/useDriverLocationSocket.ts, ...) plus the parse error below - this PR changes none of them, and I left those app-code fixes out because they are behaviour-sensitive and belong in their own PRs.Heads-up:
mainis already redCI on
c3efa23fails, and locally on a clean checkout ofmain:pnpm run type-checkerrors only incomponents/escrow/__tests__/HighValueCargoMultiSigModal.test.tsx(TS1003/TS1005 - the file is two test suites spliced together and was committed in that state by403887d),pnpm testfails 216 of 2627 tests, andpnpm run buildfails onapp/layout.tsx(Property 'children' is missing in type '{ isDarkMode: false }'). So the "type-check passes strictly" criterion is unreachable from a lint-config change alone; say the word and I will fold the two-file repair into this PR.Verification
pnpm install+pnpm install --frozen-lockfileresolve the regenerated lockfilepnpm exec jest __tests__/eslintConfig.test.ts-> 4 passedpnpm exec eslint eslint.config.mjs __tests__/eslintConfig.test.ts-> exit 0pnpm exec tsc --noEmit-> no new errors (only the pre-existing corrupted test file)pnpm test-> 2411 passed / 216 failed, same asmain; the 6 failures inservices/driverTrackingService.test.tsreproduce unchanged with the pre-PR version of that file, so the directive removal did not affect them