-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(eslint): restructuring + vitest support + docs and mocha deprecation #723
Conversation
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0", | ||
"lodash.merge": "^4.6.2" |
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.
also dying at the fact that these are right next to each other
@@ -1,9 +1,10 @@ | |||
const fs = require('fs'); |
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.
Oh damn so wait are tests ESM 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.
Yeah though vitest ships a CJS file for tests that use only require()
it's actually empty1 so if you do const { it, expect } = require('vitest')
you'll get a "it is not a function" error because the export from vitest
that's being loaded there is just an empty object.
Kinda annoying but cool that all of these tests can use import
without any TS or Babel configs.
Footnotes
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.
Gotcha! I prefer this pattern of importing these rather than the mysterious jest global shit
@@ -9,7 +9,7 @@ | |||
}, | |||
"scripts": { | |||
"lint": "eslint .", | |||
"test": "NODE_OPTIONS=--experimental-vm-modules jest" | |||
"test": "vitest run" |
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.
Hell yeah
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.
yayyyy eat shit meta
This alone makes me sold on Vitest, which I've never used before but looks pretty amazing 😍 |
🧰 Changes
I've been immediately impressed with Vitest that I want to move as much of our libraries off Jest and over to it. This starts that process by adding a new ESLint standards config for it with eslint-plugin-vitest.
@readme/eslint-config/testing
into four different configs:@readme/eslint-config/testing/jest-dom
- These configs were a part of our stock@readme/eslint-config/testing
but as most projects we've got don't use jest-dom it doesn't make sense to include it in the base config.@readme/eslint-config/testing/jest
@readme/eslint-config/testing/react
@readme/eslint-config/testing/vitest
@readme/eslint-config/testing-mocha
. We only use Mocha, and this config, in two of our open source packages but I plan on moving them over to Vitest whenever I get a chance.@readme/eslint-config/docs
. We only used this inoas
and I had most rules from it disabled there as it's very annoying and doesn't really fit in a TS codebase, which that is.spectral-config
andstylelint-config
from using Jest to run their tests to using Vitest. Doing this allows us to remove the experimental flag from Node as Vitest supports ESM projects by default. Vitest kinda slaps??