Is it necesary to have already installed node.js to install ESlint?
npm
is mostly just moving files around for you - if you want to install it without npm
, just move the files around yourself.
E.g. go grab the latest release of eslint from github, copy it to your enterprise computer (network/flash drive?) and unpack it. Then call it directly using node path/to/bin/eslint.js
.
If you have node.js installed it should work - if not, you'll need to use a similar approach to install that.
To execute it without prefixing the command with node
, e.g. just eslint
, you would need to install a .cmd
wrapper alongside it. npm
does this using cmd-shim
If you wanted to run it without having node.js installed, then you would need to package the node.js runtime and eslint together - options for this include pkg and nexe
To get VSCode to run eslint, you would need to setup a custom task runner by adding a tasks.js
file to your project - e.g:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "eslint-fix",
"type": "shell",
"command": "path/to/your/packaged/eslint --fix"
}
]
}
Then you can use the Tasks: Run Task
command to find and execute it - or setup a shortcut - for more details see the docs https://code.visualstudio.com/docs/editor/tasks#_custom-tasks
I have created a Github repo for creating a tailored Eslint standalone binary here: Eslint-Standalone
This uses node, npm and pkg to build a eslint tool into a binary, such as an exe for win platform. You can then use that exe and copy it into your network at work with restrictions when it comes to npm.