articleBody
| -
Right.
So the good news is that you donât need to follow this bit of the tutorial to use the rest of it. Iâd probably advise ignoring eslint and npm scripts for now, as they are fiddly and hard to configure.
If you want to continue trying to get this working, here are some tips:
You need to add in the npm script to the package.json file, something like this:
{
"name": "myapp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1"
},
"devDependencies": {
"eslint": "^6.0.1"
}
}
To create an eslint config, the easiest way is to use npx eslint --init - npx directly runs commands that are available inside node modules, rather than you having to go through the nightmare of figuring out all the path issues and stuff
You can then run eslint on your index file using npx eslint index.js. This works fine
To run the actual npm script we added to the package.json file, you should be able to do npm run lint. This gives the expected result, but it also throws an error right afterwards. And Iâm not sure why.
Iâve run out of time to look into this any more, but I hope this helps a bit.
|