SublimeLinter-eslint
SublimeLinter-eslint copied to clipboard
Where should eslint_d be installed?
I end up with frequent little niggly issues with my linter configuration, and I think part of it is overriding the executable setting. So I'd like to know how do I get eslint_d working with the global install setting. I'm wondering if I can get some advice? I currently get the following output:
ERROR:SublimeLinter.plugin.eslint:/home/ian/.local/share/pnpm/eslint_d: 2: sed: not found
/home/ian/.local/share/pnpm/eslint_d: 2: dirname: not found
/home/ian/.local/share/pnpm/eslint_d: 1: uname: not found
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '/global/5/node_modules/eslint_d/bin/eslint_d.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
SublimeLinter: #2121 linter.py:1221 eslint: no output
INFO:SublimeLinter.plugin.eslint:eslint: no output
SublimeLinter: sublime_linter.py:598 Linting 'configureStore.js' took 0.15s
INFO:SublimeLinter.sublime_linter:Linting 'configureStore.js' took 0.15s
If I check the location of eslint_d I get:
which eslint_d
/home/ian/.local/share/pnpm/eslint_d
I used to have an executable path of /home/ian/.nvm/versions/node/v16.14.0/bin/eslint_d which gave me a reasonable success, but obviously then the package detection features don't work :(
The stack trace reads a lot like the one on their page https://pnpm.io/installation#troubleshooting
The first question is usually: does it work on the command line? If so, the environment (ENV) is different from the one when you start Sublime Text.
Also: it totally looks like SublimeLinter finds your eslint_d but it can't execute it. Usually that means the code and the interpreter do not match. ( eslint_d is not a binary and probably not a shim pointing to the correct node binary.) Generally speaking nvm has the old standing problem that it is designed as a command line tool. It changes the ENV in your terminal (typically using subshells). (nvm is not a good solution to the problem space.)
So yeah, it does seem to work fine for the command line. This tests it both from the root of the project, and the package itself, just to check for any differences.
webclient on feat/scale-37/redux [!⇡] via v16.14.0
❯ eslint_d apps/main/src/views/solutions/pages/occupancy/Occupancy.tsx && cd apps/main && eslint_d src/views/solutions/pages/occupancy/Occupancy.tsx && cd .. && cd ..
/home/ian/src/webclient/apps/main/src/views/solutions/pages/occupancy/Occupancy.tsx
1:1 warning There should be no empty line within import group import/order
✖ 1 problem (0 errors, 1 warning)
0 errors and 1 warning potentially fixable with the `--fix` option.
/home/ian/src/webclient/apps/main/src/views/solutions/pages/occupancy/Occupancy.tsx
1:1 warning There should be no empty line within import group import/order
✖ 1 problem (0 errors, 1 warning)
0 errors and 1 warning potentially fixable with the `--fix` option.
I've also tried calling it with the full path to /home/ian/.local/share/pnpm/eslint_d to check whether it's working and not somehow picking up my other eslint_d (I have one installed in /home/ian/.nvm/versions/node/v16.14.0/bin/eslint_d which does work in SublimeLinter if I set it as the executable).
Ok, I think I've managed to get things working. I've uninstalled the eslint_d installed by pnpm, and it looks like also removing the executable section is working.
That being said, I can't know for sure whether it's just using eslint rather than eslint_d.
Ugh, I take that back. I think I needed to restart Sublime :(