-
Notifications
You must be signed in to change notification settings - Fork 13
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
General Jest padding rule #44
Conversation
Working on CI |
Haha... I mean I'm working on fixing CI. |
Sorry if I'm spamming CircleCI failures. There's something strange going on. If I SSH into the CircleCI box with "Rebuild job with SSH" I'm able to run |
Nope, just needed to link it |
50031ec
to
1551598
Compare
A glorious green check mark. That's why we're programmers, amirite? For the check marks. |
c22c364
to
901b364
Compare
Ok, @dangreenisrael. I think this PR is feature complete now. I'll clean up the commit message and add comments on the code on Monday. There are a few items that I'll call your attention to in particular... just to make sure they're not missed in review since they're minor changes. And all green on CI and I've run it against my own web app with good results. |
@benkimpel Starting the CR now. Thanks so much for doing this, and for your patience with my delayed code reviews. |
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.
Everything looks really great. I'm excited for this to land.
Regarding all the request for types: I generally consider all of them as nice to haves. I only recently converted the project to typescript and a lot of the existing stuff didn't have types to begin with so I would be quite a hypocrite to insist that all of your (awesome) stuff is fully typed. That said, if you could add them that would be awesome, but if you don't want for some of them - feel free to just note that in the comments and mark the comments as resolved |
Once this is all ready to go, one of us can update the main README |
@dangreenisrael Great feedback. I'm on it (starting tomorrow). Good thinking on the README... I totally forgot. Type requests are fine by me! |
All right. I think I'll have a final commit tomorrow for last bit of clean up and type info. Exciting. I'll re-request a review when ready. |
Ready for another look @dangreenisrael! |
"tommorow"... heh. 4-days-ago-Ben so optimistic... so naive. Anyway, if this gets the thumbs up I'll squash and merge (if that's your preferred workflow) and make a nice commit message. Or you can! LMK. |
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.
If you wouldn't mind, it would be great to break this up into a few meaningful commits with descriptions of what is happening in the commit messages.
That said, I only have one comment and then this thing is good to go!
8d0618c
to
17187f1
Compare
The goal here is to use the code currently under development to lint/format itself. Using the local path `file:.` in `package.json` is a little clunky in some scenarios. As I understand it npm and yarn handle local paths a little differently. Latest npm symlinks the path, while yarn copies it. Copying isn't ideal for development because you'll need to re-install for each build to use your changes. Clunkiness aside, though, it still seems like the appropriate way to at least declare a dev dependency on the local state. The nicer solution for letting us use the current plugin against itself during development is to link it to itself. `yarn link` uses a symlink so any changes we're making during development (code changes, builds, formatting, etc) are also what we're running against the package itself. Linking will replace the copied package from local path in `node_modules` with a symlink.
This padding rule is based on eslint/padding-line-between-statements. `src/rules/padding.ts` reconfigures the eslint rule to look for Jest tokens and add padding lines. There are several bits of functionality that were not needed from the original and they have been removed. The file is also converted to TypeScript to match this project's preferred language.
Introduces a `makeRule` function to take a set of padding configs, copy the generic rule, configure it with the padding configs, and return it as a new rule. `makeRule` is now used in `src/index.ts` to generate the rules from a config instead of defining rules in their own modules and importing them. Minor doc and spec changes, as well.
Add rules - afterAll - afterEach - beforeAll - beforeEach - expect Update README.md
17187f1
to
aaf6d29
Compare
All right, @dangreenisrael. Squished down to 5 solid commits with good explanations. Merge whenever you're ready. Removed the version bump in |
@benkimpel LGTM! Would you like the honours of hitting the big green button? *Merge commit please - those are some nice commit messages!!! |
The code in
rules/padding.ts
is based on the ESLint rulepadding-line-between-statement
. It's been altered to look for Jesttokens in expressions.
afterAll
,afterEach
,beforeAll
,beforeEach
,describe
,expect
,it/test
, and all tokens together.Additional changes
package.json
dev dependency for this package to itself and set up linking.gitignore
to makelib
absolute. (It was ignoring my new tests intest/lib
.)