Change Request: Remove `nodejsScope` option of eslint-scope
@mdjermanovic is already working on this.
Since Oct 2, 2025.
- #699 by @mdjermanovic — closed without merging
Assessment
This issue has not been assessed yet.
Description
Which packages would you like to change?
-
espree -
eslint-scope -
eslint-visitor-keys
What problem do you want to solve?
Currently, there are two different ways to enable commonjs scope analysis:
sourceType: "commonjs"nodejsScope: true
The effect is the same.
Furthermore, when the options are sourceType: "module" and nodejsScope: true, eslint-scope creates both the function scope (commonjs wrapper) and the module scope, which seems invalid.
import * as eslintScope from 'eslint-scope';
import * as espree from 'espree';
const code = "class C {}";
const options = {
ecmaVersion: 2025,
sourceType: "module",
nodejsScope: true
};
const ast = espree.parse(code, { range: true, ...options });
const scopeManager = eslintScope.analyze(ast, options);
console.log(scopeManager.scopes.map(scope => scope.type)); // [ 'global', 'function', 'module', 'class' ]
What do you think is the correct solution?
Remove nodejsScope option as redundant for enabling commonjs scope analysis, and potentially problematic when used with sourceType: "module".
Participation
- I am willing to submit a pull request for this change.
Additional comments
No response
- Dominant language
- JavaScript
- Stars
- 2.4k
- Forks
- 234
- Avg merge
- 19m
- Merged PRs (30d)
- 3
Getting set up
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.
More from eslint/js
-
Change Request: Stop publishing declaration map files for espreeMay be free again @sethamus claimed this 113 days ago, and no pull request is open. Openaccepted blocked enhancement
-
Change Request: Add Knip to detect unused dependencies and exportsMay be free again @Pixel998 claimed this 369 days ago, and no pull request is open. Openaccepted enhancement
-
Dependency DashboardOpen
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Expose acorn plugin from espree moduleMay be free again @nzakas claimed this 696 days ago, and no pull request is open. Openaccepted
-
Future of ecmaFeatures.globalReturnMay be free again @Pixel998 claimed this 374 days ago, and no pull request is open. Openaccepted breaking enhancement
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Design only Leadership Survey SLFS
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
bcgov/digital-journeys#2293 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
tursodatabase/turso#9405 ·
Maintainers usually reply within 1 day
-
Toolkit
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
API Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ProjectSidewalk/SidewalkWebpage#5556 ·
Maintainers usually reply within 1 day