-
Notifications
You must be signed in to change notification settings - Fork 64
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
ESLint plugin 🦨 #2044
base: main
Are you sure you want to change the base?
ESLint plugin 🦨 #2044
Conversation
🦋 Changeset detectedLatest commit: 7f081fd The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Change: -52 B (0%) Total Size: 1.38 MB
ℹ️ View Unchanged
|
'plugin:storybook/recommended', | ||
'prettier', |
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.
should we add a basic rule inside of our plugin that we can turn on in this PR?
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.
Not that wouldn't result in a bunch of lint errors...
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'd have to write a rule that we 100% follow right now
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.
Enabled "no-indirect-imports"
, which we have to follow otherwise rollup won't build
import { isTestFile } from '../utils/isTestFile'; | ||
import { RuleContext } from '../utils/RuleContext'; | ||
|
||
const VERBS = ['is', 'are', 'has', 'should', 'did', 'does', 'will', 'use']; |
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.
do we want to include show
or hide
?
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, following the strict pattern this establishes, you'd want to write shouldShow
, willHide
, or isShown
etc. That said, I'm not super stuck the technicalities, and we can add whatever verbs we want here
728d4c4
to
ba80868
Compare
✍️ Proposed changes
Creates a new package
@lg-tools/eslint-plugin
This enables us to create custom ESLint rules for both internal & external use.
(There was not a whole lot of online documentation around how to do this with the Typescript syntax tree, so I wrote this post: https://medium.com/@thesonofthomp/writing-a-custom-eslint-plugin-with-typescript-08d0e01726d2)