Environment
Node version: v22.14.0
npm version: v10.9.2
Local ESLint version: v10.0.2 (Currently used)
Global ESLint version: Not found
Operating System: win32 10.0.26200
What parser are you using?
Default (Espree)
What did you do?
Configuration
import js from "@eslint/js";
import globals from "globals";
import { defineConfig } from "eslint/config";
export default defineConfig([
{ files: ["**/*.{js,mjs,cjs}"], plugins: { js }, extends: ["js/recommended"], languageOptions: { globals: globals.browser } },
]);
function* generator() {
let done = false;
try {
yield 1;
done = true;
} catch {
done = true;
} finally {
if (!done) {
console.log('done is false')
}
}
}
const iterator = generator()[Symbol.iterator]();
iterator.next();
iterator.return();
What did you expect to happen?
No error, since the yield can jump to finally directly
What actually happened?
> pnpm eslint
C:\dev\sandbox\eslint-repro\no-useless-assignment.js
2:7 error This assigned value is not used in subsequent statements no-useless-assignment
✖ 1 problem (1 error, 0 warnings)
Running the script prints
> node .\no-useless-assignment.js
done is false
Showing the initial value is being used.
Link to Minimal Reproducible Example
https://github.com/yume-chan/eslint-repro
Participation
AI acknowledgment
Additional comments
No response
Environment
Node version: v22.14.0
npm version: v10.9.2
Local ESLint version: v10.0.2 (Currently used)
Global ESLint version: Not found
Operating System: win32 10.0.26200
What parser are you using?
Default (Espree)
What did you do?
Configuration
What did you expect to happen?
No error, since the
yieldcan jump tofinallydirectlyWhat actually happened?
Running the script prints
Showing the initial value is being used.
Link to Minimal Reproducible Example
https://github.com/yume-chan/eslint-repro
Participation
AI acknowledgment
Additional comments
No response