ESLint Blog
フィード

Automating ESLint migrations with Codemod
ESLint Blog
We are excited to announce a partnership between ESLint and Codemod to create a better migration experience for ESLint users, starting with the ESLint v8 to v9 and v9 to v10 migrations. All official ESLint codemods live in eslint/codemods and on the Codemod Registry. Community members are encouraged to open issues for missing codemods or contribute new ones through pull requests. Once reviewed and merged by maintainers, codemods are automatically published to the Codemod Registry through GitHub Actions.What is Codemod?Codemod is an open source platform for building, sharing, and running automated code migrations at scale. It is an OpenJS Foundation partner, and its tooling has been adopted by projects such as React, Node.js, Express, React Router, Nuxt.js, pnpm, Webpack, MSW, i18next, and more.Its platform includes JSSG (JS ast-grep), a codemod runtime and workflow engine that supports multi-step transformations and combines deterministic, compiler-aware transformations with AI-powered
4日前

ESLint v9.39.5 released
ESLint Blog
HighlightsThis release backports a fix originally released in v10.3.0 that prevents ESLint from crashing in host environments where require.cache is unavailable, such as Yarn Plug’n’Play.Bug Fixes253be16 fix: handle unavailable require cache (backport of #20812 to v9.x) (#21065) (Eric)Documentation74930ed docs: switch build to Node.js 24 (#20894) (Milos Djermanovic)eaec8bb docs: Add ESLint v9.x EOL notice (#20828) (Milos Djermanovic)Chores458205f chore: update @eslint/eslintrc and @eslint/js for v9.39.5 (#21077) (Francesco Trotta)202117b chore: package.json update for @eslint/js release (Jenkins)d9eb6ed test: disable warning for vm.constants.USE_MAIN_CONTEXT_DEFAULT_LOADER (#21074) (Francesco Trotta)7b431a7 chore: override re2 dependency for @metascraper/helpers (#21068) (Milos Djermanovic)daf7791 chore: pin [email protected] (#20895) (Milos Djermanovic)daee8ba ci: use pnpm in eslint-flat-config-utils type integration test (#20829) (Milos Djermanovic)116d4be ci: unpin Node.js 25.x in CI (#2
10日前

ESLint v10.7.0 released
ESLint Blog
HighlightsNew option checkConstructorCallCallbacks in max-nested-callbacksThe max-nested-callbacks rule now supports a checkConstructorCallCallbacks option.When enabled, the rule also counts callback functions passed to constructor calls with new, such as new Promise((resolve) => {}), when calculating nesting depth.For example, with { "max": 1, "checkConstructorCallCallbacks": true }, the rule reports the following code as exceeding the allowed callback nesting depth:run(() => { new Promise(resolve => resolve());});123Copy code to clipboard New option errorClassNames in preserve-caught-errorThe preserve-caught-error rule now supports an errorClassNames option.This option lets you specify additional custom error class names that must preserve the original caught error by passing it as a cause.For example, with { "errorClassNames": ["MyError"] }, the following code is reported because the thrown MyError does not include the original error as a cause, just like built-in error types must:t
10日前

CodeRabbit becomes ESLint gold sponsor
ESLint Blog
We are happy to share that CodeRabbit has become an ESLint gold sponsor, donating $1,000 each month for the ongoing maintenance and development of ESLint! CodeRabbit is an AI-powered code review platform that provides fast, context-aware feedback on pull requests. It helps development teams automate and accelerate the code review process, catch bugs and logic errors early, and improve code quality and velocity.Here’s what Santosh Yadav, Principal Developer Advocate at CodeRabbit, had to say about ESLint:“We love Open Source and ESLint is critical for the ecosystem. We want to make Open Source more sustainable for maintainers. ESLint is shipped as part of the CodeRabbit tools, and we love to support our dependencies.”– Santosh Yadav, Principal Developer Advocate, CodeRabbitESLint is extremely grateful for the support of the CodeRabbit team. Donations from sponsors like CodeRabbit allow ESLint to pay contributors for ongoing maintenance and development, helping to make the open-source ec
19日前

ESLint v10.6.0 released
ESLint Blog
HighlightsNew option checkRelationalComparisons in no-constant-binary-expressionESLint v10.6.0 introduces a new option checkRelationalComparisons for the no-constant-binary-expression rule.When enabled, the rule reports relational comparisons using <, <=, >, or >= whose result is always constant based on their literal operands.For example:const value = "a" > "b"; // always `false`1Copy code to clipboard while (0 <= 0) { // always `true` /* ... */}123Copy code to clipboard Rule refinementsThe following rules have been tweaked to improve correctness and ensure more consistent or intuitive behavior in edge cases:max-classes-per-filemax-nested-callbacksno-constant-binary-expressionno-extra-boolean-castno-promise-executor-returnno-throw-literalprefer-exponentiation-operatorprefer-promise-reject-errorsradixFeaturesb1f9106 feat: detect Symbol() and BigInt() in no-constant-binary-expression (#20981) (Taejin Kim)f291007 feat: add checkRelationalComparisons to no-constant-binary-expression (#209
24日前

ESLint v10.5.0 released
ESLint Blog
HighlightsFive core rules now highlight smaller ranges of code to avoid shadowing other problems in editors.Rules max-lines-per-function, max-nested-callbacks, and max-statements now highlight only the function header instead of the entire function.Rules max-depth and no-with now highlight only the first keyword.Several errors in the calculations have been corrected in the max-depth and max-nested-callbacks rules. These bug fixes can result in reporting more linting errors in existing code.Features5ca8c52 feat: correct stack tracking in max-nested-callbacks (#20973) (Pixel998)b565783 feat: report no-with violations at the with keyword (#20971) (Pixel998)2ce032f feat: report max-lines-per-function violations at function head (#20966) (Pixel998)732cb3e feat: report max-nested-callbacks violations at function head (#20967) (Pixel998)f9c138a feat: report max-depth violations on keywords (#20943) (Pixel998)bdb496c feat: correct max-depth handling for else-if chains (#20944) (Pixel998)c29687
1ヶ月前

ESLint v10.4.1 released
ESLint Blog
Bug Fixese557467 fix: update @eslint/plugin-kit version to 0.7.2 (#20930) (Francesco Trotta)d4ce898 fix: propagate failures from delegated commands (#20917) (Minh Vu)f4f3507 fix: prefer-arrow-callback invalid autofix with newline after async (#20916) (kuldeep kumar)c5bc78b fix: false positive for reference in finally block (#20655) (Tanuj Kanti)27538c0 fix: add missing CodePath and CodePathSegment types (#20853) (Pixel998)Documentation61b0add docs: remove deprecated rule from related rules of max-params (#20921) (Tanuj Kanti)305d5b9 docs: remove deprecated rules from related rules section (#20911) (Tanuj Kanti)49b0202 docs: fix display: none of ad (#20901) (Tanuj Kanti)9067f94 docs: switch build to Node.js 24 (#20893) (Milos Djermanovic)c91b041 docs: Update README (GitHub Actions Bot)e349265 docs: clarify semver strings in rule deprecation objects (#20885) (Milos Djermanovic)Choresb0e466b test: add data property to invalid tests cases for rules (#20924) (Tanuj Kanti)f78838b test: add C
2ヶ月前

ESLint v10.4.0 released
ESLint Blog
HighlightsNew includeIgnoreFile() helperThis release introduces the includeIgnoreFile() helper for configuration files that allows for including patterns from .gitignore files or any other files with gitignore-style patterns.Previously available in the external package @eslint/compat, the new includeIgnoreFile helper function is exported from the eslint/config entrypoint and provides an extended API that allows multiple files to be included and patterns to be interpreted relative to the location of those files, which is a common use case for nested .gitignore files.// eslint.config.jsimport { defineConfig, includeIgnoreFile } from "eslint/config";import { fileURLToPath } from "node:url";const rootGitignorePath = fileURLToPath( new URL(".gitignore", import.meta.url));const nestedGitignorePath = fileURLToPath( new URL("some/other/folder/.gitignore", import.meta.url),);export default defineConfig([ includeIgnoreFile([rootGitignorePath, nestedGitignorePath], { // option to interpret patter
2ヶ月前

ESLint v10.3.0 released
ESLint Blog
Highlightsno-unused-private-class-members SuggestionsThe no-unused-private-class-members rule now provides suggestions to remove reported unused private class members.For example, for the following code, in which the rule reports #doSomethingElse as unused:class C { /** * My public method. */ doSomething() { } /** * My private method. */ #doSomethingElse() { }}12345678910111213141516Copy code to clipboard It will now suggest removing #doSomethingElse. After applying the suggestion, the method and related comment will be removed:class C { /** * My public method. */ doSomething() { }}123456789Copy code to clipboard Features379571a feat: add suggestions for no-unused-private-class-members (#20773) (sethamus)Bug Fixesb6ae5cf fix: handle unavailable require cache (#20812) (Simon Podlipsky)6fb3685 fix: rule suggestions cause continuation in class body (#20787) (Milos Djermanovic)Documentation32cc7ab docs: fix typos in docs and comments (#20809) (Tanuj Kanti)7f47937 docs: Update README (GitHu
3ヶ月前

ESLint v10.2.1 released
ESLint Blog
Bug Fixes14be92b fix: model generator yield resumption paths in code path analysis (#20665) (sethamus)84a19d2 fix: no-async-promise-executor false positives for shadowed Promise (#20740) (xbinaryx)af764af fix: clarify language and processor validation errors (#20729) (Pixel998)e251b89 fix: update eslint (#20715) (renovate[bot])Documentationca92ca0 docs: reuse markdown-it instance for markdown filter (#20768) (Amaresh S M)57d2ee2 docs: Enable Eleventy incremental mode for watch (#20767) (Amaresh S M)c1621b9 docs: fix typos in code-path-analyzer.js (#20700) (Ayush Shukla)1418d52 docs: Update README (GitHub Actions Bot)39771e6 docs: Update README (GitHub Actions Bot)71e0469 docs: fix incomplete JSDoc param description in no-shadow rule (#20728) (kuldeep kumar)22119ce docs: clarify scope of for-direction rule with dead code examples (#20723) (Amaresh S M)8f3fb77 docs: document meta.docs.dialects (#20718) (Pixel998)Chores7ddfea9 chore: update dependency prettier to v3.8.2 (#20770) (renovate
3ヶ月前