Prashanth Harish
Prashanth Harish

Reputation: 178

Why jslint is not working with npm package

I installed :

npm i jslint

[email protected] updated 1 package and audited 6594 packages in 5.791s found 53 vulnerabilities (15 low, 16 moderate, 22 high)

I have made some configurations :
./node_modules/.bin/jslint --init

then :
./node_modul.es/.bin/jslint gulpfile.js --fix

I have got suggestions but it is not fixing it.

Upvotes: 0

Views: 647

Answers (2)

Alen Genzić
Alen Genzić

Reputation: 1418

There's two ways of installing npm packages.

Locally and globally.

You've installed the package locally but are trying to run a global command.

To install the package globally you could run the following command

npm i -g jslint

Alternatively, since you don't have global permissions you could install it locally and add an npm script to the package.json file in your project:

"scripts": {
    "lint": "jslint gulpfile.js"
}

And run it with

npm run lint

Upvotes: 1

jro
jro

Reputation: 940

If you do not have permissions to install globally, and you use npm version 5.2+, you can use npx.

It downloads the package and executes it locally.

Usage:

npx jslint --init

JSlint doesn't seem to have a --fix option, so your second command wouldn't work anyway. Consider using eslint which has auto fix feature

Upvotes: 1

Related Questions