🔧 improving typechecker and lint local performance (#4710)

This commit is contained in:
Matiss Janis Aboltins
2025-04-06 14:47:49 +01:00
committed by GitHub
parent 26ee3179e1
commit c4b4108eca
20 changed files with 99 additions and 101 deletions

View File

@@ -1,14 +1,11 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "Actual development",
"dockerComposeFile": [
"../docker-compose.yml",
"docker-compose.yml"
],
// Alternatively:
// "image": "mcr.microsoft.com/devcontainers/typescript-node:0-16",
"service": "actual-development",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"postCreateCommand": "yarn install"
"name": "Actual development",
"dockerComposeFile": ["../docker-compose.yml", "docker-compose.yml"],
// Alternatively:
// "image": "mcr.microsoft.com/devcontainers/typescript-node:0-16",
"service": "actual-development",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"postCreateCommand": "yarn install"
}

3
.gitignore vendored
View File

@@ -56,3 +56,6 @@ package.tgz
# Fly.io configuration
fly.toml
# TypeScript cache
build/

View File

@@ -1 +1,30 @@
sync_pb.*
packages/api/app/bundle.api.js
packages/api/app/stats.json
packages/api/dist
packages/api/@types
packages/api/migrations
packages/crdt/dist
packages/component-library/src/icons/**/*
packages/desktop-client/bundle.browser.js
packages/desktop-client/build/
packages/desktop-client/locale/
packages/desktop-client/build-electron/
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/test-results/
packages/desktop-client/playwright-report/
packages/desktop-electron/client-build/
packages/desktop-electron/build/
packages/desktop-electron/dist/
packages/import-ynab4/**/node_modules/*
packages/import-ynab5/**/node_modules/*
packages/loot-core/**/node_modules/*
packages/loot-core/**/lib-dist/*
packages/loot-core/**/proto/*
.yarn/*
.github/*
upcoming-release-notes/*

View File

@@ -66,7 +66,7 @@ To add new feature requests, open a new Issue of the "Feature Request" type.
### Translation
Make Actual Budget accessible to more people by helping with the [Internationalization](https://actualbudget.org/docs/contributing/i18n/) of Actual. We are using a crowd sourcing tool to manage the translations, see our [Weblate Project](https://hosted.weblate.org/projects/actualbudget/). Weblate proudly supports open-source software projects through their [Libre plan](https://weblate.org/en/hosting/#libre).
Make Actual Budget accessible to more people by helping with the [Internationalization](https://actualbudget.org/docs/contributing/i18n/) of Actual. We are using a crowd sourcing tool to manage the translations, see our [Weblate Project](https://hosted.weblate.org/projects/actualbudget/). Weblate proudly supports open-source software projects through their [Libre plan](https://weblate.org/en/hosting/#libre).
<a href="https://hosted.weblate.org/engage/actualbudget/">
<img src="https://hosted.weblate.org/widget/actualbudget/actual/287x66-grey.png" alt="Translation status" />

View File

@@ -15,4 +15,3 @@ services:
volumes:
- '.:/app'
restart: 'no'

View File

@@ -5,7 +5,6 @@ import globals from 'globals';
import pluginImport from 'eslint-plugin-import';
import pluginJSXA11y from 'eslint-plugin-jsx-a11y';
import pluginPrettier from 'eslint-plugin-prettier/recommended';
import pluginReact from 'eslint-plugin-react';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import pluginRulesDir from 'eslint-plugin-rulesdir';
@@ -90,6 +89,7 @@ export default [
{
ignores: [
'packages/api/app/bundle.api.js',
'packages/api/app/stats.json',
'packages/api/dist',
'packages/api/@types',
'packages/api/migrations',
@@ -145,7 +145,6 @@ export default [
},
pluginReact.configs.flat.recommended,
pluginReact.configs.flat['jsx-runtime'],
pluginPrettier,
...pluginTypescript.configs.recommended,
pluginImport.flatConfigs.recommended,
{
@@ -529,7 +528,7 @@ export default [
sourceType: 'module',
parserOptions: {
project: [path.join(__dirname, './tsconfig.json')],
projectService: true,
ecmaFeatures: {
jsx: true,
},
@@ -549,6 +548,13 @@ export default [
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
'no-undef': 'off',
// TypeScript already handles these (https://typescript-eslint.io/troubleshooting/typed-linting/performance/#eslint-plugin-import)
'import/named': 'off',
'import/namespace': 'off',
'import/default': 'off',
'import/no-named-as-default-member': 'off',
'import/no-unresolved': 'off',
// Add TypeScript specific rules (and turn off ESLint equivalents)
'@typescript-eslint/consistent-type-assertions': 'warn',
'no-array-constructor': 'off',

View File

@@ -45,10 +45,10 @@
"vrt:docker": "./bin/run-vrt",
"rebuild-electron": "./node_modules/.bin/electron-rebuild -f -m ./packages/loot-core",
"rebuild-node": "yarn workspace loot-core rebuild",
"lint": "eslint . --max-warnings 0",
"lint:verbose": "DEBUG=eslint:cli-engine eslint . --max-warnings 0",
"lint": "prettier --check . && eslint . --max-warnings 0",
"lint:fix": "prettier --check --write . && eslint . --max-warnings 0 --fix",
"install:server": "yarn workspaces focus @actual-app/sync-server --production",
"typecheck": "yarn tsc && tsc-strict",
"typecheck": "yarn tsc --incremental && tsc-strict",
"jq": "./node_modules/node-jq/bin/jq",
"prepare": "husky"
},
@@ -61,7 +61,6 @@
"eslint-import-resolver-typescript": "^4.2.2",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "5.2.3",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-rulesdir": "^0.2.2",
@@ -85,7 +84,7 @@
"node": ">=18.0.0"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,md,json}": "prettier --write"
"*.{js,jsx,ts,tsx,md,json,yml}": "prettier --write"
},
"packageManager": "yarn@4.7.0",
"browserslist": [

View File

@@ -39,6 +39,7 @@ HTTPS=true yarn start
```
or using the dev container:
```
HTTPS=true docker compose up --build
```
@@ -82,6 +83,7 @@ E2E_START_URL=https://ip:port yarn vrt
You can also run the tests against a remote server by passing the URL:
Run in standardized docker container:
```sh
E2E_START_URL=https://my-remote-server.com yarn vrt:docker
@@ -90,6 +92,7 @@ E2E_START_URL=https://my-remote-server.com yarn vrt:docker
```
Run locally:
```sh
E2E_START_URL=https://my-remote-server.com yarn vrt
```

View File

@@ -20,7 +20,7 @@ const processTranslations = () => {
console.log(`en.json has ${enKeysCount} keys.`);
files.forEach((file) => {
files.forEach(file => {
if (file === 'en.json' || path.extname(file) !== '.json') return;
if (file.startsWith('en-')) {
@@ -34,7 +34,9 @@ const processTranslations = () => {
// Calculate the percentage of keys present compared to en.json
const percentage = (fileKeysCount / enKeysCount) * 100;
console.log(`${file} has ${fileKeysCount} keys (${percentage.toFixed(2)}%).`);
console.log(
`${file} has ${fileKeysCount} keys (${percentage.toFixed(2)}%).`,
);
if (percentage < 50) {
fs.unlinkSync(filePath);

View File

@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-unresolved
import { type CSSObject } from '@emotion/css/dist/declarations/src/create-instance';
// Allow images to be imported

View File

@@ -3,4 +3,4 @@
);
@include variable.default;
@import "@fontsource/redacted-script";
@import '@fontsource/redacted-script';

View File

@@ -1,5 +1,3 @@
{
plugins: [
'babel-plugin-transform-es2015-modules-commonjs'
]
"plugins": ["babel-plugin-transform-es2015-modules-commonjs"]
}

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<body>
<style type="text/css">
@@ -12,7 +12,5 @@
color: #909090;
}
</style>
<div>
Waiting for development server...
</div>
<div>Waiting for development server...</div>
</body>

View File

@@ -1 +1,6 @@
{"id":"Default-Test-Db","budgetName":"Default Test Db","budgetVersion":"0.0.1","isCached":true}
{
"id": "Default-Test-Db",
"budgetName": "Default Test Db",
"budgetVersion": "0.0.1",
"isCached": true
}

View File

@@ -1,11 +1,10 @@
import { Backup } from '../server/backups';
import { RemoteFile } from '../server/cloud-storage';
import { Message } from '../server/sync';
import { QueryState } from '../shared/query';
import { Budget } from './budget';
import { OpenIdConfig } from './models/openid';
// eslint-disable-next-line import/no-unresolved
import { Query } from './query';
import { EmptyObject } from './util';
export interface ServerHandlers {
@@ -20,7 +19,7 @@ export interface ServerHandlers {
}) => Promise<{ filters: unknown[] }>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
query: (query: Query) => Promise<{ data: any; dependencies: string[] }>;
query: (query: QueryState) => Promise<{ data: any; dependencies: string[] }>;
'key-make': (arg: {
password;

View File

@@ -1,12 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"declaration": true,
"emitDeclarationOnly": true,
"allowJs": false,
"noEmit": false,
},
"include": ["./typings", "./src/server/*"],
"exclude": ["**/node_modules/*", "**/build/*", "**/lib-dist/*", "./src/server/bench.ts"],
}
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"declaration": true,
"emitDeclarationOnly": true,
"allowJs": false,
"noEmit": false
},
"include": ["./typings", "./src/server/*"],
"exclude": [
"**/node_modules/*",
"**/build/*",
"**/lib-dist/*",
"./src/server/bench.ts"
]
}

View File

@@ -164,13 +164,16 @@ If the default bank integration does not work for you, you can integrate a new b
7. Remember to add tests for new bank integration in
## normalizeTransaction
This is the most commonly used override as it allows you to change the data that is returned to the client.
Please follow the following patterns when implementing a custom normalizeTransaction method:
1. If you need to edit the values of transaction fields (excluding the transaction amount) do not mutate the original transaction object. Instead, create a shallow copy and make your changes there.
2. End the function by returning the result of calling the fallback normalizeTransaction method from integration-bank.js
E.g.
```js
import Fallback from './integration-bank.js';

View File

@@ -42,6 +42,7 @@
},
"include": ["packages/**/*", "bin/*.ts"],
"exclude": [
"**/.*/",
"node_modules",
"**/node_modules/*",
"**/build/*",

