80+ new Quick Fixes for JavaScript and TypeScript

Hello community,

We have some sweet news for JavaScript and TypeScript developers!

To help you fix code issues even more easily and quickly, we’ve just added 80+ new Quick Fixes in SonarQube for IDE. Most of these are for core language rules, meaning you’ll spend less time fixing and more time coding.

JavaScript and TypeScript are used by most SonarQube customers, and also more generally across the industry. That’s why we want to raise the bar for what SonarQube offers. This is just the start. More improvements are on the way!

Please share your feedback!

4 Likes

Quick Fixes added since October 2025 in Sonar Way Quality Profile rules:

  • S1125 - Boolean literals should not be used in comparisons
  • S1264 - A “while” loop should be used instead of a “for” loop
  • S2933 - Fields that are only assigned in the constructor should be “readonly”
  • S3504 - Variables should be declared with “let” or “const”
  • S3863 - Imports from the same module should be merged
  • S4156 - “module” should not be used
  • S4325 - Redundant casts and non-null assertions should be avoided
  • S6509 - Extra boolean casts should be removed
  • S6557 - Ends of strings should be checked with “startsWith()” and “endsWith()”
  • S6565 - Prefer the return type “this” in fluent interfaces
  • S6582 - Optional chaining should be preferred
  • S6590 - “as const” assertions should be preferred
  • S6598 - Function types should be preferred
  • S6637 - Unnecessary calls to “.bind()” should not be used
  • S6644 - Ternary operator should not be used instead of simpler alternatives
  • S6645 - Variables should not be initialized to undefined
  • S6650 - Renaming import, export, and destructuring assignments should not be to the same name
  • S6653 - Use Object.hasOwn static method instead of hasOwnProperty
  • S6660 - If statements should not be the only statement in else blocks
  • S6661 - Object spread syntax should be used instead of “Object.assign”
  • S6747 - JSX elements should not use unknown properties and attributes
  • S6749 - Redundant JSX fragments should be removed
  • S6859 - Imports should not use absolute paths
  • S7641 - Angular lifecycle methods should be used in the correct context
  • S7649 - Input bindings should not be aliased
  • S7653 - Output bindings should not be aliased
  • S7655 - Angular classes should implement lifecycle interfaces for their lifecycle methods
  • S7656 - Angular Pipes should implement PipeTransform interface
  • S7718 - Error parameters in catch clauses should follow a consistent naming convention
  • S7719 - Date objects should be cloned directly without calling “getTime()”
  • S7720 - Ternary expressions in array spreads should use consistent types
  • S7723 - Built-in constructors should be called consistently with or without “new”
  • S7729 - Array method callbacks should not use the “thisArg” parameter
  • S7732 - “instanceof” should not be used with built-in objects
  • S7734 - Default imports and exports should use the dedicated syntax
  • S7735 - Negated conditions should be avoided when an else clause is present
  • S7738 - Single-element arrays should not be passed to Promise methods
  • S7741 - “typeof” should not be used to check for “undefined”
  • S7744 - Unnecessary fallback objects should not be used when spreading in object literals
  • S7745 - Array length checks should not be used before “some()” and “every()” calls
  • S7746 - Promise.resolve() and Promise.reject() should not be used in async functions or promise callbacks
  • S7747 - Spread syntax should not be used unnecessarily
  • S7748 - Number literals should not have unnecessary decimal points or trailing zeros
  • S7749 - Numeric literals should use consistent digit grouping with separators
  • S7750 - Array methods “.find()” and “.findLast()” should be preferred over “.filter()” for single element retrieval
  • S7751 - Array flattening should use the native “flat()” method
  • S7752 - Array methods “.map().flat()” should be replaced with “.flatMap()”
  • S7753 - “indexOf()” and “lastIndexOf()” should be used instead of “findIndex()” and “findLastIndex()” for simple equality searches
  • S7754 - Use “.some()” instead of “.filter().length” checks or “.find()” for existence testing
  • S7755 - Complex index access patterns should be replaced with “.at()” method
  • S7757 - Class properties should be declared as fields rather than assigned in constructors
  • S7759 - Use “Date.now()” instead of creating Date objects to get current timestamp
  • S7761 - Data attributes should be accessed using “.dataset”
  • S7762 - DOM nodes should be removed using “remove()” instead of “removeChild()”
  • S7763 - Re-exports should use “export…from” syntax
  • S7764 - Use “globalThis” instead of “window”, “self”, or “global”
  • S7765 - Existence checks should use “.includes()” instead of “.indexOf()” or “.lastIndexOf()”
  • S7766 - Ternary expressions should be replaced with “Math.min()” or “Math.max()” for simple comparisons
  • S7767 - Bitwise operators should not be used to truncate numbers
  • S7768 - Modern DOM manipulation methods should be used instead of legacy alternatives
  • S7769 - Modern Math APIs should be used instead of legacy mathematical expressions
  • S7770 - Wrapper functions around built-in type conversion functions should be avoided
  • S7771 - Negative indices should be used instead of length calculations
  • S7772 - Node.js built-in modules should be imported using the “node:” protocol
  • S7773 - Number static methods and properties should be preferred over global equivalents
  • S7774 - Methods should be accessed from prototypes, not instances
  • S7776 - Arrays used only for existence checks should be Sets
  • S7777 - Set size should be accessed directly instead of converting to array first
  • S7778 - Multiple consecutive calls to methods that accept multiple arguments should be combined
  • S7780 - String literals with escaped backslashes should use String.raw template literals
  • S7781 - Strings should use “replaceAll()” instead of “replace()” with global regex
  • S7783 - “trimLeft()” and “trimRight()” should be replaced with “trimStart()” and “trimEnd()”
  • S7786 - Generic “Error” should be “TypeError” when thrown after type checking
  • S7787 - Import and export statements should not have empty specifier lists
3 Likes

Great work!

1 Like