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