小编har*_*con的帖子

如何运行 ng lint 并在预提交时检测错误?

我的预提交脚本有问题。我正在尝试运行我的角度项目预提交文件的“ng lint”;当检测到 lint 错误时,我在日志上看到错误,但预提交过程成功通过。我需要在预提交文件中执行 ng-lint,因为我要运行其他验证...当 ng lint 未成功通过时,如何获取消息?

我的脚本:

#!/bin/bash

### other scripts to validate custom commits

-----------



### Run ng lint

echo "pre-commit hook --> linting" ng lint

ng lint

echo -e "ng lint pass sucessfully \n\n"
Run Code Online (Sandbox Code Playgroud)

日志

pre-commit hook --> linting
Linting "front-firefly-backoffice"...
/home/apanez/Escritorio/htdocs/eci/front-firefly/src/app/stock/limit-sale/components/limit-sale-detail/limit-sale-detail.component.ts:30:14
ERROR: 30:14  component-class-suffix  The name of the class LimitSaleDetailComp should end with the suffix Component (https://angular.io/styleguide#style-02-03)

Lint errors found in the listed files.

ng lint pass sucessfully
Run Code Online (Sandbox Code Playgroud)

bash lint githooks angular

7
推荐指数
1
解决办法
6090
查看次数

标签 统计

angular ×1

bash ×1

githooks ×1

lint ×1