I'm trying to install ESlint to use it with Sublime Text 2 for all my local projects. Configuration documentation is very unclear about global installation:
Note:
eslint --init
is intended for setting up and configuring ESLint on a per-project basis and will perform a local installation of ESLint and its plugins in the directory in which it is run. If you prefer using a global installation of ESLint, any plugins used in your configuration must also be installed globally.
I don't understand what they mean. I used eslint --init
and it installed ESlint locally in node_modules
, along with all plugins. There's nothing explained about installing plugins globally. How do I do that? Also, how do I use the global ESlint installation if eslint --init
installs local one anyway? This is so confusing.
Make sure your plugins (and ESLint) are both in your project's package. json as devDependencies (or dependencies, if your project uses ESLint at runtime). Make sure you have run npm install and all your dependencies are installed. Make sure your plugins' peerDependencies have been installed as well.
ESLint inside VSCode Simply open up VSCode and open the Extensions from the sidebar. Search for ESLint and install the extension. That's it! You should now be able to use ESLint inside Visual Studio Code!
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions: ESLint uses Espree for JavaScript parsing. ESLint uses an AST to evaluate patterns in code.
You can install Node modules within the project (locally) or globally. To switch to globally, you may use the -g
flag, like so:
npm install -g eslint
Then see if it's working without Sublime Text (-v
flag to see the version of eslint):
eslint -v
To see where it was installed (assuming MacOS/Linux):
which eslint
Then see if it's working in Sublime Text (you may need to restart Sublime first). If it's not working, make sure in the eslint package settings that the path is correct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With