-
Notifications
You must be signed in to change notification settings - Fork 583
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: add betterer #8045
feat: add betterer #8045
Conversation
@@ -3,4 +3,3 @@ | |||
|
|||
|
|||
yarn lint-staged | |||
yarn secrets:check:staged |
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.
moved to lint-staged
@@ -3,3 +3,4 @@ | |||
|
|||
|
|||
yarn type-check | |||
yarn betterer:all |
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.
one final check
@@ -0,0 +1,9 @@ | |||
export default { |
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.
extracted this into a config file
@@ -0,0 +1,7 @@ | |||
module.exports = { |
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.
extracted this into a config file
(i tried .mjs with export default
but of course prettier being a bad tool doesn't support that)
@@ -1,6 +1,10 @@ | |||
{ | |||
// See http://go.microsoft.com/fwlink/?LinkId=827846 | |||
// for the documentation about the extensions.json format | |||
"recommendations": ["Orta.vscode-ios-common-files", "Orta.vscode-danger", "artsy.artsy-studio-extension-pack", "meta.relay"], | |||
"recommendations": [ |
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.
random linting
}) | ||
|
||
it("does not the author when they add WebPs", () => { | ||
useWebPs(["image1.webp", "image2.webp", "image3.webp"]) |
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.
this is now a betterer rule
const testOnlyFilter = (filename: string) => filename.includes(".tests") && typescriptOnly(filename) | ||
|
||
/** | ||
* Danger Rules |
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.
all these are now betterer rules
@@ -7,7 +7,7 @@ | |||
"node": "16.x", | |||
"yarn": "1.x" | |||
}, | |||
"main": "index.ios.js", | |||
"main": "index-common.js", |
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.
random thing, but we didnt update that in a while
@@ -17,8 +17,6 @@ import { | |||
tracks, | |||
} from "./CreateSavedSearchModal" | |||
|
|||
jest.unmock("react-relay") |
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.
that was a test for one of the betterer rules
@@ -0,0 +1,2720 @@ | |||
// BETTERER RESULTS V2. |
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.
this file is like the .secrets.baseline
file. it holds all the results, and makes sure things get.. better-er.
const typescriptTestFiles = ["./src/**/*.tests.ts", "./src/**/*.tests.tsx"] | ||
const imageExtensionsToAvoid = ["png", "jpg", "jpeg"] | ||
|
||
export default { |
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.
look at all these nice rules :)
|
||
"Avoid using class components!": () => | ||
regexp(/extends (React\.)?Component/).include(typescriptFiles), | ||
} |
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.
❇️
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.
Looks great @pvinis - mind updating the PR with an image showing the output? Also, can you add a hyperlink to betterer in the line item in the description so readers don't have to fish.
"singleQuote": false, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true | ||
}, |
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.
tyty
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.
🔥 🔥 🔥 🔥
added links and screenshots |
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.
👌👌👌👌👌👌 So much betterer
everything addressed 👍 thanks all for reviewing! ill merge and see how we do with it :) |
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.
✨ 🔥 ❤️
This PR resolves []
Description
try it out for yourself, with
yarn betterer:all
! then try removing ajest.unmock("react-relay")
or add an extra one, to see how this tool says yay and nay.no changes
removing bad things
adding bad things (notice the tip at the end, to rerun
yarn betterer:all --update
in order to allow it to pass that check, in case we really need to add that one extra bad thing. its kinda like detect-secrets in that way, or jest snapshots.)PR Checklist
To the reviewers 👀
Changelog updates
Changelog updates
Cross-platform user-facing changes
iOS user-facing changes
Android user-facing changes
Dev changes
Need help with something? Have a look at our docs, or get in touch with us.