Travis CI with Ionic project?

I can’t get Travis CI to work properly with my existing project.
The build always exit with code 0 (passed) even if there are errors

Here is .travis.yml


sudo: required
dist: trusty
addons:
  apt:
    sources:
      - google-chrome
    packages:
      - google-chrome-stable
language: node_js
node_js:
  - stable
before_install:
  - npm i npm@^4 -g
install:
  - npm install
script:
  - npm run build
before_script:
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start
  - sleep 3
notifications:
  email: false

Here is a build test contains a linting error:

As you see it still pass with the error.
How can I fix this? How to cause the build to fail when there are linting errors?

Thanks.

No idea about Travis, but maybe this is because lint errors are not real errors but more “information”?

I think it should behave the same way it behaves in angular cli. currently linting is only useful on local development.

How does it behave there?

Have a look at this travis build for example https://travis-ci.org/EyeSeeTea/FIRE-WiFiCalling/builds/254153857

It should fail when there is a linting error, but it does not.

When building angular cli projects, such linting error causes the build to fail and forces developers to lint their code before pushing a PR