Skip to content
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

Merged
merged 15 commits into from
Jan 25, 2023
Merged

feat: add betterer #8045

merged 15 commits into from
Jan 25, 2023

Conversation

pvinis
Copy link
Contributor

@pvinis pvinis commented Jan 25, 2023

This PR resolves []

Description

try it out for yourself, with yarn betterer:all! then try removing a jest.unmock("react-relay") or add an extra one, to see how this tool says yay and nay.

no changes
Screenshot 2023-01-25 at 10 42 18

removing bad things
Screenshot 2023-01-25 at 10 42 42

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.)
Screenshot 2023-01-25 at 10 42 55

PR Checklist

  • I tested my changes on iOS / Android.
  • I added screenshots or videos to illustrate my changes.
  • I added Tests and Stories for my changes.
  • I added an app state migration.
  • I hid my changes behind a feature flag.
  • I have prefixed changes that need to be tested during a release QA with [NEEDS EXTERNAL QA] on the changelog.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
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.

@pvinis pvinis self-assigned this Jan 25, 2023
@@ -3,4 +3,3 @@


yarn lint-staged
yarn secrets:check:staged
Copy link
Contributor Author

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
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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 = {
Copy link
Contributor Author

@pvinis pvinis Jan 25, 2023

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": [
Copy link
Contributor Author

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"])
Copy link
Contributor Author

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
Copy link
Contributor Author

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",
Copy link
Contributor Author

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")
Copy link
Contributor Author

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.
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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 :)

@pvinis pvinis requested review from gkartalis, MrSltun and a team January 25, 2023 02:07

"Avoid using class components!": () =>
regexp(/extends (React\.)?Component/).include(typescriptFiles),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❇️

.gitignore Outdated Show resolved Hide resolved
Copy link
Member

@damassi damassi left a 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.

package.json Outdated Show resolved Hide resolved
"singleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tyty

Copy link
Member

@gkartalis gkartalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 🔥 🔥 🔥

.betterer.ts Outdated Show resolved Hide resolved
.circleci/config.yml Show resolved Hide resolved
@pvinis
Copy link
Contributor Author

pvinis commented Jan 25, 2023

added links and screenshots

gkartalis
gkartalis previously approved these changes Jan 25, 2023
Copy link
Member

@gkartalis gkartalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌👌👌👌👌👌 So much betterer

@pvinis
Copy link
Contributor Author

pvinis commented Jan 25, 2023

everything addressed 👍 thanks all for reviewing! ill merge and see how we do with it :)

@pvinis pvinis added Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green and removed Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green labels Jan 25, 2023
@pvinis pvinis added the Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green label Jan 25, 2023
Copy link
Member

@MrSltun MrSltun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ 🔥 ❤️

@artsy-peril artsy-peril bot merged commit bbf03aa into main Jan 25, 2023
@artsy-peril artsy-peril bot deleted the pvinis/betterer branch January 25, 2023 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants