-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to shut down watcher #7
Conversation
ESLint is included in eslint-config-fnd note, however, that Yarn doesn't install executables (`.bin/eslint`) for transitive dependencies
let watcher = niteOwl(…) … watcher.terminate(); this is primarily useful for tests, as otherwise the watcher being persistent will prevent the process from exiting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋
@@ -23,8 +23,7 @@ | |||
"chokidar": "^1.7.0" | |||
}, | |||
"devDependencies": { | |||
"eslint": "^4.4.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note, however, that Yarn doesn't install executables (
.bin/eslint
) for transitive dependencies
Doesn't this make this a bad idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frankly, I'm not too interested in adding (and thus maintaining) special casing for non-standard tooling - think Turbo. IMO both README and package.json
should just assume npm, as that's always available.
Of course anyone's free to use Yarn, Turbo or whatever, and I applaud their initiative. But if they do, they should be capable of figuring out how to fill the gaps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Ok 👍
@@ -41,7 +41,14 @@ module.exports = (rootDirs, delay = 50) => { | |||
} | |||
}); | |||
|
|||
return emitter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, this is a breaking change, because before that we exposed the entire emitter interface including once
, removeListener
etc. – but I guess that's not that important?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I didn't want the hassle of using Proxy
, but also didn't want to monkey-patch the emitter
instance - but you're right, it's potentially misleading.
Another option would be to be explicit(ly constrained) and only expose an object with nothing but #onEdit
, #onError
and #terminate
rather than a pseudo-emitter?
I suppose going Proxy
would be the Right Way™ though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, we should do it like you do it right now. If we notice that people need more parts of the interface of the emitter, then we can still add that later. I would however document the interface of the object we pass back to the user.
on(name, fn) { | ||
emitter.on(name, fn); | ||
}, | ||
terminate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I like it.
df89ff8