Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Change Request: Remove `nodejsScope` option of eslint-scope

Open
#697 3 comments 0 reactions 1 assignee View on GitHub

@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

accepted breaking enhancement
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from eslint/js

All issues in eslint/js

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.