github sindresorhus/eslint-plugin-unicorn v79.0.0

5 hours ago

Breaking

  • no-top-level-side-effects: Focus on mutations of globals, and remove it from the unopinionated preset (#3915) 24abac4
    • Unknown calls are no longer reported by default. Enable the new checkUnknownCalls option for stricter checking.
    • Mutations of globals, like document.title = 'x' and Object.assign(globalThis, …), are now reported, also in declarations and default exports. You may see new reports.

Improvements

  • Infer types from JSDoc @type, @param, and @returns annotations in rules that use type information (#3941) 2b4bfab
  • Handle template literals without expressions like strings in more rules (#3943) 8bd8c06
  • Autofix more code that contains comments, while keeping the comments (#3939) 87baf82
  • Fix autofixes in many rules that could produce broken code or wrong parentheses (#3917) fed7eac
  • Make autofixes safer in many rules
    • Fixes that can change behavior in rare cases are now suggestions, for example in prefer-spread, prefer-math-min-max, prefer-modern-dom-apis, and prefer-switch.
  • Improve performance 175efaf 3dd8fd2
  • comment-content: Add ignore option (#3950) 3fe046e
  • consistent-function-scoping: Ignore functions in Vitest hoisted factories (#3905) 98912a9
  • custom-error-definition: Ignore abstract TypeScript classes (#3934) ee3501f
  • no-non-function-verb-prefix: Ignore shorthand destructuring (#3926) 76e5760
  • no-top-level-side-effects: Recognize more config helpers (#3916) d459c51
  • no-useless-coercion: Preserve boolean return types in TypeScript (#3904) bef1571
  • prefer-array-some: Check .find() results used as booleans (#3913) c957bf3
  • prefer-default-parameters: Skip unsafe logical OR fallbacks (#3951) bcec97a
  • prefer-includes: Skip incompatible TypeScript search values (#3927) d66441a
  • prefer-includes-over-repeated-comparisons: Report negated and typed loose comparisons (#3935) 6e21cb1
  • prefer-includes-over-repeated-comparisons: Preserve TypeScript union narrowing (#3910) b5c479d
  • prefer-literal-ascii: Preserve escaped trailing spaces in templates (#3911) 360094b
  • prefer-minimal-ternary: Skip minimizations that break types (#3892) f022d6d
  • prefer-modern-math-apis: Use suggestions for changes that can affect numeric results (#3914) 8af7c17
  • prefer-simple-condition-first: Improve typeof comparisons and guards (#3948) ee3edf0
  • prefer-simplified-conditions: Handle equivalent logical expressions (#3938) a0b2788
  • prefer-simplified-conditions: Factor common terms in longer chains and static templates (#3942) 0d8c8bc
  • prefer-smaller-scope: Check TypeScript type aliases (#3928) 290d922
  • prefer-string-raw: Preserve TypeScript literal types in autofixes (#3912) 0611546
  • prefer-ternary: Preserve consecutive early-return guards (#3945) 3fa840f
  • require-post-message-target-origin: Skip incompatible typed methods (#3925) 387194b
  • throw-new-error: Ignore calls that return functions (#3894) 5e35def

v78.0.0...v79.0.0

Don't miss a new eslint-plugin-unicorn release

NewReleases is sending notifications on new releases.