ESLint Blog
フィード

Retiring the contributor pool
ESLint Blog
Back in 2022, we shared our plan to pay all contributors for non-trivial contributions to ESLint. Our belief was that all contributions of a certain size are valuable and it didn’t make sense to pay team members for their pull requests and not pay anything for work done by outsider contributors. We decided that people deserved to be compensated for taking the time out of their day to contribute regardless if this was their only contribution or an ongoing one. For outsider contributors, we called this the contributor pool.What was the contributor pool?The contributor pool was a pool of money set aside each month to pay outsider contributors for meaningful contributions to the project. Initially we started with a $1,000/month pool before moving to a 10% of monthly income pool. Eligible contributions could be pull requests (even documentation updates), helping answer questions in Discord, or anything else that was a net benefit to the project as a whole. We hoped that doing so would encou
4日前

ESLint v10.15.0 released
ESLint Blog
HighlightsFaster config resolutionThis release includes an updated version of @eslint/config-array with a faster implementation of config resolution. This is the step in which ESLint decides, for every file and directory it visits, whether the path is ignored and which objects in the config apply to it.In our benchmark, which resolves the configs for 1,500 files against a typical flat config, this step is more than three times faster with POSIX paths and about 15% faster with Windows paths. The improvements, made primarily with AI assistance, include:A config object’s files and ignores patterns are analyzed only once instead of once per file.Paths that cannot match a pattern’s literal parts, such as the src/ or .js in src/**/*.js, are rejected before the full glob match runs.For POSIX paths, a file’s location relative to the base path is now computed more efficiently when the path is already normalized.Config resolution is only one part of an ESLint run, so the effect on total lint tim
4日前

ESLint now officially supports linting of shell scripts
ESLint Blog
Back in July of 2024 we announced ourplan to make ESLint a more general-purpose linter capable of linting anylanguage. Since then, we’ve added official support for JSON, Markdown, and CSS.Today, we’re happy to add shell scripts to that list with the introduction ofthe @eslint/shell plugin.Shell linting with @eslint/shellThe @eslint/shell plugin is anofficially supported language plugin for ESLint. It provides parsing for shellscripts, a set of rules inspired by ShellCheck,and a recommended configuration. To use it, install it from npm:npm install @eslint/shell -D1Copy code to clipboard Then add the recommended configuration to your eslint.config.js:import { defineConfig } from "eslint/config";import shell from "@eslint/shell";export default defineConfig([ { plugins: { shell }, extends: ["shell/recommended"], },]);123456789Copy code to clipboard The recommended configuration uses Bash and enables rules that catch commonproblems, such as unquoted expansions, unused variables, and unsafe
11日前

