ESLint configuration applies Node globals to browser-targeted JavaScript files
- Dominant language
- Python
- Stars
- 3.2k
- Forks
- 459
- Avg merge
- 27d 1h
- Merged PRs (30d)
- 1
Description
Description
The ESLint configuration applies globals.node to all *.js files.
This can cause incorrect linting results when some JavaScript files are intended to run in a browser environment, as Node-specific globals (e.g. process, Buffer) will be considered valid even where they should not be used.
Code concerned
{
files: ['*.js'],
languageOptions: {
globals: {
...globals.node,
},
},
},
Problems
Browser code may incorrectly pass linting
Environment intent (Node vs Browser) is unclear
Potential hidden runtime errors in browsers
Reduced linting accuracy
Expected Behavior
Node globals should only apply to server-side files
Browser files should use globals.browser
Clear separation of environments
Suggested Fix
{
files: ['*.js'],
languageOptions: {
globals: {
...globals.browser,
},
},
},
{
files: ['scripts/**/*.js'],
languageOptions: {
globals: {
...globals.node,
},
},
},
Impact
More accurate linting
Clearer project structure
Fewer environment-related bugs
Better long-term maintainability
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate the ESLint configuration containing the *.js files block and compare it with the scripts/**/*.js pattern shown in the issue. Check how the configuration distinguishes browser-targeted files from server-side scripts. Done means Node globals are limited to server-side files, browser files use browser globals, and linting confirms the intended separation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100