feat: warn on banned syntax when @silvermine/toolbox is installed#133
feat: warn on banned syntax when @silvermine/toolbox is installed#133
Conversation
partials/toolbox-rules.js
Outdated
|
|
||
| const hasSilvermineToolbox = (() => { | ||
| try { | ||
| require.resolve('@silvermine/toolbox'); |
There was a problem hiding this comment.
I love the idea of this but I think the reality is a bit tricky.
This will resolve even if @silvermine/toolbox is not a direct dependency of the project being linted; it'll resolve if it's just anywhere in the dependency tree, right? if so, the projects that don't directly use @silvermine/toolbox would also start seeing these warnings, which seems to be against the intention of this check.
Unfortunately, the only way I can think of to check whether it is a direct dependency is to somehow find the root project's package.json and check. Probably not a good option.
Instead of this automated check, should we just enable these by default and leave it up to the project to disable them if they really don't intend to use @silvermine/toolbox?
yokuze
left a comment
There was a problem hiding this comment.
Looks alright overall. Just the one question.
Adds a local inline ESLint plugin that warns consumers to prefer toolbox helpers over native JS patterns.
5c1fca9 to
83a079f
Compare
Adds a local inline ESLint plugin that warns consumers to prefer toolbox helpers over native JS patterns. Rules are only active when @silvermine/toolbox is resolvable in the consuming project.