ESLint v10.14.0 released
ESLint Blog
HighlightsIn ESLint v10.14.0, the following rules have been updated to avoid incorrect or unexpected behavior in some edge cases:func-name-matchingno-invalid-thisno-restricted-globalsobject-shorthandyodaFeaturesd23a7f9 feat: fix property descriptor handling in func-name-matching (#21400) (xbinaryx)Bug Fixes4a12580 fix: require minimatch 10.2.6 to avoid vulnerable brace-expansion (#21460) (lumir)827a8f3 fix: no-restricted-globals crash on global objects as property values (#21449) (xbinaryx)161558a fix: handle LS, PS and empty hashbang comments (#21419) (lumir)6194939 fix: no-invalid-this crash on accessor fields without initializer (#21442) (xbinaryx)9155e14 fix: Update @humanfs/node dependency version (#21434) (Nicholas C. Zakas)cb2b9d4 fix: avoid invalid object-shorthand fixes for super methods (#21323) (dvd233)5ee3915 fix: yoda invalid autofix at statement start (#21424) (Daniel Pinto)Documentation0f94f47 docs: remove zh-hans from docs language switcher (#21437) (lumir)dab466e docs:
18日前

ESLint v10.13.0 released
ESLint Blog
HighlightsSeveral core rules have been updated to report more linting problems.no-use-before-defineThe no-use-before-define rule has been updated to account for the fact that IIFEs execute immediately by treating them as part of the execution context where they are defined and called.This change can produce more linting errors in cases such as the following:/* eslint no-use-before-define: ["error", { variables: false }] */(() => { console.log(foo); // 'foo' was used before it was defined.})();const foo = "bar";1234567Copy code to clipboard no-obj-callsThe no-obj-calls rule has been updated to report calls to globalThis./* eslint no-obj-calls: "error" */const foo = globalThis(); // 'globalThis' is not a function.const bar = new globalThis(); // 'globalThis' is not a function.12345Copy code to clipboard no-unsafe-optional-chainingThe no-unsafe-optional-chaining rule has been updated to report unsafe usage of optional chaining in arguments of yield*./* eslint no-unsafe-optional-chaining:
1ヶ月前

ESLint v10.12.0 released
ESLint Blog
HighlightsSupport for tokens and comments in SourceCodeRule 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 fixesThe following rules have been updated to work correctly in certain edge cases, including autofix behavior and the handling of supplementary Unicode characters in code:consistent-retur
2ヶ月前

ESLint v10.11.0 released
ESLint Blog
HighlightsFaster startup and lintingThis release includes a set of performance improvements across ESLint’s core linting pipeline and the stylish formatter. Linting results and the public API are unchanged: the same files produce the same messages as before, just faster.The main improvements are:Startup. Loading the eslint package no longer eagerly initializes the JSON Schema validator used for rule options. It’s now created the first time a rule’s options actually need to be validated, which removes about 45 modules from the initial dependency graph and reduces package load time by 20–25%.Rule execution. When ESLint traverses a file’s structure, it has to decide, for every piece of code, which rules are interested in it and then call those rules. This is the most frequently executed part of the linting process, and it now takes a shorter route in the most common cases. Common node selector types are handled by fast paths, and rule visitors are invoked directly whenever possible instea
2ヶ月前

ESLint v10.10.0 released
ESLint Blog
HighlightsThe no-unexpected-multiline rule has been updated to check regular expression literals with d and v flags./* eslint no-unexpected-multiline: "error" */// Unexpected newline between numerator and division operatorfoo = bar/regex/v.exec(baz).forEach(qux);12345Copy code to clipboard The following rules have also been updated to avoid incorrect or unexpected behavior in some edge cases:new-capno-extra-bindno-unreachableprefer-object-has-ownFeatures264b434 feat: add d and v flags to no-unexpected-multiline (#21305) (Gihyeon Jeong / 정기현)c6cc6c5 feat: check Object.prototype property names in new-cap (#21269) (crimsonjay0)5661fa6 feat: no-extra-bind false negatives with class fields and static blocks (#21260) (synthex-byte)Bug Fixesbb47dc6 fix: update dependency file-entry-cache to v11 (#20801) (Milos Djermanovic)427ac0a fix: use format strings in debug calls (#21247) (Francesco Trotta)9d81532 fix: support __proto__ in /* exported */ comments (#21261) (sethamus)87e0a08 fix: prefer-ob
2ヶ月前

ESLint v10.9.1 released
ESLint Blog
HighlightsThis patch release fixes false positives in the no-loss-of-precision rule that were introduced in v10.9.0.Bug Fixes1e641c9 fix: no-loss-of-precision false positive with trailing decimal point (#21251) (Aleksandr Shoronov)Documentationad74a8d docs: add deprecation steps for EOL package versions (#21248) (Francesco Trotta)Chores3c3ae53 chore: update ecosystem plugins (#21249) (ESLint Bot)
3ヶ月前

ESLint v10.9.0 released
ESLint Blog
HighlightsNew option checkConditionalExpressions in no-unmodified-loop-conditionThe no-unmodified-loop-condition rule now supports a checkConditionalExpressions option.When enabled, each branch in a ternary expression is checked independently.For example, with { "checkConditionalExpressions": true }, the rule reports the done variable as not modified in the loop:let chunk = getInitialChunk();let done = false;while (chunk ? !done : false) { chunk = nextOrNull();}123456Copy code to clipboard Features08de88e feat: handle underflow in no-loss-of-precision (#21218) (Rithish S)55db479 feat: add checkConditionalExpressions to no-unmodified-loop-condition (#21175) (sethamus)Bug Fixes2ba3025 fix: prevent unsafe no-var autofix with hoisted functions (#21213) (sethamus)8e69622 fix: Prevent no-var autofix when var is shadowed by catch parameter (#21204) (Yang Hyeonjong)684b579 fix: prefer-template invalid autofix creates a tagged template call (#21207) (김채영)Documentation9ef407a docs: use eslint.co
3ヶ月前