Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm tslint don't give error

Tags:

npm

tslint

Hey all got a issue with npm and tslint I was hoping you could help me with. Ok here comes my situation and code:

package.json

"scripts": {
    "lint": "tslint -c tslint.json 'src/app/**/*.ts'",
    "pretest": "npm run lint ",
    "test": "echo 'No test are made'",
...
  },

When I run command npm test this is the output:

input terminal

$ npm test

output terminal

> [email protected] pretest c:\Users\Hjorth\Documents\github\keoom-angular
> npm run lint


> [email protected] lint c:\Users\Hjorth\Documents\github\keoom-angular
> tslint -c tslint.json 'src/app/**/*.ts'


> [email protected] test c:\Users\Hjorth\Documents\github\keoom-angular
> echo 'No test are made'

'No test are made'

If I only run command tslint -c tslint.json 'src/app/**/*.ts' I on the other hand see the linting error.

input terminal

$ tslint -c tslint.json 'src/app/**/*.ts'

output terminal

src/app/app.component.ts[1, 27]: " should be '

So as you can see there is a linting error in my code, but if I am not running the script directly It will not show. What I am expecting is this:

When I run npm test the script pretest will run, and that script will run the script lint, it will then exit with exit 0 before test script is run as it will find the linting error.

Anyone that can be of assistance.

like image 481
Björn Hjorth Avatar asked Aug 10 '16 18:08

Björn Hjorth


1 Answers

It's the quotes around the file spec in the tslint command that are the problem:

"lint": "tslint -c tslint.json 'src/app/**/*.ts'"
                               ^               ^

If you remove those, you should see the expected error reported by tslint.

like image 196
cartant Avatar answered Nov 15 '22 10:11

cartant