View File

@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MatissJanis]
---
improving typechecker and lint local performance

View File

@@ -3075,13 +3075,6 @@ __metadata:
languageName: node
linkType: hard
"@pkgr/core@npm:^0.1.0":
version: 0.1.1
resolution: "@pkgr/core@npm:0.1.1"
checksum: 10/6f25fd2e3008f259c77207ac9915b02f1628420403b2630c92a07ff963129238c9262afc9e84344c7a23b5cc1f3965e2cd17e3798219f5fd78a63d144d3cceba
languageName: node
linkType: hard
"@playwright/test@npm:1.41.2":
version: 1.41.2
resolution: "@playwright/test@npm:1.41.2"
@@ -7081,7 +7074,6 @@ __metadata:
eslint-import-resolver-typescript: "npm:^4.2.2"
eslint-plugin-import: "npm:^2.31.0"
eslint-plugin-jsx-a11y: "npm:^6.10.2"
eslint-plugin-prettier: "npm:5.2.3"
eslint-plugin-react: "npm:^7.37.4"
eslint-plugin-react-hooks: "npm:^5.2.0"
eslint-plugin-rulesdir: "npm:^0.2.2"
@@ -10950,26 +10942,6 @@ __metadata:
languageName: node
linkType: hard
"eslint-plugin-prettier@npm:5.2.3":
version: 5.2.3
resolution: "eslint-plugin-prettier@npm:5.2.3"
dependencies:
prettier-linter-helpers: "npm:^1.0.0"
synckit: "npm:^0.9.1"
peerDependencies:
"@types/eslint": ">=8.0.0"
eslint: ">=8.0.0"
eslint-config-prettier: "*"
prettier: ">=3.0.0"
peerDependenciesMeta:
"@types/eslint":
optional: true
eslint-config-prettier:
optional: true
checksum: 10/6444a0b89f3e2a6b38adce69761133f8539487d797f1655b3fa24f93a398be132c4f68f87041a14740b79202368d5782aa1dffd2bd7a3ea659f263d6796acf15
languageName: node
linkType: hard
"eslint-plugin-react-hooks@npm:^5.2.0":
version: 5.2.0
resolution: "eslint-plugin-react-hooks@npm:5.2.0"
@@ -11499,13 +11471,6 @@ __metadata:
languageName: node
linkType: hard
"fast-diff@npm:^1.1.2":
version: 1.2.0
resolution: "fast-diff@npm:1.2.0"
checksum: 10/f62419b3d770f201d51c3ee8c4443b752b3ba2d548a6639026b7e09a08203ed2699a8d1fe21efcb8c5186135002d5d2916c12a687cac63785626456a92915adc
languageName: node
linkType: hard
"fast-equals@npm:^4.0.3":
version: 4.0.3
resolution: "fast-equals@npm:4.0.3"
@@ -17394,15 +17359,6 @@ __metadata:
languageName: node
linkType: hard
"prettier-linter-helpers@npm:^1.0.0":
version: 1.0.0
resolution: "prettier-linter-helpers@npm:1.0.0"
dependencies:
fast-diff: "npm:^1.1.2"
checksum: 10/00ce8011cf6430158d27f9c92cfea0a7699405633f7f1d4a45f07e21bf78e99895911cbcdc3853db3a824201a7c745bd49bfea8abd5fb9883e765a90f74f8392
languageName: node
linkType: hard
"prettier@npm:^2.8.7":
version: 2.8.8
resolution: "prettier@npm:2.8.8"
@@ -20190,16 +20146,6 @@ __metadata:
languageName: node
linkType: hard
"synckit@npm:^0.9.1":
version: 0.9.1
resolution: "synckit@npm:0.9.1"
dependencies:
"@pkgr/core": "npm:^0.1.0"
tslib: "npm:^2.6.2"
checksum: 10/bff3903976baf8b699b5483228116d70223781a93b17c70e685c277ee960cdfd1a09cb5a741e6a9ec35e2428f14f4664baec41ccc99a598f267608b2a54f529b
languageName: node
linkType: hard
"tapable@npm:^2.1.1, tapable@npm:^2.2.0":
version: 2.2.1
resolution: "tapable@npm:2.2.1"
@@ -20716,7 +20662,7 @@ __metadata:
languageName: node
linkType: hard
"tslib@npm:^2.0.3, tslib@npm:^2.3.0, tslib@npm:^2.4.0, tslib@npm:^2.6.2":
"tslib@npm:^2.0.3, tslib@npm:^2.3.0, tslib@npm:^2.4.0":
version: 2.6.2
resolution: "tslib@npm:2.6.2"
checksum: 10/bd26c22d36736513980091a1e356378e8b662ded04204453d353a7f34a4c21ed0afc59b5f90719d4ba756e581a162ecbf93118dc9c6be5acf70aa309188166ca