npm tslint不会给出错误

Bjö*_*rth 6 npm tslint

嘿所有人都遇到了npmtslint的问题我希望你能帮助我.好的,我的情况和代码:

的package.json

"scripts": {
    "lint": "tslint -c tslint.json 'src/app/**/*.ts'",
    "pretest": "npm run lint ",
    "test": "echo 'No test are made'",
...
  },
Run Code Online (Sandbox Code Playgroud)

当我运行命令时,npm test这是输出:

输入终端

$ npm test
Run Code Online (Sandbox Code Playgroud)

输出终端

> keoom@1.0.0 pretest c:\Users\Hjorth\Documents\github\keoom-angular
> npm run lint


> keoom@1.0.0 lint c:\Users\Hjorth\Documents\github\keoom-angular
> tslint -c tslint.json 'src/app/**/*.ts'


> keoom@1.0.0 test c:\Users\Hjorth\Documents\github\keoom-angular
> echo 'No test are made'

'No test are made'
Run Code Online (Sandbox Code Playgroud)

如果我运行命令tslint -c tslint.json 'src/app/**/*.ts'I,另一方面看到linting错误.

输入终端

$ tslint -c tslint.json 'src/app/**/*.ts'
Run Code Online (Sandbox Code Playgroud)

输出终端

src/app/app.component.ts[1, 27]: " should be '
Run Code Online (Sandbox Code Playgroud)

因此,您可以看到我的代码中存在linting错误,但如果我没有直接运行脚本它将无法显示.我期待的是:

当我运行npm test脚本pretest将运行,并且该脚本将运行脚本时lint,它将exit 0test脚本运行之前退出,因为它将找到linting错误.

任何可以提供帮助的人.

car*_*ant 9

这是tslint命令中文件规范的引号是问题:

"lint": "tslint -c tslint.json 'src/app/**/*.ts'"
                               ^               ^
Run Code Online (Sandbox Code Playgroud)

如果删除它们,您应该会看到报告的预期错误tslint.