1.1.2 • Published 6 years ago
tslint-xt v1.1.2
TslintXt - master branch
About
This is a tslint rule that throws error for:
- forced tests:
fdescribe
,fit
,it.only
,describe.only
,context.only
,test.only
- disabled tests:
xdescribe
,describe.skip
,xit
,test.skip
- todo tests:
test.todo
- empty
.spec.ts
files - comment only
.ts
files - following empty lines
Usage
- Install with:
npm install tslint-xt --save-dev
oryarn add tslint-xt --dev
- or add
"tslint-xt": "1.1.1"
to the devDependencies in your package.json. - Extend this package in your
.tslint.json
file, e.g.:
"rulesDirectory": [
"node_modules/tslintxt"
],
"rules": {
"no-comment-files": true,
"no-disabled-tests": true,
"no-empty-tests": true,
"no-forced-tests": true,
"no-todo-tests": true
...
(as per the instructions for custom rules)
Run
tslint
as you usually would (gulp plugin, directly from node, etc)If you forget to remove a call to
fdescribe
,fit
,it.only
,describe.only
,context.only
,test.only
then you will see following message from tslint:
app.spec.ts[1, 1]: Forced tests are not allowed!
- If you forget to remove a call to
xdescribe
,describe.skip
,xit
,test.skip
then you will see following message from tslint:
app.spec.ts[1, 1]: Disabled tests are not allowed!
- If you forget to remove a call to
test.todo
then you will see following message from tslint:
app.spec.ts[1, 1]: Do not use TODO unit tests!
- If you have a .spec.ts-file without any tests then you will see following message from tslint:
app.spec.ts[1, 1]: Empty spec files are not allowed!
- If you have a file with only containing comments you will see following message from tslint:
app.ts[1, 1]: Comment files are not allowed!
- If you have a file with following empty lines you will see following message from tslint:
app.ts[1, 1]: No following empty lines allowed!
License
TslintXt is distributed under the MIT license. See LICENSE for details.