Environment
Node version: v25.3.0
npm version: 11.7.0
Local ESLint version: 10.0.0-rc.0
Global ESLint version: N/A
Operating System: Mac 26.2
What parser are you using?
Default (Espree)
What did you do?
Configuration
export default [
{
files: ["*.js"],
languageOptions: {
sourceType: "script",
},
rules: {
strict: ["error", "global"],
}
}
]
/* Copyright message, or comment explaning why strict is disabled. */
/* eslint-disable strict */
function foo() {
console.log(foo);
}
What did you expect to happen?
No errors
What actually happened?
1:1 error Use the global form of 'use strict' strict
2:1 warning Unused eslint-disable directive (no problems were reported from 'strict')
Link to Minimal Reproducible Example
https://github.com/Standard8/eslint-strict-mode-comment-location
Participation
Additional comments
If the /* eslint-disable strict */ line is on the very first line of the file, then it works. However, if it is not on the very first line then it fails, even if it is before any code.
This prevents situations like shown in the example, where we want to have a copyright message at the start of the file, or even a comment as to why strict mode is being disabled in the file.
This is a regression in the Eslint 10.0.0 series (I checked the alpha & beta and they failed also). Eslint 9.39.2 works fine.
Environment
Node version: v25.3.0
npm version: 11.7.0
Local ESLint version: 10.0.0-rc.0
Global ESLint version: N/A
Operating System: Mac 26.2
What parser are you using?
Default (Espree)
What did you do?
Configuration
What did you expect to happen?
No errors
What actually happened?
Link to Minimal Reproducible Example
https://github.com/Standard8/eslint-strict-mode-comment-location
Participation
Additional comments
If the
/* eslint-disable strict */line is on the very first line of the file, then it works. However, if it is not on the very first line then it fails, even if it is before any code.This prevents situations like shown in the example, where we want to have a copyright message at the start of the file, or even a comment as to why strict mode is being disabled in the file.
This is a regression in the Eslint 10.0.0 series (I checked the alpha & beta and they failed also). Eslint 9.39.2 works fine.