
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
tslint-no-unused-expression-chai
Advanced tools
Custom tslint no-unused-expression rule supports chai's expect assertion
From tslint 5, lint applies no-unused-expression more strictly. This affects
test assertion written via chai, as its expect assertion is form of expression caught by lint. tslint-no-unused-expression-chai provides drop-in replacement of rule no-unused-expression to loosen lint checker for chai's assertion.
This module supports chai's expect based assertion (i.e expect(x).to.be....).
When adding "should" to the rule configuration, it also supports those assertios.
Other type of property based assertion still may not work.
This has a peer dependencies of tslint@5.*.* and implicit dependency of typescript, which will have to be installed as well
npm install --save-dev tslint-no-unused-expression-chai
You can configure tslint rules by replacing existing no-unused-expression rule.
"rules": {
//accepts all options of https://palantir.github.io/tslint/rules/no-unused-expression/
"no-unused-expression-chai": true
...
},
"rulesDirectory": [
"tslint-no-unused-expression-chai"
...
]
Alternatively you can just extend the configuration preset provided by this package. It disables no-unused-expression and enables no-unused-expression-chai.
"extends": [
...
"tslint-no-unused-expression-chai"
]
Few npm scripts are supported for build / test code. As this rule is simple override to default rules, it doesn't have own unit test coverage but borrows test fixture from original rule.
build: Transpiles code to ES5 commonjs to rules.test: Run tests.lint: Run lint over all codebaseslint:staged: Run lint only for staged changes. This'll be executed automatically with precommit hook.commit: Commit wizard to write commit message0.1.4 (2018-10-03)
<a name="0.1.3"></a>
FAQs
Custom tslint no-unused-expression rule supports chai's expect assertion
The npm package tslint-no-unused-expression-chai receives a total of 13,672 weekly downloads. As such, tslint-no-unused-expression-chai popularity was classified as popular.
We found that tslint-no-unused-expression-chai demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.