Angaben zum Datum
Datum aus der Quelle.
Erstmals gesehen am .
ESLint v10.12.0
ESLint v10.12.0 passt Dokumentation und Typdefinitionen von getText(), getLoc() und getRange() in SourceCode an, sodass auch Tokens und Kommentare akzeptiert werden, und korrigiert Randfälle in mehreren Regeln wie consistent-return, new-cap und no-eval.
Highlights
Support for tokens and comments in SourceCode
Rule authors often work with ESLint’s SourceCode object, which represents the JavaScript source code being linted. Its getText(), getLoc(), and getRange() methods have always accepted a node, token, or comment, but the documentation didn’t describe every argument type, and the type definitions rejected some valid calls, such as passing a comment.
This release updates the documentation and type definitions to match the actual behavior. This also aligns these methods with implementations of the core SourceCodeBase interface used in language plugins. Code that calls these methods is unaffected, but TypeScript code that implements or mocks SourceCode may need its getText(), getLoc(), and getRange() signatures updated to accept tokens and comments.
Rule fixes
The following rules have been updated to work correctly in certain edge cases, including autofix behavior and the handling of supplementary Unicode characters in code: