nearform / nearform/node-test-parser
chore(lint): eslint config comment inverts the "type": "module" rule, and ecmaVersion 2021 caps flat config's default
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5
- Forks
- 4
- Avg merge
- 1m
- Merged PRs (30d)
- 11
Description
Follow-up from the review of #240 (merged), which migrated eslint 8 -> 9 and added a flat config. Two items in eslint.config.mjs, neither affecting current behaviour.
1. The comment inverts the rule it states
eslint.config.mjs currently opens with:
// Flat-config port of the previous .eslintrc. The .mjs extension is required:
// this package is "type": "module".
That is backwards. package.json does declare "type": "module", and that is precisely the case where the .mjs rename is not required — a plain eslint.config.js is already parsed as ESM, so eslint loads it as-is. .mjs is what a CommonJS package needs, in order to write an ESM config in a package whose .js files are CJS.
The reviewer verified this empirically: renaming the file to eslint.config.js and running eslint loaded it fine.
Fix: either rename to eslint.config.js and delete the comment, or keep .mjs (harmless, and eslint resolves it) and correct the comment to say it is a stylistic choice rather than a requirement. Leaving the inverted claim in place will mislead whoever ports the next repo by copying this file.
2. ecmaVersion: 2021 is now the only thing capping the parser
languageOptions: {
ecmaVersion: 2021,
sourceType: 'module',
...
}
2021 was carried over faithfully from the old .eslintrc, which is the right default for a migration PR — it preserves behaviour. But flat config defaults ecmaVersion to latest, so under .eslintrc the cap was one setting among the file's inherited defaults, and now it is an explicit and deliberate-looking restriction. Nothing in the repo needs post-2021 syntax today, so this is not breaking anything; it just means the next person to use, say, Array.prototype.at chaining or newer syntax hits a parse error for no reason.
Fix: drop the ecmaVersion line and let it default to latest. globals.es2021 in the same block can stay or move to globals.es2025 independently — it controls globals, not syntax.
References
- Merged PR: https://github.com/nearform/node-test-parser/pull/240
- Review raising both points: https://github.com/nearform/node-test-parser/pull/240#pullrequestreview-4958809517
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with eslint.config.mjs, then check package.json to confirm the package module type. Correct the misleading .mjs comment or apply the suggested rename, remove the explicit ecmaVersion: 2021 setting, and run ESLint to confirm the configuration still loads successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100