Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
tslint-sonarts
Advanced tools
Static code analyzer for TypeScript detecting bugs and suspicious patterns in your code.
Follow us on twitter
To analyze pure JavaScript code, see SonarJS
How does it work?
no-gratuitous-expressions
Rules in this category aim to find places in code which has a high chance to be bugs, i.e. don't work as intended.
Most of the time this is a result of bad copy-paste (no-identical-conditions
) or improvident API usage (no-misleading-array-reverse
).
Some rules are raising issues on unused values (no-useless-increment
), which is at best wasted code and at worst a bug.
no-all-duplicated-branches
)no-case-with-or
)no-collection-size-mischeck
) (requires type-check
)no-element-overwrite
) (requires type-check
)no-empty-array
)no-empty-destructuring
)no-identical-conditions
)no-identical-expressions
)no-ignored-initial-value
) (requires type-check
)no-ignored-return
) (requires type-check
)no-in-misuse
)no-misleading-array-reverse
) (requires type-check
)no-misspelled-operator
)no-self-assignment
) (requires type-check
)no-try-promise
)no-unthrown-error
)no-use-of-empty-return-value
) (requires type-check
)no-useless-increment
)no-useless-intersection
)Code Smells issues, or Maintainability issues, are raised for places of code which might be costly to change in the future (cognitive-complexity
).
These rules also help to keep the high code quality and readability (no-commented-code
, no-identical-functions
, use-primitive-type
).
And finally some rules report issues on different suspicious code patters (no-dead-store
, no-gratuitous-expressions
).
arguments-order
)bool-param-default
)cognitive-complexity
)consecutive-overloads
)max-switch-cases
)max-union-size
)mccabe-complexity
)no-accessor-field-mismatch
) (requires type-check
)no-alphabetical-sort
)delete
should not be used on arrays (no-array-delete
) (requires type-check
)no-big-function
)no-collapsible-if
)no-commented-code
)no-dead-store
) (requires type-check
)no-duplicate-in-composite
)no-duplicate-string
)no-duplicated-branches
)no-empty-nested-blocks
)no-extra-semicolon
)no-gratuitous-expressions
)no-hardcoded-credentials
)no-identical-functions
)no-inconsistent-return
)no-invalid-await
)no-invariant-return
)no-inverted-boolean-check
)no-multiline-string-literals
)no-nested-incdec
)no-nested-switch
)no-nested-template-literals
)no-redundant-boolean
)no-redundant-jump
)no-redundant-parentheses
)no-return-type-any
) (requires type-check
)no-same-line-conditional
)no-small-switch
)no-statements-same-line
)no-unconditional-jump
)no-undefined-argument
)no-unenclosed-multiline-block
)no-unused-array
) (requires type-check
)no-useless-cast
) (requires type-check
)no-useless-catch
)no-variable-usage-before-declaration
) (requires type-check
)parameters-max-number
)prefer-default-last
)prefer-immediate-return
) (requires type-check
)prefer-optional
)prefer-promise-shorthand
)prefer-type-guard
)use-primitive-type
) (requires type-check
)use-type-alias
) (requires type-check
)Node.js (>=6.x).
tslint-sonarts
npm install tslint-sonarts --save-dev # install in your project
npm install tslint-sonarts -g # or install globally
tslint-sonarts
to your tslint.json
extends
property:{
"extends": ["tslint:recommended", "tslint-sonarts"]
}
tslint --project ./tsconfig.json 'src/**/*.{ts,tsx}'
We also have a plugin for ESLint
SonarTS is available as plugin for SonarQube. SonarQube is an open source platform for continuous inspection of code quality. Thanks to the platform, SonarTS provides additional features:
See the documentation here and example project here.
Also available online on :cloud: SonarCloud
You want to participate to the development of our TypeScript analyzer? Have a look at our contributor guide!
FAQs
SonarTS rules for TSLint
We found that tslint-sonarts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.