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

Introduce action to lint new pull requests #193

Open
wants to merge 25 commits into
base: trunk
Choose a base branch
from

Conversation

ryanwelcher
Copy link
Contributor

@ryanwelcher ryanwelcher commented Mar 9, 2022

This PR is a first step towards updating the CI processes on this repo. It does the following:

  1. Updates learna.json to include all the examples
  2. Changes the existing action to be run on pull request and run linting commands for JS, CSS and package.json files
  3. Updates the code base where required to pass linting.

@ryanwelcher ryanwelcher requested a review from gziolo March 9, 2022 17:11
@ryanwelcher ryanwelcher requested a review from mkaz March 9, 2022 18:10
@ryanwelcher ryanwelcher mentioned this pull request Mar 9, 2022
5 tasks
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
Copy link
Member

@gziolo gziolo Mar 10, 2022

Choose a reason for hiding this comment

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

It has v3 now 😄
https://github.com/actions/checkout

We still use v2 in Gutenberg for some reason.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

Should we add .npmrc to every block that prevents creating package-lock.files?

Example:
https://github.com/WordPress/gutenberg/blob/trunk/packages/a11y/.npmrc

package-lock=false

Otherwise we add 100k lines of code that doesn't bring any value.

"@wordpress/scripts": "^18.0.1"
},
"scripts": {
"build": "wp-scripts build",
"format:js": "wp-scripts format-js",
"lint:js": "wp-scripts lint-js",
"lint:style": "",
Copy link
Member

Choose a reason for hiding this comment

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

Why is it empty? Should it be removed if there is nothing to lint?

"08-block-supports-esnext",
"09-code-data-basics-esnext",
"format-api"
"format-api",
"meta-block"
Copy link
Member

Choose a reason for hiding this comment

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

Something went wrong with spacing here.

"@wordpress/block-editor": "^7.0.2",
"@wordpress/blocks": "^11.1.0",
"@wordpress/i18n": "^4.2.2",
"@wordpress/block-editor": "^7.0.4",
Copy link
Member

Choose a reason for hiding this comment

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

I think everything but @wordpress/scripts should be regular dependencies. At least this is the case for other blocks.

Well, it's debatable because we externalize them so in practice only dev tools need them 😅

@gziolo
Copy link
Member

gziolo commented Mar 10, 2022

Overall, I love the direction. Does it mean we won't run checks on commits to the main branch anymore?

@ryanwelcher
Copy link
Contributor Author

ryanwelcher commented Mar 10, 2022

Does it mean we won't run checks on commits to the main branch anymore?

I'm open to discussing this for sure. My feeling is that if everything has to be an approved PR before it gets to trunk we may not need it, but I guess it also can't hurt. Does anyone have access to push directly to trunk?

Is there a case I'm not considering?

@gziolo
Copy link
Member

gziolo commented Mar 10, 2022

Is there a case I'm not considering?

There is one that is nearly impossible to happen here because of a low frequency of commits. In Gutenberg, we had many situations where you would open PR with all check green, then before merging it some other commits would introduce changes that combined with changes in the branch would cause issues. However, you won't catch those cases until you rebase the branch before merging or it will pop up once you merge PR into the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants