Closed brettz9 closed 2 years ago
For some reason, GitHub isn't letting me fake a fork now to offer a PR, but FWIW, I've resolved the problem thus:
In /lib/worker.js
of your project, I added on line 178:
process.chdir(resolveDir);
I don't know if this could create any side effects for Atom but seems to be working ok.
It's also ok if I set the following on line 334 before the getESLint
call:
let oldCwd = process.cwd();
and then reset it back after the linting calls, e.g., line 398:
process.chdir(oldCwd);
I do get this error one time on start up, but apparently unrelated:
Failed to load plugin 'import' declared in '../.eslintrc': Cannot find module 'eslint-plugin-import' Require stack:
/Users/brett/.atom/packages/linter-eslint-node/placeholder.js
Sorry, it appears that only appears with the /lib/worker.js
file open. My own regular files work fine though with my process.cwd
injection.
If you want to create a PR with your fix I would be happy to review it 😁👍
:tada: This issue has been resolved in version 1.0.4 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Hi,
Very excited to have this tool available. Thanks so much!
Issue Type
Question
Issue Description
I don't know if you'd consider this a bug, but wondering if you might know how to resolve, being more familiar with the Atom environment.
In my linting config (
eslint-config-ash-nazg
), I dynamically detect theecmaVersion
andenv
for my.eslintrc.cjs
based on the minimum version of thenode
subfield ofpackage.json
engines
so as to avoid the need for manually setting them.With this code, I was using
process.cwd()
(process.cwd()
helps the code work from the command line) to try to find the project root (and thenpackage.json
within that), but the base path it returns is/
. I then tried the following:But the path is apparently not being found (same result if I remove the optional chaining operators). This code, even with the atom-specific code, appears to still be returning
/
.Any idea if it is possible for me to detect (or for you to set any properties I can detect) the root directory of the current file's project?
I am using pnpm, which can theoretically change path discovery, but I wouldn't think that would affect Atom's discovery.
Thanks!
Bug Checklist
eslint
CLI gives the proper result, whilelinter-eslint-node
does notLinter Eslint Node: Debug
command from the Command Palette below