Skip to content

Commit

Permalink
Merge branch 'master' into split-transactions-autofill
Browse files Browse the repository at this point in the history
  • Loading branch information
Shazib authored Oct 5, 2023
2 parents fd55daa + de90504 commit a3fb0f2
Show file tree
Hide file tree
Showing 493 changed files with 20,138 additions and 11,823 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ packages/crdt/dist

packages/desktop-client/bundle.browser.js
packages/desktop-client/build/
packages/desktop-client/build-stats/
packages/desktop-client/public/kcab/
packages/desktop-client/public/data/
packages/desktop-client/**/node_modules/*
packages/desktop-client/node_modules/
packages/desktop-client/src/icons/**/*
packages/desktop-client/test-results/

packages/desktop-electron/client-build/
packages/desktop-electron/dist/
Expand Down
72 changes: 51 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,61 +25,79 @@ const restrictedImportPatterns = [
},
];

const restrictedImportColors = [
{
group: ['**/style', '**/colors'],
importNames: ['colors'],
message: 'Please use themes instead of colors',
},
];

module.exports = {
plugins: ['prettier', 'import', 'rulesdir', '@typescript-eslint'],
extends: ['react-app', 'plugin:@typescript-eslint/recommended'],
extends: [
'react-app',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: { project: [path.join(__dirname, './tsconfig.json')] },
reportUnusedDisableDirectives: true,
rules: {
'prettier/prettier': 'error',
'prettier/prettier': 'warn',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
'warn',
{
args: 'none',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],

curly: ['error', 'multi-line', 'consistent'],
curly: ['warn', 'multi-line', 'consistent'],

'no-restricted-globals': ['error'].concat(
'no-restricted-globals': ['warn'].concat(
require('confusing-browser-globals').filter(g => g !== 'self'),
),

'react/jsx-no-useless-fragment': 'error',
'react/self-closing-comp': 'error',
'react/jsx-no-useless-fragment': 'warn',
'react/self-closing-comp': 'warn',

'rulesdir/typography': 'error',
'rulesdir/prefer-if-statement': 'error',
'rulesdir/typography': 'warn',
'rulesdir/prefer-if-statement': 'warn',

// https://github.com/eslint/eslint/issues/16954
// https://github.com/eslint/eslint/issues/16953
'no-loop-func': 'off',

// Do don't need this as we're using TypeScript
'react/prop-types': 'off',

// TODO: re-enable these rules
'react-hooks/exhaustive-deps': 'off',
'react/no-children-prop': 'off',
'react/display-name': 'off',
'react/react-in-jsx-scope': 'off',
// 'react-hooks/exhaustive-deps': [
// 'error',
// 'warn',
// {
// additionalHooks: 'useLiveQuery',
// },
// ],

'import/extensions': [
'error',
'warn',
'never',
{
json: 'always',
},
],
'import/no-useless-path-segments': 'error',
'import/no-duplicates': ['error', { 'prefer-inline': true }],
'import/no-unused-modules': ['error', { unusedExports: true }],
'import/no-useless-path-segments': 'warn',
'import/no-duplicates': ['warn', { 'prefer-inline': true }],
'import/no-unused-modules': ['warn', { unusedExports: true }],
'import/order': [
'error',
'warn',
{
alphabetize: {
caseInsensitive: true,
Expand Down Expand Up @@ -108,7 +126,7 @@ module.exports = {
],

'no-restricted-syntax': [
'error',
'warn',
{
// forbid React.* as they are legacy https://twitter.com/dan_abramov/status/1308739731551858689
selector:
Expand All @@ -123,7 +141,10 @@ module.exports = {
'Using <a> is discouraged, please use <LinkButton> or <ExternalLink> instead.',
},
],
'no-restricted-imports': ['error', { patterns: restrictedImportPatterns }],
'no-restricted-imports': [
'warn',
{ patterns: [...restrictedImportPatterns, ...restrictedImportColors] },
],

// Rules disable during TS migration
'@typescript-eslint/no-var-requires': 'off',
Expand All @@ -146,14 +167,14 @@ module.exports = {
],
rules: {
// enforce type over interface
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/consistent-type-definitions': ['warn', 'type'],
// enforce import type
'@typescript-eslint/consistent-type-imports': [
'error',
'warn',
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
],
'@typescript-eslint/ban-types': [
'error',
'warn',
{
types: {
// forbid FC as superflous
Expand All @@ -169,7 +190,7 @@ module.exports = {
files: ['./packages/loot-core/src/**/*'],
rules: {
'no-restricted-imports': [
'error',
'warn',
{
patterns: [
...restrictedImportPatterns,
Expand All @@ -194,6 +215,15 @@ module.exports = {
],
rules: { 'import/no-unused-modules': 'off' },
},
{
files: [
'./packages/desktop-client/src/style/index.*',
'./packages/desktop-client/src/style/palette.*',
],
rules: {
'no-restricted-imports': ['off', { patterns: restrictedImportColors }],
},
},
],
settings: {
'import/parsers': {
Expand Down
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Funding policies: https://actualbudget.org/docs/contributing/leadership/funding
open_collective: actual
6 changes: 3 additions & 3 deletions .github/actions/netlify-wait-for-build
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ function get_status() {
curl --header "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/actualbudget/actual/commits/$COMMIT_SHA/statuses" > /tmp/status.json
cat /tmp/status.json
echo "::endgroup::"
netlify=$(jq '[.[] | select(.context == "netlify/actualbudget/deploy-preview")][0]' /tmp/status.json)
state=$(jq -r '.state' <<< "$netlify")
netlify=$(yarn jq '[.[] | select(.context == "netlify/actualbudget/deploy-preview")][0]' /tmp/status.json)
state=$(yarn jq -r '.state' <<< "$netlify")
echo "::group::Netlify Status"
echo "$netlify"
echo "::endgroup::"
Expand All @@ -32,7 +32,7 @@ done

if [ "$state" == "success" ]; then
echo -e "\033[0;32mNetlify build succeeded!\033[0m"
jq -r '"url=" + .target_url' <<< "$netlify" > $GITHUB_OUTPUT
yarn jq -r '"url=" + .target_url' <<< "$netlify" > $GITHUB_OUTPUT
exit 0
else
echo -e "\033[0;31mNetlify build failed. Cancelling end-to-end tests.\033[0m"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
api:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
lint:
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '19'
- name: Check migrations
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
analyze:
Expand Down
41 changes: 36 additions & 5 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,56 @@ concurrency:
cancel-in-progress: true

jobs:
test:
name: Run end-to-end tests on Netlify PR preview
netlify:
name: Wait for Netlify build to finish
runs-on: ubuntu-latest
outputs:
netlify_url: ${{ steps.netlify.outputs.url }}
steps:
- uses: actions/checkout@v3
- name: Set up environment
uses: ./.github/actions/setup
- name: Setup Playwright
run: npx playwright install chromium --with-deps
- name: Wait for Netlify build to finish
id: netlify
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/actions/netlify-wait-for-build

functional:
name: Functional
needs: netlify
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.37.0-jammy
steps:
- uses: actions/checkout@v3
- name: Set up environment
uses: ./.github/actions/setup
- name: Run E2E Tests on Netlify URL
run: yarn e2e
env:
E2E_START_URL: ${{ steps.netlify.outputs.url }}
E2E_START_URL: ${{ needs.netlify.outputs.netlify_url }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: desktop-client-test-results
path: packages/desktop-client/test-results/
retention-days: 30
vrt:
name: Visual regression
needs: netlify
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.37.0-jammy
steps:
- uses: actions/checkout@v3
- name: Set up environment
uses: ./.github/actions/setup
- name: Run VRT Tests on Netlify URL
run: yarn vrt
env:
E2E_START_URL: ${{ needs.netlify.outputs.netlify_url }}
- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/electron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issues-feature-implemented.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
# This is not a security concern because we have approved & merged the PR
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '19'
- name: Handle feature requests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/size-compare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ jobs:
run: |
sed -i -E 's/\.[0-9a-f]{8,}\././g' ./head/*.json
sed -i -E 's/\.[0-9a-f]{8,}\././g' ./base/*.json
- uses: github/[email protected].1
- uses: github/[email protected].2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
current-stats-json-path: ./head/desktop-client-stats.json
base-stats-json-path: ./base/desktop-client-stats.json
title: desktop-client

- uses: github/[email protected].1
- uses: github/[email protected].2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
current-stats-json-path: ./head/loot-core-stats.json
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Close stale PRs'
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
with:
stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
close-pr-message: 'This PR was closed because it has been stalled for 5 days with no activity.'
days-before-stale: 30
days-before-close: 5
days-before-issue-stale: -1
2 changes: 0 additions & 2 deletions bin/package-electron
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ if [ "$OSTYPE" == "msys" ]; then
fi
fi

yarn patch-package

yarn rebuild-electron

yarn workspace loot-core build:node
Expand Down
Binary file modified demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a3fb0f2

Please sign in to comment.