Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/un-ts/eslint-plugin-sonar

ESLint rules extracted from SonarJS
https://github.com/un-ts/eslint-plugin-sonar

eslint eslint-plugin sonarjs sonarlint sonarqube

Last synced: 2 days ago
JSON representation

ESLint rules extracted from SonarJS

Awesome Lists containing this project

README

        

# eslint-plugin-sonar

[ESLint](https://github.com/eslint/eslint) rules extracted from [SonarJS](https://github.com/SonarSource/SonarJS)

[![GitHub Actions](https://github.com/un-ts/eslint-plugin-sonar/workflows/CI/badge.svg)](https://github.com/un-ts/eslint-plugin-sonar/actions/workflows/ci.yml)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Frx-ts%2Feslint-plugin-sonar%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![npm](https://img.shields.io/npm/v/eslint-plugin-sonar.svg)](https://www.npmjs.com/package/eslint-plugin-sonar)
[![GitHub release](https://img.shields.io/github/release/un-ts/eslint-plugin-sonar)](https://github.com/un-ts/eslint-plugin-sonar/releases)

[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/atlassian/changesets)

## TOC

- [Usage](#usage)
- [Install](#install)
- [Enable rules manually](#enable-rules-manually)
- [Extends configs](#extends-configs)
- [Rule list](#rule-list)
- [Sponsors](#sponsors)
- [Backers](#backers)
- [Changelog](#changelog)
- [License](#license)

## Usage

### Install

```sh
# yarn
yarn add -D eslint-plugin-sonar

# npm
npm install -D eslint-plugin-sonar
```

### Enable rules manually

```jsonc
// .eslintrc
{
"plugins": ["sonar"],
"rules": {
"sonar/deprecation": 1,
},
}
```

### Extends configs

```jsonc
{
"extends": [
// only one of the following is needed to be enabled
"plugin:sonar/base",
"plugin:sonar/recommended",
],
}
```

## Rule list

| rule name | detail link |
| ----------------------------------------- | -------------------------------------------------------------- |
| `accessor-pairs` | |
| `alt-text` | |
| `anchor-has-content` | |
| `anchor-is-valid` | |
| `anchor-precedence` | |
| `argument-type` | |
| `arguments-order` | |
| `arguments-usage` | |
| `array-callback-without-return` | |
| `array-constructor` | |
| `arrow-function-convention` | |
| `assertions-in-tests` | |
| `aws-apigateway-public-api` | |
| `aws-ec2-rds-dms-public` | |
| `aws-ec2-unencrypted-ebs-volume` | |
| `aws-efs-unencrypted` | |
| `aws-iam-all-privileges` | |
| `aws-iam-all-resources-accessible` | |
| `aws-iam-privilege-escalation` | |
| `aws-iam-public-access` | |
| `aws-opensearchservice-domain` | |
| `aws-rds-unencrypted-databases` | |
| `aws-restricted-ip-admin-access` | |
| `aws-s3-bucket-granted-access` | |
| `aws-s3-bucket-insecure-http` | |
| `aws-s3-bucket-public-access` | |
| `aws-s3-bucket-server-encryption` | |
| `aws-s3-bucket-versioning` | |
| `aws-sagemaker-unencrypted-notebook` | |
| `aws-sns-unencrypted-topics` | |
| `aws-sqs-unencrypted-queue` | |
| `bitwise-operators` | |
| `bool-param-default` | |
| `brace-style` | |
| `call-argument-line` | |
| `certificate-transparency` | |
| `chai-determinate-assertion` | |
| `class-name` | |
| `class-prototype` | |
| `code-eval` | |
| `comma-or-logical-or-case` | |
| `comment-regex` | |
| `concise-regex` | |
| `conditional-indentation` | |
| `confidential-information-logging` | |
| `constructor-for-side-effects` | |
| `content-length` | |
| `content-security-policy` | |
| `cookie-no-httponly` | |
| `cookies` | |
| `cors` | |
| `csrf` | |
| `cyclomatic-complexity` | |
| `declarations-in-global-scope` | |
| `default-param-last` | |
| `deprecation` | |
| `destructuring-assignment-syntax` | |
| `different-types-comparison` | |
| `disabled-auto-escaping` | |
| `disabled-resource-integrity` | |
| `disabled-timeout` | |
| `dns-prefetching` | |
| `duplicates-in-character-class` | |
| `empty-string-repetition` | |
| `encryption` | |
| `encryption-secure-mode` | |
| `enforce-trailing-comma` | |
| `existing-groups` | |
| `expression-complexity` | |
| `file-header` | |
| `file-name-differ-from-class` | |
| `file-permissions` | |
| `file-uploads` | |
| `fixme-tag` | |
| `for-in` | |
| `for-loop-increment-sign` | |
| `frame-ancestors` | |
| `function-inside-loop` | |
| `function-name` | |
| `function-return-type` | |
| `future-reserved-words` | |
| `generator-without-yield` | |
| `hashing` | |
| `hidden-files` | |
| `hook-use-state` | |
| `html-has-lang` | |
| `in-operator-type-error` | |
| `inconsistent-function-call` | |
| `index-of-compare-to-positive-number` | |
| `insecure-cookie` | |
| `insecure-jwt-token` | |
| `inverted-assertion-arguments` | |
| `jsx-key` | |
| `jsx-no-constructed-context-values` | |
| `jsx-no-useless-fragment` | |
| `label-has-associated-control` | |
| `label-position` | |
| `link-with-target-blank` | |
| `max-union-size` | |
| `media-has-caption` | |
| `misplaced-loop-counter` | |
| `mouse-events-a11y` | |
| `nested-control-flow` | |
| `new-cap` | |
| `new-operator-misuse` | |
| `no-accessor-field-mismatch` | |
| `no-alphabetical-sort` | |
| `no-angular-bypass-sanitization` | |
| `no-array-delete` | |
| `no-array-index-key` | |
| `no-associative-arrays` | |
| `no-base-to-string` | |
| `no-built-in-override` | |
| `no-case-label-in-switch` | |
| `no-clear-text-protocols` | |
| `no-code-after-done` | |
| `no-commented-code` | |
| `no-dead-store` | |
| `no-delete-var` | |
| `no-deprecated-react` | |
| `no-duplicate-in-composite` | |
| `no-empty` | |
| `no-empty-after-reluctant` | |
| `no-empty-alternatives` | |
| `no-empty-function` | |
| `no-empty-group` | |
| `no-empty-interface` | |
| `no-empty-test-file` | |
| `no-equals-in-for-termination` | |
| `no-exclusive-tests` | |
| `no-extend-native` | |
| `no-extra-semi` | |
| `no-find-dom-node` | |
| `no-for-in-iterable` | |
| `no-function-declaration-in-block` | |
| `no-global-this` | |
| `no-globals-shadowing` | |
| `no-hardcoded-credentials` | |
| `no-hardcoded-ip` | |
| `no-hook-setter-in-body` | |
| `no-ignored-exceptions` | |
| `no-implicit-dependencies` | |
| `no-implicit-global` | |
| `no-in-misuse` | |
| `no-incomplete-assertions` | |
| `no-inconsistent-returns` | |
| `no-incorrect-string-concat` | |
| `no-infinite-loop` | |
| `no-intrusive-permissions` | |
| `no-invalid-await` | |
| `no-invariant-returns` | |
| `no-ip-forward` | |
| `no-labels` | |
| `no-literal-call` | |
| `no-lonely-if` | |
| `no-mime-sniff` | |
| `no-misleading-array-reverse` | |
| `no-misused-promises` | |
| `no-mixed-content` | |
| `no-nested-assignment` | |
| `no-nested-conditional` | |
| `no-nested-functions` | |
| `no-nested-incdec` | |
| `no-os-command-from-path` | |
| `no-parameter-reassignment` | |
| `no-primitive-wrappers` | |
| `no-redeclare` | |
| `no-redundant-assignments` | |
| `no-redundant-optional` | |
| `no-redundant-parentheses` | |
| `no-redundant-type-constituents` | |
| `no-reference-error` | |
| `no-referrer-policy` | |
| `no-require-or-define` | |
| `no-return-type-any` | |
| `no-same-argument-assert` | |
| `no-self-compare` | |
| `no-tab` | |
| `no-table-as-layout` | |
| `no-this-alias` | |
| `no-throw-literal` | |
| `no-try-promise` | |
| `no-undefined-argument` | |
| `no-undefined-assignment` | |
| `no-unenclosed-multiline-block` | |
| `no-uniq-key` | |
| `no-unknown-property` | |
| `no-unreachable` | |
| `no-unsafe` | |
| `no-unsafe-unzip` | |
| `no-unstable-nested-components` | |
| `no-unthrown-error` | |
| `no-unused-expressions` | |
| `no-unused-function-argument` | |
| `no-unused-private-class-members` | |
| `no-useless-call` | |
| `no-useless-constructor` | |
| `no-useless-increment` | |
| `no-useless-intersection` | |
| `no-useless-react-setstate` | |
| `no-var` | |
| `no-variable-usage-before-declaration` | |
| `no-vue-bypass-sanitization` | |
| `no-weak-cipher` | |
| `no-weak-keys` | |
| `no-wildcard-import` | |
| `non-number-in-arithmetic-expression` | |
| `null-dereference` | |
| `object-alt-content` | |
| `object-shorthand` | |
| `operation-returning-nan` | |
| `os-command` | |
| `post-message` | |
| `prefer-default-last` | |
| `prefer-enum-initializers` | |
| `prefer-for-of` | |
| `prefer-function-type` | |
| `prefer-namespace-keyword` | |
| `prefer-nullish-coalescing` | |
| `prefer-object-spread` | |
| `prefer-promise-shorthand` | |
| `prefer-spread` | |
| `prefer-string-starts-ends-with` | |
| `prefer-template` | |
| `prefer-type-guard` | |
| `process-argv` | |
| `production-debug` | |
| `pseudo-random` | |
| `public-static-readonly` | |
| `publicly-writable-directories` | |
| `reduce-initial-value` | |
| `redundant-type-aliases` | |
| `regex-complexity` | |
| `regular-expr` | |
| `rules-of-hooks` | |
| `semi` | |
| `session-regeneration` | |
| `shorthand-property-grouping` | |
| `single-char-in-character-classes` | |
| `single-character-alternation` | |
| `slow-regex` | |
| `sockets` | |
| `sonar-block-scoped-var` | |
| `sonar-jsx-no-leaked-render` | |
| `sonar-max-lines` | |
| `sonar-max-lines-per-function` | |
| `sonar-max-params` | |
| `sonar-no-control-regex` | |
| `sonar-no-dupe-keys` | |
| `sonar-no-empty-character-class` | |
| `sonar-no-fallthrough` | |
| `sonar-no-invalid-regexp` | |
| `sonar-no-magic-numbers` | |
| `sonar-no-misleading-character-class` | |
| `sonar-no-regex-spaces` | |
| `sonar-no-unused-class-component-methods` |