0

I am receiving the following errors when running TSLint in Azure Devops Build Pipeline. I want to make the build pipeline continue to next step, even if there are lint error. How can this be resolved?

Command Line:

  - script: |
      npm run lint > tsLintReport.txt
    displayName: 'ng lint'

Error:

Lint warnings found in the listed files.
Lint errors found in the listed files.
Lint errors found in the listed files.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ipts@1.0.0 lint: `ng lint`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ipts@1.0.0 lint script.
Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • The linting failed, because there are linting errors in some files. Check `tsLintReport.txt` for them. – Alex Biro Sep 07 '20 at 06:03
  • I want to make the build pipeline continue, even if there are lint error. can this be done cc @AlexBiro –  Sep 07 '20 at 06:04
  • You have to configure your CI to ignore the results of the linting, I am not familiar with the Azure CI. And actually, I don't suggest to that, because that way you will probably never fix those issues, and they will just keep piling up. – Alex Biro Sep 07 '20 at 06:12

2 Answers2

1

Please add continueOnError:

  - script: |
      npm run lint > tsLintReport.txt
    displayName: 'ng lint'
    continueOnError: true

it will not break the build but the build finishes with issues.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • Is there a way to view the lint errors or warnings in the summary tab? – Ε Г И І И О Dec 29 '20 at 10:07
  • 1
    Summary tab supports markdown format. So you need to format it. But you can try with logging command as it is shown here https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash#uploadsummary-add-some-markdown-content-to-the-build-summary you can try also upload file as `uploadfile` – Krzysztof Madej Dec 29 '20 at 12:02
  • Thanks Madej, that's good to know. Also I've found there are formatters for Eslint already (eslint-formatter-vso), so planning to go down that path instead. – Ε Г И І И О Dec 29 '20 at 12:10
  • Cool! Can you consider upvoting my answer if it was helpful for you? – Krzysztof Madej Dec 29 '20 at 12:52
-1

try running "npm run lint -- --fix" that would fix the lint errors automatically

Niranjana V S
  • 147
  • 2
  • 3
  • 1
    Such changes should never be done in a CI pipeline – Nico Haase Oct 13 '21 at 15:58
  • @NicoHaase If we get issue with angular code in CICD pile we can use this command with the angular code if we have some blank space or in place of === if we added == it will resolve automatically – Niranjana V S Oct 20 '21 at 11:45
  • What do you mean by "it will resolve automatically"? Would the pipeline commit these changes to your repository? – Nico Haase Oct 20 '21 at 11:58