# SonarJS recommended

The rules behind SonarQube's JavaScript and TypeScript analysis, as an ESLint plugin: bugs, security hotspots and code smells such as high cognitive complexity.

- Linter: ESLint
- Package: `eslint-plugin-sonarjs` (https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md)
- Author: Sonar (official)
- Rules: 230
- Weekly downloads: 6.2M, +62.1% last quarter
- Technologies: javascript (230)

## Install

```sh
npm install -D eslint eslint-plugin-sonarjs
pnpm add -D eslint eslint-plugin-sonarjs
yarn add -D eslint eslint-plugin-sonarjs
bun add -d eslint eslint-plugin-sonarjs
```

## Config: `eslint.config.js`

```js
// eslint.config.js
import sonarjs from "eslint-plugin-sonarjs";

export default [
  sonarjs.configs.recommended,
];
```

## Rules it enables

| Rule | Severity | Description | Reach |
| --- | --- | --- | --- |
| [sonarjs/cognitive-complexity](https://lintradar.dev/rules/sonarjs/cognitive-complexity.md) | error | Cognitive Complexity of functions should not be too high | 8.3M |
| [sonarjs/prefer-while](https://lintradar.dev/rules/sonarjs/prefer-while.md) | error | A "while" loop should be used instead of a "for" loop | 8.3M |
| [sonarjs/no-nested-template-literals](https://lintradar.dev/rules/sonarjs/no-nested-template-literals.md) | error | Template literals should not be nested | 6.2M |
| [sonarjs/anchor-precedence](https://lintradar.dev/rules/sonarjs/anchor-precedence.md) | error | Alternatives in regular expressions should be grouped when used with anchors | 6.2M |
| [sonarjs/argument-type](https://lintradar.dev/rules/sonarjs/argument-type.md) | error | Arguments to built-in functions should match documented types | 6.2M |
| [sonarjs/arguments-order](https://lintradar.dev/rules/sonarjs/arguments-order.md) | error | Parameters should be passed in the correct order | 6.2M |
| [sonarjs/array-callback-without-return](https://lintradar.dev/rules/sonarjs/array-callback-without-return.md) | error | Callbacks of array methods should have return statements | 6.2M |
| [sonarjs/assertions-in-test-cases](https://lintradar.dev/rules/sonarjs/assertions-in-test-cases.md) | error | Assertions should be placed inside test cases or hooks | 6.2M |
| [sonarjs/assertions-in-tests](https://lintradar.dev/rules/sonarjs/assertions-in-tests.md) | error | Tests should include assertions | 6.2M |
| [sonarjs/async-test-assertions](https://lintradar.dev/rules/sonarjs/async-test-assertions.md) | error | Async test assertions should be awaited or returned | 6.2M |
| [sonarjs/avoid-mutating-nested-properties-of-shallow-clones](https://lintradar.dev/rules/sonarjs/avoid-mutating-nested-properties-of-shallow-clones.md) | error | Nested properties of Lodash and Underscore.js clone results should not be mutated | 6.2M |
| [sonarjs/aws-apigateway-public-api](https://lintradar.dev/rules/sonarjs/aws-apigateway-public-api.md) | error | AWS API Gateway should require authentication | 6.2M |
| [sonarjs/aws-ec2-rds-dms-public](https://lintradar.dev/rules/sonarjs/aws-ec2-rds-dms-public.md) | error | Public network access to cloud resources should be disabled | 6.2M |
| [sonarjs/aws-ec2-unencrypted-ebs-volume](https://lintradar.dev/rules/sonarjs/aws-ec2-unencrypted-ebs-volume.md) | error | EBS volumes should be encrypted | 6.2M |
| [sonarjs/aws-efs-unencrypted](https://lintradar.dev/rules/sonarjs/aws-efs-unencrypted.md) | error | Amazon EFS file systems should be encrypted | 6.2M |
| [sonarjs/aws-iam-all-privileges](https://lintradar.dev/rules/sonarjs/aws-iam-all-privileges.md) | error | Policies should not grant all privileges | 6.2M |
| [sonarjs/aws-iam-privilege-escalation](https://lintradar.dev/rules/sonarjs/aws-iam-privilege-escalation.md) | error | AWS IAM policies should limit the scope of permissions given | 6.2M |
| [sonarjs/aws-iam-public-access](https://lintradar.dev/rules/sonarjs/aws-iam-public-access.md) | error | AWS resource-based policies should not grant public access | 6.2M |
| [sonarjs/aws-opensearchservice-domain](https://lintradar.dev/rules/sonarjs/aws-opensearchservice-domain.md) | error | OpenSearch domains should have encryption at rest enabled | 6.2M |
| [sonarjs/aws-rds-unencrypted-databases](https://lintradar.dev/rules/sonarjs/aws-rds-unencrypted-databases.md) | error | Amazon RDS resources should be encrypted at rest | 6.2M |
| [sonarjs/aws-restricted-ip-admin-access](https://lintradar.dev/rules/sonarjs/aws-restricted-ip-admin-access.md) | error | Administration services access should be restricted to specific IP addresses | 6.2M |
| [sonarjs/aws-s3-bucket-granted-access](https://lintradar.dev/rules/sonarjs/aws-s3-bucket-granted-access.md) | error | S3 buckets should not grant access to all users or authenticated users | 6.2M |
| [sonarjs/aws-s3-bucket-insecure-http](https://lintradar.dev/rules/sonarjs/aws-s3-bucket-insecure-http.md) | error | S3 buckets should enforce HTTPS-only access | 6.2M |
| [sonarjs/aws-s3-bucket-public-access](https://lintradar.dev/rules/sonarjs/aws-s3-bucket-public-access.md) | error | Amazon S3 bucket public access should be fully blocked | 6.2M |
| [sonarjs/aws-s3-bucket-versioning](https://lintradar.dev/rules/sonarjs/aws-s3-bucket-versioning.md) | error | Amazon S3 buckets should have versioning enabled | 6.2M |
| [sonarjs/aws-sagemaker-unencrypted-notebook](https://lintradar.dev/rules/sonarjs/aws-sagemaker-unencrypted-notebook.md) | error | SageMaker notebook instances should be encrypted at rest | 6.2M |
| [sonarjs/aws-sns-unencrypted-topics](https://lintradar.dev/rules/sonarjs/aws-sns-unencrypted-topics.md) | error | Amazon SNS topics should be encrypted at rest | 6.2M |
| [sonarjs/aws-sqs-unencrypted-queue](https://lintradar.dev/rules/sonarjs/aws-sqs-unencrypted-queue.md) | error | SQS queues should be encrypted | 6.2M |
| [sonarjs/bitwise-operators](https://lintradar.dev/rules/sonarjs/bitwise-operators.md) | error | Bitwise operators should not be used in boolean contexts | 6.2M |
| [sonarjs/block-scoped-var](https://lintradar.dev/rules/sonarjs/block-scoped-var.md) | error | Variables should be used in the blocks where they are declared | 6.2M |
| [sonarjs/call-argument-line](https://lintradar.dev/rules/sonarjs/call-argument-line.md) | error | Function call arguments should not start on new lines | 6.2M |
| [sonarjs/chai-determinate-assertion](https://lintradar.dev/rules/sonarjs/chai-determinate-assertion.md) | error | Chai assertions should have only one reason to succeed | 6.2M |
| [sonarjs/class-name](https://lintradar.dev/rules/sonarjs/class-name.md) | error | Class names should comply with a naming convention | 6.2M |
| [sonarjs/code-eval](https://lintradar.dev/rules/sonarjs/code-eval.md) | error | Dynamic code execution should not use user-controlled data | 6.2M |
| [sonarjs/comma-or-logical-or-case](https://lintradar.dev/rules/sonarjs/comma-or-logical-or-case.md) | error | Comma and logical OR operators should not be used in switch cases | 6.2M |
| [sonarjs/concise-regex](https://lintradar.dev/rules/sonarjs/concise-regex.md) | error | Regular expression quantifiers and character classes should be used concisely | 6.2M |
| [sonarjs/constructor-for-side-effects](https://lintradar.dev/rules/sonarjs/constructor-for-side-effects.md) | error | Objects should not be created to be dropped immediately without being used | 6.2M |
| [sonarjs/content-length](https://lintradar.dev/rules/sonarjs/content-length.md) | error | HTTP request content length should be limited | 6.2M |
| [sonarjs/content-security-policy](https://lintradar.dev/rules/sonarjs/content-security-policy.md) | error | Content security policy fetch directives should not be disabled | 6.2M |
| [sonarjs/cookie-no-httponly](https://lintradar.dev/rules/sonarjs/cookie-no-httponly.md) | error | Cookies should have the "HttpOnly" flag | 6.2M |
| [sonarjs/cors](https://lintradar.dev/rules/sonarjs/cors.md) | error | Cross-Origin Resource Sharing (CORS) policy should be restricted to trusted origins | 6.2M |
| [sonarjs/csrf](https://lintradar.dev/rules/sonarjs/csrf.md) | error | CSRF protections should not be disabled | 6.2M |
| [sonarjs/deprecation](https://lintradar.dev/rules/sonarjs/deprecation.md) | error | Deprecated APIs should not be used | 6.2M |
| [sonarjs/different-types-comparison](https://lintradar.dev/rules/sonarjs/different-types-comparison.md) | error | Strict equality operators should not be used with dissimilar types | 6.2M |
| [sonarjs/disabled-auto-escaping](https://lintradar.dev/rules/sonarjs/disabled-auto-escaping.md) | error | Auto-escaping in HTML template engines should not be disabled | 6.2M |
| [sonarjs/disabled-resource-integrity](https://lintradar.dev/rules/sonarjs/disabled-resource-integrity.md) | error | Remote artifacts should not be used without integrity checks | 6.2M |
| [sonarjs/disabled-timeout](https://lintradar.dev/rules/sonarjs/disabled-timeout.md) | error | Disabling Mocha timeouts should be explicit | 6.2M |
| [sonarjs/dompurify-unsafe-config](https://lintradar.dev/rules/sonarjs/dompurify-unsafe-config.md) | error | DOMPurify configuration should not be bypassable | 6.2M |
| [sonarjs/duplicates-in-character-class](https://lintradar.dev/rules/sonarjs/duplicates-in-character-class.md) | error | Character classes in regular expressions should not contain the same character twice | 6.2M |
| [sonarjs/dynamically-constructed-templates](https://lintradar.dev/rules/sonarjs/dynamically-constructed-templates.md) | error | Templates should not be constructed dynamically | 6.2M |
| [sonarjs/empty-string-repetition](https://lintradar.dev/rules/sonarjs/empty-string-repetition.md) | error | Repeated patterns in regular expressions should not match the empty string | 6.2M |
| [sonarjs/encryption-secure-mode](https://lintradar.dev/rules/sonarjs/encryption-secure-mode.md) | error | Encryption algorithms should be used with secure mode and padding scheme | 6.2M |
| [sonarjs/existing-groups](https://lintradar.dev/rules/sonarjs/existing-groups.md) | error | Replacement strings should reference existing regular expression groups | 6.2M |
| [sonarjs/explicit-test-skip](https://lintradar.dev/rules/sonarjs/explicit-test-skip.md) | error | Tests should be skipped explicitly | 6.2M |
| [sonarjs/file-permissions](https://lintradar.dev/rules/sonarjs/file-permissions.md) | error | File permissions should not be set to world-accessible values | 6.2M |
| [sonarjs/file-uploads](https://lintradar.dev/rules/sonarjs/file-uploads.md) | error | File uploads should be restricted | 6.2M |
| [sonarjs/fixme-tag](https://lintradar.dev/rules/sonarjs/fixme-tag.md) | error | Track uses of "FIXME" tags | 6.2M |
| [sonarjs/for-loop-increment-sign](https://lintradar.dev/rules/sonarjs/for-loop-increment-sign.md) | error | A "for" loop update clause should move the counter in the right direction | 6.2M |
| [sonarjs/function-inside-loop](https://lintradar.dev/rules/sonarjs/function-inside-loop.md) | error | Functions should not be defined inside loops | 6.2M |
| [sonarjs/function-return-type](https://lintradar.dev/rules/sonarjs/function-return-type.md) | error | Functions should always return the same type | 6.2M |
| [sonarjs/future-reserved-words](https://lintradar.dev/rules/sonarjs/future-reserved-words.md) | error | Future reserved words should not be used as identifiers | 6.2M |
| [sonarjs/generator-without-yield](https://lintradar.dev/rules/sonarjs/generator-without-yield.md) | error | Generators should explicitly "yield" a value | 6.2M |
| [sonarjs/hardcoded-secret-signatures](https://lintradar.dev/rules/sonarjs/hardcoded-secret-signatures.md) | error | Credentials should not be hard-coded | 6.2M |
| [sonarjs/hashing](https://lintradar.dev/rules/sonarjs/hashing.md) | error | Weak hashing algorithms should not be used | 6.2M |
| [sonarjs/hooks-before-test-cases](https://lintradar.dev/rules/sonarjs/hooks-before-test-cases.md) | error | Lifecycle hooks should not be interleaved with test cases or nested suites | 6.2M |
| [sonarjs/in-operator-type-error](https://lintradar.dev/rules/sonarjs/in-operator-type-error.md) | error | "in" should not be used with primitive types | 6.2M |
| [sonarjs/inconsistent-function-call](https://lintradar.dev/rules/sonarjs/inconsistent-function-call.md) | error | Functions should be called consistently with or without "new" | 6.2M |
| [sonarjs/index-of-compare-to-positive-number](https://lintradar.dev/rules/sonarjs/index-of-compare-to-positive-number.md) | error | "indexOf" checks should not be for positive numbers | 6.2M |
| [sonarjs/insecure-cookie](https://lintradar.dev/rules/sonarjs/insecure-cookie.md) | error | Cookies should have the "secure" flag | 6.2M |
| [sonarjs/insecure-jwt-token](https://lintradar.dev/rules/sonarjs/insecure-jwt-token.md) | error | JWT should be signed and verified with strong cipher algorithms | 6.2M |
| [sonarjs/inverted-assertion-arguments](https://lintradar.dev/rules/sonarjs/inverted-assertion-arguments.md) | error | Assertion arguments should be passed in the correct order | 6.2M |
| [sonarjs/jsx-no-leaked-render](https://lintradar.dev/rules/sonarjs/jsx-no-leaked-render.md) | error | React components should not render non-boolean condition values | 6.2M |
| [sonarjs/label-position](https://lintradar.dev/rules/sonarjs/label-position.md) | error | Only "while", "do", "for" and "switch" statements should be labelled | 6.2M |
| [sonarjs/link-with-target-blank](https://lintradar.dev/rules/sonarjs/link-with-target-blank.md) | error | Opened windows should not have access to the originating page | 6.2M |
| [sonarjs/links-identical-texts-different-targets](https://lintradar.dev/rules/sonarjs/links-identical-texts-different-targets.md) | error | Links with identical accessible names should have identical targets | 6.2M |
| [sonarjs/max-switch-cases](https://lintradar.dev/rules/sonarjs/max-switch-cases.md) | error | "switch" statements should not have too many "case" clauses | 6.2M |
| [sonarjs/memoize-cache-key](https://lintradar.dev/rules/sonarjs/memoize-cache-key.md) | error | Lodash and Underscore.js `memoize` calls on functions with multiple parameters should use an explicit cache key function | 6.2M |
| [sonarjs/misplaced-loop-counter](https://lintradar.dev/rules/sonarjs/misplaced-loop-counter.md) | error | "for" loop increment clauses should modify the loops' counters | 6.2M |
| [sonarjs/new-operator-misuse](https://lintradar.dev/rules/sonarjs/new-operator-misuse.md) | error | "new" should only be used with functions and classes | 6.2M |
| [sonarjs/no-all-duplicated-branches](https://lintradar.dev/rules/sonarjs/no-all-duplicated-branches.md) | error | All branches in a conditional structure should not have exactly the same implementation | 6.2M |
| [sonarjs/no-alphabetical-sort](https://lintradar.dev/rules/sonarjs/no-alphabetical-sort.md) | error | "Array.prototype.sort()" and "Array.prototype.toSorted()" should use a compare function | 6.2M |
| [sonarjs/no-angular-bypass-sanitization](https://lintradar.dev/rules/sonarjs/no-angular-bypass-sanitization.md) | error | Angular built-in sanitization should not be disabled | 6.2M |
| [sonarjs/no-array-delete](https://lintradar.dev/rules/sonarjs/no-array-delete.md) | error | "delete" should not be used on arrays | 6.2M |
| [sonarjs/no-associative-arrays](https://lintradar.dev/rules/sonarjs/no-associative-arrays.md) | error | Array indexes should be numeric | 6.2M |
| [sonarjs/no-async-constructor](https://lintradar.dev/rules/sonarjs/no-async-constructor.md) | error | Constructors should not contain asynchronous operations | 6.2M |
| [sonarjs/no-case-label-in-switch](https://lintradar.dev/rules/sonarjs/no-case-label-in-switch.md) | error | "switch" statements should not contain non-case labels | 6.2M |
| [sonarjs/no-clear-text-protocols](https://lintradar.dev/rules/sonarjs/no-clear-text-protocols.md) | error | Clear-text protocols should not be used | 6.2M |
| [sonarjs/no-code-after-done](https://lintradar.dev/rules/sonarjs/no-code-after-done.md) | error | Tests should not execute any code after "done()" is called | 6.2M |
| [sonarjs/no-collection-size-mischeck](https://lintradar.dev/rules/sonarjs/no-collection-size-mischeck.md) | error | Collection size and array length comparisons should make sense | 6.2M |
| [sonarjs/no-control-regex](https://lintradar.dev/rules/sonarjs/no-control-regex.md) | error | Regular expressions should not contain control characters | 6.2M |
| [sonarjs/no-dead-store](https://lintradar.dev/rules/sonarjs/no-dead-store.md) | error | Unused assignments should be removed | 6.2M |
| [sonarjs/no-debounce-throttle-in-render](https://lintradar.dev/rules/sonarjs/no-debounce-throttle-in-render.md) | error | Lodash and Underscore.js debounced or throttled functions should not be recreated on every React render | 6.2M |
| [sonarjs/no-debug-commands-in-ui-tests](https://lintradar.dev/rules/sonarjs/no-debug-commands-in-ui-tests.md) | error | UI test debug commands should not be committed to version control | 6.2M |
| [sonarjs/no-default-utility-imports](https://lintradar.dev/rules/sonarjs/no-default-utility-imports.md) | error | Default imports from modular utility libraries should not be used | 6.2M |
| [sonarjs/no-delete-var](https://lintradar.dev/rules/sonarjs/no-delete-var.md) | error | "delete" should be used only with object properties | 6.2M |
| [sonarjs/no-duplicate-in-composite](https://lintradar.dev/rules/sonarjs/no-duplicate-in-composite.md) | error | Union and intersection types should not include duplicated constituents | 6.2M |
| [sonarjs/no-duplicate-parameterized-test-case](https://lintradar.dev/rules/sonarjs/no-duplicate-parameterized-test-case.md) | error | Parameterized tests should not contain duplicate test cases | 6.2M |
| [sonarjs/no-duplicate-test-title](https://lintradar.dev/rules/sonarjs/no-duplicate-test-title.md) | error | Test titles should be unique within the same suite | 6.2M |
| [sonarjs/no-duplicated-branches](https://lintradar.dev/rules/sonarjs/no-duplicated-branches.md) | error | Two branches in a conditional structure should not have exactly the same implementation | 6.2M |
| [sonarjs/no-element-overwrite](https://lintradar.dev/rules/sonarjs/no-element-overwrite.md) | error | Collection elements should not be replaced unconditionally | 6.2M |
| [sonarjs/no-empty-after-reluctant](https://lintradar.dev/rules/sonarjs/no-empty-after-reluctant.md) | error | Reluctant quantifiers in regular expressions should be followed by an expression that can't match the empty string | 6.2M |
| [sonarjs/no-empty-alternatives](https://lintradar.dev/rules/sonarjs/no-empty-alternatives.md) | error | Alternation in regular expressions should not contain empty alternatives | 6.2M |
| [sonarjs/no-empty-character-class](https://lintradar.dev/rules/sonarjs/no-empty-character-class.md) | error | Empty character classes should not be used | 6.2M |
| [sonarjs/no-empty-collection](https://lintradar.dev/rules/sonarjs/no-empty-collection.md) | error | Empty collections should not be accessed or iterated | 6.2M |
| [sonarjs/no-empty-group](https://lintradar.dev/rules/sonarjs/no-empty-group.md) | error | Regular expressions should not contain empty groups | 6.2M |
| [sonarjs/no-empty-parameterized-test-dataset](https://lintradar.dev/rules/sonarjs/no-empty-parameterized-test-dataset.md) | error | Parameterized tests should not have empty datasets | 6.2M |
| [sonarjs/no-empty-test-title](https://lintradar.dev/rules/sonarjs/no-empty-test-title.md) | error | Test and suite titles should not be empty or whitespace-only | 6.2M |
| [sonarjs/no-equals-in-for-termination](https://lintradar.dev/rules/sonarjs/no-equals-in-for-termination.md) | error | Equality operators should not be used in "for" loop termination conditions | 6.2M |
| [sonarjs/no-exclusive-tests](https://lintradar.dev/rules/sonarjs/no-exclusive-tests.md) | error | Exclusive tests should not be committed to version control | 6.2M |
| [sonarjs/no-extra-arguments](https://lintradar.dev/rules/sonarjs/no-extra-arguments.md) | error | Function calls should not pass extra arguments | 6.2M |
| [sonarjs/no-fallthrough](https://lintradar.dev/rules/sonarjs/no-fallthrough.md) | error | Switch cases should end with an unconditional "break" statement | 6.2M |
| [sonarjs/no-fixed-wait-in-tests](https://lintradar.dev/rules/sonarjs/no-fixed-wait-in-tests.md) | error | Fixed waits should not be used in tests | 6.2M |
| [sonarjs/no-floating-point-equality](https://lintradar.dev/rules/sonarjs/no-floating-point-equality.md) | error | Floating point numbers should not be tested for equality | 6.2M |
| [sonarjs/no-forced-browser-interaction](https://lintradar.dev/rules/sonarjs/no-forced-browser-interaction.md) | error | Forced browser interactions should not bypass actionability checks | 6.2M |
| [sonarjs/no-global-this](https://lintradar.dev/rules/sonarjs/no-global-this.md) | error | The global "this" object should not be used | 6.2M |
| [sonarjs/no-globals-shadowing](https://lintradar.dev/rules/sonarjs/no-globals-shadowing.md) | error | Special identifiers should not be bound or assigned | 6.2M |
| [sonarjs/no-gratuitous-expressions](https://lintradar.dev/rules/sonarjs/no-gratuitous-expressions.md) | error | Boolean expressions should not be gratuitous | 6.2M |
| [sonarjs/no-hardcoded-ip](https://lintradar.dev/rules/sonarjs/no-hardcoded-ip.md) | error | IP addresses should not be hardcoded | 6.2M |
| [sonarjs/no-hardcoded-passwords](https://lintradar.dev/rules/sonarjs/no-hardcoded-passwords.md) | error | Credentials should not be hard-coded | 6.2M |
| [sonarjs/no-hardcoded-secrets](https://lintradar.dev/rules/sonarjs/no-hardcoded-secrets.md) | error | Secrets should not be hard-coded | 6.2M |
| [sonarjs/no-hook-setter-in-body](https://lintradar.dev/rules/sonarjs/no-hook-setter-in-body.md) | error | React's useState hook should not be used directly in the render function or body of a component | 6.2M |
| [sonarjs/no-identical-conditions](https://lintradar.dev/rules/sonarjs/no-identical-conditions.md) | error | "if/else if" chains and "switch" cases should not have the same condition | 6.2M |
| [sonarjs/no-identical-expressions](https://lintradar.dev/rules/sonarjs/no-identical-expressions.md) | error | Identical expressions should not be used on both sides of a binary operator | 6.2M |
| [sonarjs/no-identical-functions](https://lintradar.dev/rules/sonarjs/no-identical-functions.md) | error | Functions should not have identical implementations | 6.2M |
| [sonarjs/no-ignored-exceptions](https://lintradar.dev/rules/sonarjs/no-ignored-exceptions.md) | error | Exceptions should not be ignored | 6.2M |
| [sonarjs/no-ignored-return](https://lintradar.dev/rules/sonarjs/no-ignored-return.md) | error | Return values from functions without side effects should not be ignored | 6.2M |
| [sonarjs/no-implicit-global](https://lintradar.dev/rules/sonarjs/no-implicit-global.md) | error | Variables should be declared explicitly | 6.2M |
| [sonarjs/no-in-misuse](https://lintradar.dev/rules/sonarjs/no-in-misuse.md) | error | "in" should not be used on arrays | 6.2M |
| [sonarjs/no-incompatible-assertion-types](https://lintradar.dev/rules/sonarjs/no-incompatible-assertion-types.md) | error | Assertions comparing incompatible types should not be made | 6.2M |
| [sonarjs/no-incomplete-assertions](https://lintradar.dev/rules/sonarjs/no-incomplete-assertions.md) | error | Assertions should be complete | 6.2M |
| [sonarjs/no-internal-api-use](https://lintradar.dev/rules/sonarjs/no-internal-api-use.md) | error | Users should not use internal APIs | 6.2M |
| [sonarjs/no-interpolation-in-inline-snapshots](https://lintradar.dev/rules/sonarjs/no-interpolation-in-inline-snapshots.md) | error | Inline snapshots should not contain interpolations | 6.2M |
| [sonarjs/no-invalid-regexp](https://lintradar.dev/rules/sonarjs/no-invalid-regexp.md) | error | Regular expressions should be syntactically valid | 6.2M |
| [sonarjs/no-invariant-returns](https://lintradar.dev/rules/sonarjs/no-invariant-returns.md) | error | Function returns should not be invariant | 6.2M |
| [sonarjs/no-inverted-boolean-check](https://lintradar.dev/rules/sonarjs/no-inverted-boolean-check.md) | error | Boolean checks should not be inverted | 6.2M |
| [sonarjs/no-labels](https://lintradar.dev/rules/sonarjs/no-labels.md) | error | Labels should not be used | 6.2M |
| [sonarjs/no-literal-call](https://lintradar.dev/rules/sonarjs/no-literal-call.md) | error | Literals should not be used as functions | 6.2M |
| [sonarjs/no-mime-sniff](https://lintradar.dev/rules/sonarjs/no-mime-sniff.md) | error | Browsers should not be allowed to perform MIME type sniffing | 6.2M |
| [sonarjs/no-misleading-array-reverse](https://lintradar.dev/rules/sonarjs/no-misleading-array-reverse.md) | error | Array-mutating methods should not be used misleadingly | 6.2M |
| [sonarjs/no-misleading-character-class](https://lintradar.dev/rules/sonarjs/no-misleading-character-class.md) | error | Unicode Grapheme Clusters should be avoided inside regex character classes | 6.2M |
| [sonarjs/no-mutate-reactive-state-in-updated-hook](https://lintradar.dev/rules/sonarjs/no-mutate-reactive-state-in-updated-hook.md) | error | Reactive state should not be unconditionally mutated inside Vue's "updated" lifecycle hook | 6.2M |
| [sonarjs/no-nested-assignment](https://lintradar.dev/rules/sonarjs/no-nested-assignment.md) | error | Assignments should not be made from within sub-expressions | 6.2M |
| [sonarjs/no-nested-conditional](https://lintradar.dev/rules/sonarjs/no-nested-conditional.md) | error | Ternary operators should not be nested | 6.2M |
| [sonarjs/no-nested-functions](https://lintradar.dev/rules/sonarjs/no-nested-functions.md) | error | Functions should not be nested too deeply | 6.2M |
| [sonarjs/no-os-command-from-path](https://lintradar.dev/rules/sonarjs/no-os-command-from-path.md) | error | OS commands should not rely on PATH resolution | 6.2M |
| [sonarjs/no-parameter-reassignment](https://lintradar.dev/rules/sonarjs/no-parameter-reassignment.md) | error | Initial values of parameters, caught exceptions, and loop variables should not be ignored | 6.2M |
| [sonarjs/no-primitive-wrappers](https://lintradar.dev/rules/sonarjs/no-primitive-wrappers.md) | error | Wrapper objects should not be used for primitive types | 6.2M |
| [sonarjs/no-redundant-assignments](https://lintradar.dev/rules/sonarjs/no-redundant-assignments.md) | error | Assignments should not be redundant | 6.2M |
| [sonarjs/no-redundant-boolean](https://lintradar.dev/rules/sonarjs/no-redundant-boolean.md) | error | Boolean literals should not be used in comparisons | 6.2M |
| [sonarjs/no-redundant-jump](https://lintradar.dev/rules/sonarjs/no-redundant-jump.md) | error | Jump statements should not be redundant | 6.2M |
| [sonarjs/no-redundant-optional](https://lintradar.dev/rules/sonarjs/no-redundant-optional.md) | error | Optional properties should not redundantly include 'undefined' | 6.2M |
| [sonarjs/no-referrer-policy](https://lintradar.dev/rules/sonarjs/no-referrer-policy.md) | error | HTTP Referrer-Policy should not be set to an unsafe value | 6.2M |
| [sonarjs/no-regex-spaces](https://lintradar.dev/rules/sonarjs/no-regex-spaces.md) | error | Regular expressions should not contain multiple spaces | 6.2M |
| [sonarjs/no-same-argument-assert](https://lintradar.dev/rules/sonarjs/no-same-argument-assert.md) | error | Assertions should not be given twice the same argument | 6.2M |
| [sonarjs/no-same-line-conditional](https://lintradar.dev/rules/sonarjs/no-same-line-conditional.md) | error | Conditionals should start on new lines | 6.2M |
| [sonarjs/no-selector-parameter](https://lintradar.dev/rules/sonarjs/no-selector-parameter.md) | error | Methods should not contain selector parameters | 6.2M |
| [sonarjs/no-session-cookies-on-static-assets](https://lintradar.dev/rules/sonarjs/no-session-cookies-on-static-assets.md) | error | Static Assets should not serve session cookies | 6.2M |
| [sonarjs/no-skipped-tests](https://lintradar.dev/rules/sonarjs/no-skipped-tests.md) | error | Tests should not be skipped without providing a reason | 6.2M |
| [sonarjs/no-small-switch](https://lintradar.dev/rules/sonarjs/no-small-switch.md) | error | "if" statements should be preferred over "switch" when simpler | 6.2M |
| [sonarjs/no-table-as-layout](https://lintradar.dev/rules/sonarjs/no-table-as-layout.md) | error | HTML "<table>" should not be used for layout purposes | 6.2M |
| [sonarjs/no-trivial-assertions](https://lintradar.dev/rules/sonarjs/no-trivial-assertions.md) | error | Assertions should not be trivially true | 6.2M |
| [sonarjs/no-try-promise](https://lintradar.dev/rules/sonarjs/no-try-promise.md) | error | Promise rejections should not be caught by "try" blocks | 6.2M |
| [sonarjs/no-undefined-argument](https://lintradar.dev/rules/sonarjs/no-undefined-argument.md) | error | "undefined" should not be passed as the value of optional parameters | 6.2M |
| [sonarjs/no-unenclosed-multiline-block](https://lintradar.dev/rules/sonarjs/no-unenclosed-multiline-block.md) | error | Multiline blocks should be enclosed in curly braces | 6.2M |
| [sonarjs/no-uniq-key](https://lintradar.dev/rules/sonarjs/no-uniq-key.md) | error | JSX list components keys should match up between renders | 6.2M |
| [sonarjs/no-unthrown-error](https://lintradar.dev/rules/sonarjs/no-unthrown-error.md) | error | Errors should not be created without being thrown | 6.2M |
| [sonarjs/no-unused-collection](https://lintradar.dev/rules/sonarjs/no-unused-collection.md) | error | Collection contents should be used | 6.2M |
| [sonarjs/no-unused-vars](https://lintradar.dev/rules/sonarjs/no-unused-vars.md) | error | Unused local variables and functions should be removed | 6.2M |
| [sonarjs/no-use-of-empty-return-value](https://lintradar.dev/rules/sonarjs/no-use-of-empty-return-value.md) | error | The return value of void functions should not be used | 6.2M |
| [sonarjs/no-useless-catch](https://lintradar.dev/rules/sonarjs/no-useless-catch.md) | error | "catch" clauses should do more than rethrow | 6.2M |
| [sonarjs/no-useless-increment](https://lintradar.dev/rules/sonarjs/no-useless-increment.md) | error | Values should not be uselessly incremented | 6.2M |
| [sonarjs/no-useless-intersection](https://lintradar.dev/rules/sonarjs/no-useless-intersection.md) | error | Type intersections should use meaningful types | 6.2M |
| [sonarjs/no-useless-react-setstate](https://lintradar.dev/rules/sonarjs/no-useless-react-setstate.md) | error | React state setter function should not be called with its matching state variable | 6.2M |
| [sonarjs/no-vue-class-component](https://lintradar.dev/rules/sonarjs/no-vue-class-component.md) | error | Vue components should not use the deprecated "vue-class-component" or "vue-property-decorator" libraries | 6.2M |
| [sonarjs/no-vue-mixins](https://lintradar.dev/rules/sonarjs/no-vue-mixins.md) | error | Vue components should not use mixins | 6.2M |
| [sonarjs/no-weak-cipher](https://lintradar.dev/rules/sonarjs/no-weak-cipher.md) | error | Cipher algorithms should be robust | 6.2M |
| [sonarjs/no-weak-keys](https://lintradar.dev/rules/sonarjs/no-weak-keys.md) | error | Cryptographic keys should be robust | 6.2M |
| [sonarjs/non-existent-operator](https://lintradar.dev/rules/sonarjs/non-existent-operator.md) | error | Non-existent operators '=+', '=-' and '=!' should not be used | 6.2M |
| [sonarjs/null-dereference](https://lintradar.dev/rules/sonarjs/null-dereference.md) | error | Properties of variables with "null" or "undefined" values should not be accessed | 6.2M |
| [sonarjs/object-alt-content](https://lintradar.dev/rules/sonarjs/object-alt-content.md) | error | "<object>" tags should provide an alternative content | 6.2M |
| [sonarjs/parameterized-tests](https://lintradar.dev/rules/sonarjs/parameterized-tests.md) | error | Similar tests should be grouped in a single Parameterized test | 6.2M |
| [sonarjs/post-message](https://lintradar.dev/rules/sonarjs/post-message.md) | error | Origins should be verified during cross-origin communications | 6.2M |
| [sonarjs/prefer-cypress-should](https://lintradar.dev/rules/sonarjs/prefer-cypress-should.md) | error | Cypress assertions should be retryable | 6.2M |
| [sonarjs/prefer-default-last](https://lintradar.dev/rules/sonarjs/prefer-default-last.md) | error | "default" clauses should be last | 6.2M |
| [sonarjs/prefer-native-axios-alternative](https://lintradar.dev/rules/sonarjs/prefer-native-axios-alternative.md) | error | Native APIs should be preferred over Axios utility methods | 6.2M |
| [sonarjs/prefer-native-jquery-alternative](https://lintradar.dev/rules/sonarjs/prefer-native-jquery-alternative.md) | error | Native APIs should be preferred over jQuery utility methods | 6.2M |
| [sonarjs/prefer-native-lodash-alternative](https://lintradar.dev/rules/sonarjs/prefer-native-lodash-alternative.md) | error | Native APIs should be preferred over Lodash and Underscore.js methods | 6.2M |
| [sonarjs/prefer-promise-shorthand](https://lintradar.dev/rules/sonarjs/prefer-promise-shorthand.md) | error | Shorthand promises should be used | 6.2M |
| [sonarjs/prefer-read-only-props](https://lintradar.dev/rules/sonarjs/prefer-read-only-props.md) | error | React props should be read-only | 6.2M |
| [sonarjs/prefer-regexp-exec](https://lintradar.dev/rules/sonarjs/prefer-regexp-exec.md) | error | "RegExp.exec()" should be preferred over "String.match()" | 6.2M |
| [sonarjs/prefer-single-boolean-return](https://lintradar.dev/rules/sonarjs/prefer-single-boolean-return.md) | error | Return of boolean expressions should not be wrapped into an "if-then-else" statement | 6.2M |
| [sonarjs/prefer-specific-assertions](https://lintradar.dev/rules/sonarjs/prefer-specific-assertions.md) | error | The most specific assertion should be used | 6.2M |
| [sonarjs/prefer-type-guard](https://lintradar.dev/rules/sonarjs/prefer-type-guard.md) | error | Type predicates should be used | 6.2M |
| [sonarjs/production-debug](https://lintradar.dev/rules/sonarjs/production-debug.md) | error | Debugging features should not be enabled in production | 6.2M |
| [sonarjs/pseudo-random](https://lintradar.dev/rules/sonarjs/pseudo-random.md) | error | Pseudorandom number generators (PRNGs) should not be used in security contexts | 6.2M |
| [sonarjs/public-static-readonly](https://lintradar.dev/rules/sonarjs/public-static-readonly.md) | error | Public "static" fields should be read-only | 6.2M |
| [sonarjs/publicly-writable-directories](https://lintradar.dev/rules/sonarjs/publicly-writable-directories.md) | error | Temporary files should not be created in publicly writable directories | 6.2M |
| [sonarjs/reduce-initial-value](https://lintradar.dev/rules/sonarjs/reduce-initial-value.md) | error | "Array.reduce()" calls should include an initial value | 6.2M |
| [sonarjs/redundant-type-aliases](https://lintradar.dev/rules/sonarjs/redundant-type-aliases.md) | error | Redundant type aliases should not be used | 6.2M |
| [sonarjs/regex-complexity](https://lintradar.dev/rules/sonarjs/regex-complexity.md) | error | Regular expressions should not be too complicated | 6.2M |
| [sonarjs/review-blockchain-mnemonic](https://lintradar.dev/rules/sonarjs/review-blockchain-mnemonic.md) | error | Wallet phrases should not be hard-coded | 6.2M |
| [sonarjs/session-regeneration](https://lintradar.dev/rules/sonarjs/session-regeneration.md) | error | A new session should be created during user authentication | 6.2M |
| [sonarjs/single-char-in-character-classes](https://lintradar.dev/rules/sonarjs/single-char-in-character-classes.md) | error | Character classes in regular expressions should not contain only one character | 6.2M |
| [sonarjs/single-character-alternation](https://lintradar.dev/rules/sonarjs/single-character-alternation.md) | error | Single-character alternations in regular expressions should be replaced with character classes | 6.2M |
| [sonarjs/slow-regex](https://lintradar.dev/rules/sonarjs/slow-regex.md) | error | Regular expressions should not cause catastrophic backtracking | 6.2M |
| [sonarjs/sql-queries](https://lintradar.dev/rules/sonarjs/sql-queries.md) | error | SQL queries should not be dynamically formatted | 6.2M |
| [sonarjs/stable-tests](https://lintradar.dev/rules/sonarjs/stable-tests.md) | error | Tests should be stable | 6.2M |
| [sonarjs/stateful-regex](https://lintradar.dev/rules/sonarjs/stateful-regex.md) | error | Regular expressions with the global flag should be used with caution | 6.2M |
| [sonarjs/strict-transport-security](https://lintradar.dev/rules/sonarjs/strict-transport-security.md) | error | HTTP Strict-Transport-Security policy should not be disabled | 6.2M |
| [sonarjs/super-linear-regex](https://lintradar.dev/rules/sonarjs/super-linear-regex.md) | error | Regular expressions should not cause non-linear backtracking | 6.2M |
| [sonarjs/synchronous-exception-assertions](https://lintradar.dev/rules/sonarjs/synchronous-exception-assertions.md) | error | Synchronous exception assertions should receive synchronous callbacks | 6.2M |
| [sonarjs/synchronous-suite-callback](https://lintradar.dev/rules/sonarjs/synchronous-suite-callback.md) | error | Tests should not be registered asynchronously in suite callbacks | 6.2M |
| [sonarjs/table-header](https://lintradar.dev/rules/sonarjs/table-header.md) | error | Tables should have headers | 6.2M |
| [sonarjs/table-header-reference](https://lintradar.dev/rules/sonarjs/table-header-reference.md) | error | Table cells should reference their headers | 6.2M |
| [sonarjs/test-check-exception](https://lintradar.dev/rules/sonarjs/test-check-exception.md) | error | Tests should check which exception is thrown | 6.2M |
| [sonarjs/testing-library-prefer-query-by-disappearance](https://lintradar.dev/rules/sonarjs/testing-library-prefer-query-by-disappearance.md) | error | Testing Library disappearance waits should use non-throwing queries | 6.2M |
| [sonarjs/testing-library-query-assertion](https://lintradar.dev/rules/sonarjs/testing-library-query-assertion.md) | error | Testing Library queries should match presence assertions | 6.2M |
| [sonarjs/todo-tag](https://lintradar.dev/rules/sonarjs/todo-tag.md) | error | Track uses of "TODO" tags | 6.2M |
| [sonarjs/unused-import](https://lintradar.dev/rules/sonarjs/unused-import.md) | error | Unnecessary imports should be removed | 6.2M |
| [sonarjs/unused-named-groups](https://lintradar.dev/rules/sonarjs/unused-named-groups.md) | error | Names of regular expressions named groups should be used | 6.2M |
| [sonarjs/unverified-certificate](https://lintradar.dev/rules/sonarjs/unverified-certificate.md) | error | Server certificates should be verified during SSL/TLS connections | 6.2M |
| [sonarjs/unverified-hostname](https://lintradar.dev/rules/sonarjs/unverified-hostname.md) | error | Server hostnames should be verified during SSL/TLS connections | 6.2M |
| [sonarjs/updated-const-var](https://lintradar.dev/rules/sonarjs/updated-const-var.md) | error | "const" variables should not be reassigned | 6.2M |
| [sonarjs/updated-loop-counter](https://lintradar.dev/rules/sonarjs/updated-loop-counter.md) | error | Loop counters should not be assigned within the loop body | 6.2M |
| [sonarjs/use-type-alias](https://lintradar.dev/rules/sonarjs/use-type-alias.md) | error | Type aliases should be used | 6.2M |
| [sonarjs/vitest-mock-at-module-scope](https://lintradar.dev/rules/sonarjs/vitest-mock-at-module-scope.md) | error | Vi.mock should be declared at module scope | 6.2M |
| [sonarjs/void-use](https://lintradar.dev/rules/sonarjs/void-use.md) | error | "void" should not be used | 6.2M |
| [sonarjs/weak-ssl](https://lintradar.dev/rules/sonarjs/weak-ssl.md) | error | Weak SSL/TLS protocols should not be used | 6.2M |
| [sonarjs/x-powered-by](https://lintradar.dev/rules/sonarjs/x-powered-by.md) | error | Web application technologies should not disclose version information | 6.2M |
| [sonarjs/xml-parser-xxe](https://lintradar.dev/rules/sonarjs/xml-parser-xxe.md) | error | XML parsers should not be vulnerable to XXE attacks | 6.2M |

---

Web page: https://lintradar.dev/presets/sonarjs-recommended. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
