Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.