Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: format and lint files on PR approval

on:
pull_request_review:
types: [submitted]

jobs:
should_run_format:
runs-on: ubuntu-latest
if: github.event.review.state == 'approved'
outputs:
run_format: ${{ steps.check.outputs.run_format }}
steps:
- uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update actions/checkout to v4.

Both checkout actions use @v3, which is outdated. GitHub recommends using @v4 for better performance and Node.js 20 support.

Apply this diff:

     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
         with:
           ref: ${{ github.event.pull_request.head.ref }}
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
         with:
           ref: ${{ github.event.pull_request.head.ref }}
           fetch-depth: 0

Also applies to: 33-33

🧰 Tools
🪛 actionlint (1.7.8)

14-14: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
In .github/workflows/format.yml around lines 14 and 33, the workflow is
referencing actions/checkout@v3 which is outdated; update both occurrences to
actions/checkout@v4. Replace the uses entries on those lines to point to
actions/checkout@v4, save the file, and run or validate the workflow YAML (e.g.,
via GitHub Actions lint or a dry run) to ensure there are no syntax issues after
the change.

with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Check last commit author and message
id: check
run: |
LAST_AUTHOR=$(git log -1 --pretty=format:'%an')
LAST_MESSAGE=$(git log -1 --pretty=%B)
if [[ "$LAST_AUTHOR" =~ bot && "$LAST_MESSAGE" =~ "[skip ci]" ]]; then
echo "run_format=false" >> $GITHUB_OUTPUT
else
echo "run_format=true" >> $GITHUB_OUTPUT
fi

format_files:
runs-on: ubuntu-latest
needs: should_run_format
if: needs.should_run_format.outputs.run_format == 'true' && github.event.review.state == 'approved'
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

- name: Lint and Format files
run: |
TARGET_BRANCH=${{ github.event.pull_request.base.ref }}
npm ci --ignore-scripts=true
npx lint-staged --diff $(git merge-base origin/"$TARGET_BRANCH" HEAD) --allow-empty

- name: Setup git
run: |
git config --global user.email "actions@github.com"
git config --global user.name "github-actions[bot]"

- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add -u
if ( ! git diff-index --quiet --cached HEAD ); then
git commit -m "CI: format and lint files" -m "[skip ci]" --no-verify
git push --follow-tags --atomic --no-verify
fi
20 changes: 10 additions & 10 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
with:
app_id: ${{ vars.FUNDABOT_APP_ID }}
private_key: ${{ secrets.FUNDABOT_PRIVATE_KEY }}
- uses: actions/setup-node@v3

- uses: actions/setup-node@v5
with:
node-version: 16
node-version: 22
registry-url: https://registry.npmjs.org
- uses: actions/checkout@v3

- uses: actions/checkout@v5
with:
# pulls all commits and tags (needed for lerna to correctly version)
fetch-depth: 0
Expand All @@ -40,10 +40,10 @@ jobs:

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Run tests
run: npm run test

Expand All @@ -65,6 +65,9 @@ jobs:
echo "Published tag $TAG"
echo "TAG=$TAG" >> $GITHUB_ENV

- name: Push changes
run: git push --follow-tags --atomic --no-verify

- name: Release
if: ${{ github.ref_name == 'main'}}
env:
Expand All @@ -73,6 +76,3 @@ jobs:
if [ "${BRANCH}" != "main" ]; then PRERELEASE="-p"; fi
echo "Releasing version ${TAG} on branch ${BRANCH}"
gh release create ${TAG} --target ${BRANCH} --generate-notes ${PRERELEASE}

- name: Push changes
run: git push --follow-tags --atomic --no-verify
8 changes: 8 additions & 0 deletions .hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

test -f .git/hooks/pre-commit && .git/hooks/pre-commit

[[ ! -z $(git rev-parse -q --verify MERGE_HEAD) ]] && exit 0

# update same commit for lint changes
npx lint-staged || exit 1
5 changes: 5 additions & 0 deletions .hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

if test -f .git/hooks/pre-push; then
bash .git/hooks/pre-push
fi
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.prettierignore
.gitignore
.talismanrc
.hooks/**
**/.env.*
**/.env
**/csp.*
**/.firebaserc
**/*.ico
**/*.sh
24 changes: 24 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"printWidth": 180,
"quoteProps": "consistent",
"trailingComma": "none",
"arrowParens": "always",
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrderParserPlugins": ["typescript", "jsx", "decorators"],
"importOrder": [
"^react$|react-*",
"constants(.*)$",
"contexts(.*)$",
"api-client|openapi-client|oidc-client",
"^(./|~/|@/)(?!utils/|images/|styles/|types/)",
"<THIRD_PARTY_MODULES>",
"utils(.*)$",
"images(.*)$",
"styles(.*)$",
"types(.*)$"
],
"importOrderCaseInsensitive": true,
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderGroupNamespaceSpecifiers": true
}
76 changes: 76 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import reactPlugin from "eslint-plugin-react";

import eslint from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import jsdoc from "eslint-plugin-jsdoc";
import globals from "globals";

import typescriptParser from "@typescript-eslint/parser";
import tseslint from "typescript-eslint";

export default [
{
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parser: typescriptParser,
...reactPlugin.configs.flat.recommended.languageOptions,
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
globals: {
...globals.browser
}
}
},
eslint.configs.recommended,
...tseslint.configs.recommended,
eslintConfigPrettier,
reactPlugin.configs.flat.recommended,
reactPlugin.configs.flat["jsx-runtime"],
{
rules: {
"no-eval": "error",
"no-useless-escape": "error",
// "no-use-before-define": ["warn", { functions: false, classes: true, variables: true }],
"block-scoped-var": "error",
"no-alert": "error",
"no-script-url": "error",
"no-var": "error",
"prefer-const": "error",
"array-callback-return": ["error", { checkForEach: true }],
"no-extra-boolean-cast": "off",
"react/jsx-key": "off",
"prefer-template": "warn",
"no-self-compare": "warn",
"no-duplicate-imports": "warn",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
"eqeqeq": "warn",
"max-depth": ["warn", 3],
"no-inline-comments": "warn",
"no-multi-assign": "warn",
"require-await": "warn"
}
},
{
files: ["**/*.js", "**/*.ts", "**/*.tsx"],
plugins: {
jsdoc
},
rules: {
"jsdoc/require-jsdoc": [
"off",
{
enableFixer: false,
require: {
FunctionDeclaration: true,
MethodDefinition: true
}
}
]
}
}
];
7 changes: 2 additions & 5 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"packages": [
"packages/*"
],
"useWorkspaces": true,
"version": "2.3.3",
"packages": ["packages/*"],
"version": "2.3.4-linting.1",
"command": {
"version": {
"message": "chore(release): publish %s \n [skip ci]"
Expand Down
Loading