Sublime Forum

ESlint with Neard

#1

i adding this here for those of you who run Neard and are trying to get ESlint to run. i was unable to find a how to that applied to a non-dedicated WAMPN stack like Neard, so here’s EXACTLY how to do it. this will help you avoid unholy errors like this that make you want to tear your eyeballs out:

SublimeLinter: #3 eslint funxions.js ERROR:
===========================================

'"node"' is not recognized as an internal or external command,
operable program or batch file.

first, install BOTH SublimeLinter and SublimeLinter-eslint packages through the package manager. If you don’t know where that is, then go here and get educated. >_>

from your Neard console (any of them will work), run npm install -g eslint for a global install.

BUT! to get it to work in your projects, you ALSO need a LOCAL copy. stupid, right? yep. stupid. but we want this crap to run, so we have to do the stupid thing. i thought we were supposed to be DRY programmers…?

anyway, back in the Neard console, cd to your project folder and run the following command do install ANOTHER copy of eslint: npm install --save-dev eslint

at this point, i would update your .gitignore file or you’ll have an ungodly mess of files added to your repo at your next commit…

now, in that project folder, make a file called .eslint.json and put the follwing inside:

{
  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "rules": {
    "semi": "error"
  }
}

now, in SublimeText 3, go to Preferences > SublimeLinter > Settings and paste the following:

SublimeLinter settings:

{
    "linters": {
    "eslint": {
      "env": {
        "PATH": "/c/neard/bin/nodejs/nodejs13.12.0/"
      },
      "args": ["--env=es6"]
    }
  }
}

save and close the file. next go to Preferences > ESlint > User Settings and paste again:

ESlint User settings:

{  
  "node_path": "c:\\neard\\bin\\nodejs\\nodejs13.12.0\\node.exe",
  // "node_path": "c:\neard\bin\\nodejs\nodejs13.12.0\node.exe",   <-- nope
  // "node_path": "c:/neard/bin/nodejs/nodejs13.12.0/node.exe",   <-- nope
}

now quit SublimeText and restart. your linter is now working.
REMEMBER: for EACH project, you will need to install all that extra eslint junk and an .eslintrc.json file in each project. why there can’t just be a global install that works everywhere… i don’t have time to find out. but this works and now we can get back TO work… :stuck_out_tongue:

0 Likes