chore: use prettier instead of clang-format (#7014)

* chore: add and configure prettier

* chore: remove clang-format

* chore: remove clang-format config

* chore: lint additional ts files

* chore: fix lint errors in blocks

* chore: add prettier-ignore where needed

* chore: ignore js blocks when formatting

* chore: fix playground html syntax

* chore: fix yaml spacing from merge

* chore: convert text blocks to use arrow functions

* chore: format everything with prettier

* chore: fix lint unused imports in blocks
This commit is contained in:
Maribeth Bottorff
2023-05-10 16:01:39 -07:00
committed by GitHub
parent af991f5e1b
commit 88ff901a72
425 changed files with 29170 additions and 21169 deletions

View File

@@ -1,6 +1,7 @@
# Contributing to Blockly
Want to contribute? Great!
- First, read this page (including the small print at the end).
- Second, please make pull requests against develop, not master. If your patch
needs to go into master immediately, include a note in your PR.
@@ -8,6 +9,7 @@ Want to contribute? Great!
For more information on style guide and other details, head over to the [Blockly Developers site](https://developers.google.com/blockly/guides/modify/contributing).
### Before you contribute
Before we can use your code, you must sign the
[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual)
(CLA), which you can do online. The CLA is necessary mainly because you own the
@@ -19,22 +21,26 @@ the CLA until after you've submitted your code for review and a member has
approved it, but you must do it before we can put your code into our codebase.
### Larger changes
Before you start working on a larger contribution, you should get in touch with
us first through the issue tracker with your idea so that we can help out and
possibly guide you. Coordinating up front makes it much easier to avoid
frustration later on.
### Code reviews
All submissions, including submissions by project members, require review. We
use Github pull requests for this purpose.
### Browser compatibility
We care strongly about making Blockly work on all browsers. As of 2022 we
support Edge, Chrome, Safari, and Firefox. We will not accept changes that only
work on a subset of those browsers. You can check [caniuse.com](https://caniuse.com/)
We care strongly about making Blockly work on all browsers. As of 2022 we
support Edge, Chrome, Safari, and Firefox. We will not accept changes that only
work on a subset of those browsers. You can check [caniuse.com](https://caniuse.com/)
for compatibility information.
### The small print
Contributions made by corporations are covered by a different agreement than
the one above, the
[Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).

View File

@@ -30,7 +30,7 @@ body:
value: |
1.
2.
3.
3.
- type: textarea
id: stack-trace
attributes:

View File

@@ -1,4 +1,3 @@
name: Documentation
description: Report an issue with our documentation
labels: 'issue: docs, issue: triage'

View File

@@ -1,4 +1,3 @@
name: Feature request
description: Suggest an idea for this project
labels: 'issue: feature request, issue: triage'

View File

@@ -5,23 +5,23 @@
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
target-branch: "develop"
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/' # Location of package manifests
target-branch: 'develop'
schedule:
interval: "weekly"
interval: 'weekly'
commit-message:
prefix: "chore(deps)"
prefix: 'chore(deps)'
labels:
- "PR: chore"
- "PR: dependencies"
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/"
target-branch: "develop"
- 'PR: chore'
- 'PR: dependencies'
- package-ecosystem: 'github-actions' # See documentation for possible values
directory: '/'
target-branch: 'develop'
schedule:
interval: "weekly"
interval: 'weekly'
commit-message:
prefix: "chore(deps)"
prefix: 'chore(deps)'
labels:
- "PR: chore"
- "PR: dependencies"
- 'PR: chore'
- 'PR: dependencies'

14
.github/release.yml vendored
View File

@@ -4,7 +4,7 @@ changelog:
exclude:
labels:
- ignore-for-release
- "PR: chore"
- 'PR: chore'
authors:
- dependabot
categories:
@@ -16,17 +16,17 @@ changelog:
- deprecation
- title: New features ✨
labels:
- "PR: feature"
- 'PR: feature'
- title: Bug fixes 🐛
labels:
- "PR: fix"
- 'PR: fix'
- title: Cleanup ♻️
labels:
- "PR: docs"
- "PR: refactor"
- 'PR: docs'
- 'PR: refactor'
- title: Reverted changes ⎌
labels:
- "PR: revert"
- 'PR: revert'
- title: Other changes
labels:
- "*"
- '*'

View File

@@ -16,26 +16,26 @@ jobs:
requested-reviewer:
runs-on: ubuntu-latest
steps:
- name: Assign requested reviewer
uses: actions/github-script@v6
with:
script: |
try {
if (context.payload.pull_request === undefined) {
throw new Error("Can't get pull_request payload. " +
'Check a request reviewer event was triggered.');
- name: Assign requested reviewer
uses: actions/github-script@v6
with:
script: |
try {
if (context.payload.pull_request === undefined) {
throw new Error("Can't get pull_request payload. " +
'Check a request reviewer event was triggered.');
}
const reviewers = context.payload.pull_request.requested_reviewers;
// Assignees takes in a list of logins rather than the
// reviewer object.
const reviewerNames = reviewers.map(reviewer => reviewer.login);
const {number:issue_number} = context.payload.pull_request;
github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
assignees: reviewerNames
});
} catch (error) {
core.setFailed(error.message);
}
const reviewers = context.payload.pull_request.requested_reviewers;
// Assignees takes in a list of logins rather than the
// reviewer object.
const reviewerNames = reviewers.map(reviewer => reviewer.login);
const {number:issue_number} = context.payload.pull_request;
github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
assignees: reviewerNames
});
} catch (error) {
core.setFailed(error.message);
}

View File

@@ -23,65 +23,67 @@ jobs:
# https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Npm Install
run: npm install
- name: Npm Install
run: npm install
- name: Linux Test Setup
if: runner.os == 'Linux'
run: source ./tests/scripts/setup_linux_env.sh
- name: Linux Test Setup
if: runner.os == 'Linux'
run: source ./tests/scripts/setup_linux_env.sh
- name: MacOS Test Setup
if: runner.os == 'macOS'
run: source ./tests/scripts/setup_osx_env.sh
- name: MacOS Test Setup
if: runner.os == 'macOS'
run: source ./tests/scripts/setup_osx_env.sh
- name: Run
run: npm run test
- name: Run
run: npm run test
env:
CI: true
env:
CI: true
lint:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Npm Install
run: npm install
- name: Npm Install
run: npm install
- name: Lint
run: npm run lint
- name: Lint
run: npm run lint
clang-formatter:
format:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.16
with:
source: 'core'
extensions: 'js,ts'
# This should be as close as possible to the version that the npm
# package supports. This can be found by running:
# npx clang-format --version.
clangFormatVersion: 15
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Npm Install
run: npm install
- name: Check Format
run: npm run format:check

View File

@@ -10,7 +10,8 @@ jobs:
steps:
- uses: bcoe/conventional-release-labels@v1
with:
type_labels: '{"feat": "PR: feature", "fix": "PR: fix", "breaking": "breaking
type_labels:
'{"feat": "PR: feature", "fix": "PR: fix", "breaking": "breaking
change", "chore": "PR: chore", "docs": "PR: docs", "refactor": "PR:
refactor", "revert": "PR: revert", "deprecate": "deprecation"}'
ignored_types: '[]'

View File

@@ -23,4 +23,4 @@ jobs:
uses: github-actions-up-and-running/pr-comment@f1f8ab2bf00dce6880a369ce08758a60c61d6c0b
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
message: "Thanks for the PR! The develop branch is currently frozen in preparation for the release so it may not be addressed until after release week."
message: 'Thanks for the PR! The develop branch is currently frozen in preparation for the release so it may not be addressed until after release week.'

View File

@@ -12,7 +12,6 @@ on:
jobs:
tag-module-cleanup:
# Add the type: cleanup label
runs-on: ubuntu-latest
steps: