SonarSource / Eslint Plugin Sonarjs
Licence: lgpl-3.0
SonarJS rules for ESLint
Stars: ✭ 458
Programming Languages
javascript
184084 projects - #8 most used programming language
typescript
32286 projects
Projects that are alternatives of or similar to Eslint Plugin Sonarjs
Eslint Plugin I18n Json
Fully extendable eslint plugin for JSON i18n translation files.
Stars: ✭ 101 (-77.95%)
Mutual labels: eslint, linter, eslint-plugin
Xo
❤️ JavaScript/TypeScript linter (ESLint wrapper) with great defaults
Stars: ✭ 6,277 (+1270.52%)
Mutual labels: eslint, linter, eslint-plugin
Eslint Plugin Vue
Official ESLint plugin for Vue.js
Stars: ✭ 3,592 (+684.28%)
Mutual labels: static-analysis, eslint, eslint-plugin
Wotan
Pluggable TypeScript and JavaScript linter
Stars: ✭ 271 (-40.83%)
Mutual labels: static-analysis, linter, code-analysis
codeclimate-eslint
Code Climate Engine for ESLint
Stars: ✭ 86 (-81.22%)
Mutual labels: eslint, linter, static-analysis
Bodyclose
Analyzer: checks whether HTTP response body is closed and a re-use of TCP connection is not blocked.
Stars: ✭ 181 (-60.48%)
Mutual labels: static-analysis, linter, code-analysis
Pmd
An extensible multilanguage static code analyzer.
Stars: ✭ 3,667 (+700.66%)
Mutual labels: static-analysis, linter, code-analysis
Spotbugs
SpotBugs is FindBugs' successor. A tool for static analysis to look for bugs in Java code.
Stars: ✭ 2,569 (+460.92%)
Mutual labels: static-analysis, linter, code-analysis
static-code-analysis-plugin
A plugin to simplify Static Code Analysis on Gradle. Not restricted to, but specially useful, in Android projects, by making sure all analysis can access the SDK classes.
Stars: ✭ 36 (-92.14%)
Mutual labels: linter, static-analysis, code-analysis
Credo
A static code analysis tool for the Elixir language with a focus on code consistency and teaching.
Stars: ✭ 4,144 (+804.8%)
Mutual labels: static-analysis, linter, code-analysis
Eslint Config Standard React
ESLint Shareable Config for React/JSX support in JavaScript Standard Style
Stars: ✭ 416 (-9.17%)
Mutual labels: eslint, linter
Eslint Plugin Html
An ESLint plugin to extract and lint scripts from HTML files.
Stars: ✭ 333 (-27.29%)
Mutual labels: eslint, eslint-plugin
Eslint Plugin Typescript
TypeScript plugin for ESLint
Stars: ✭ 342 (-25.33%)
Mutual labels: eslint, eslint-plugin
Dlint
Dlint is a tool for encouraging best coding practices and helping ensure we're writing secure Python code.
Stars: ✭ 320 (-30.13%)
Mutual labels: static-analysis, linter
Detekt
Static code analysis for Kotlin
Stars: ✭ 4,169 (+810.26%)
Mutual labels: linter, static-analysis
Eslint
Find and fix problems in your JavaScript code.
Stars: ✭ 19,665 (+4193.67%)
Mutual labels: eslint, linter
Pylint
It's not just a linter that annoys you!
Stars: ✭ 3,733 (+715.07%)
Mutual labels: static-analysis, linter
Exakat
The Exakat Engine : smart static analysis for PHP
Stars: ✭ 346 (-24.45%)
Mutual labels: static-analysis, linter
Awesome Linters
A community-driven list of awesome linters.
Stars: ✭ 439 (-4.15%)
Mutual labels: static-analysis, linter
eslint-plugin-sonarjs
SonarJS rules for ESLint to detect bugs and suspicious patterns in your code.
Rules
Bug Detection 🐛
Rules in this category aim to find places in code which have a high chance of being bugs, i.e. don't work as intended.
- All branches in a conditional structure should not have exactly the same implementation (
no-all-duplicated-branches
) - Collection elements should not be replaced unconditionally (
no-element-overwrite
) - Function calls should not pass extra arguments (
no-extra-arguments
) - Related "if/else if" statements should not have the same condition (
no-identical-conditions
) - Identical expressions should not be used on both sides of a binary operator (
no-identical-expressions
) - Loops with at most one iteration should be refactored (
no-one-iteration-loop
) - The output of functions that don't return anything should not be used (
no-use-of-empty-return-value
)
Code Smell Detection 🐷
Code Smells, or maintainability issues, are raised for places of code which might be costly to change in the future. These rules also help to keep the high code quality and readability. And finally some rules report issues on different suspicious code patters.
- Cognitive Complexity of functions should not be too high (
cognitive-complexity
) - "switch" statements should not have too many "case" clauses (
max-switch-cases
) - Collapsible "if" statements should be merged (
no-collapsible-if
) - Collection sizes and array length comparisons should make sense (
no-collection-size-mischeck
) - String literals should not be duplicated (
no-duplicate-string
) - Two branches in a conditional structure should not have exactly the same implementation (
no-duplicated-branches
) - Functions should not have identical implementations (
no-identical-functions
) - Boolean checks should not be inverted (
no-inverted-boolean-check
) (🔧 fixable) - Boolean literals should not be redundant (
no-redundant-boolean
) - Jump statements should not be redundant (
no-redundant-jump
) - Conditionals should start on new lines (
no-same-line-conditional
) - "switch" statements should have at least 3 "case" clauses (
no-small-switch
) - Collection and array contents should be used (
no-unused-collection
) - "catch" clauses should do more than rethrow (
no-useless-catch
) - Local variables should not be declared and then immediately returned or thrown (
prefer-immediate-return
) (🔧 fixable) - Object literal syntax should be used (
prefer-object-literal
) - Return of boolean expressions should not be wrapped into an "if-then-else" statement (
prefer-single-boolean-return
) - A "while" loop should be used instead of a "for" loop (
prefer-while
) (🔧 fixable)
Prerequisites
Node.js (>=10.x).
Usage
- If you don't have ESLint yet configured for your project, follow these instructions.
- Install
eslint-plugin-sonarjs
usingnpm
(oryarn
) for you project or globally:
npm install eslint-plugin-sonarjs --save-dev # install for your project
npm install eslint-plugin-sonarjs -g # or install globally
- Add
eslint-plugin-sonarjs
to theplugins
option of your.eslintrc
:
{
"plugins": ["sonarjs"]
}
- Add
plugin:sonarjs/recommended
to theextends
option to enable all recommended rules:
{
"extends": ["plugin:sonarjs/recommended"]
}
- or enable only some rules manually:
{
"rules": {
"sonarjs/cognitive-complexity": "error",
"sonarjs/no-identical-expressions": "error"
// etc.
}
}
Contributing
You want to participate in the development of the project? Have a look at our contributing guide!
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].