26 Commits

Author SHA1 Message Date
Shazib Hussain
7165a2159d Lint tweaks (#1223) 2023-06-30 10:20:18 -04:00
Jed Fox
1733179bfb Remove redundant UUID wrapper module, update uuid package to 9.x (#1216)
I noticed that:

- The web and electron versions of our `uuid` module both looked exactly
the same…
- …and deferred to the `uuid` package…
- …and the async version just called the sync API.

So now we will just use the `uuid` package directly everywhere.
2023-06-28 12:24:24 -04:00
Jed Fox
aa503d6a74 Consistently use ExternalLink (#1184)
This cleans up all of the usage of `<a>` in the codebase. Now all
external links get the appropriate attributes added.
2023-06-27 08:46:38 -04:00
Jed Fox
ed50e2b392 Run ESLint at the top level once (#1202)
This significantly speeds up `yarn lint` for me. It also ensures we’re
listing all source files in the project, including the `.eslintrc` files
and any other files that may be present.
2023-06-26 15:32:56 -04:00
Shazib Hussain
228cff3cfd New linter rule import/no-unused-modules & fixing import on typescript (#1173)
- New linter rules are now added
- Perhaps the `createPayee` method i've tagged with a disable should be
deleted.
- I have ignored unused methods in Plaid/Mobile as this stuff is still
WIP/experimental?
2023-06-24 11:58:40 -04:00
Jed Fox
02f1fe48c6 Stop mixing platform-specific code (#1114)
Bundle sizes are unchanged but now we no longer pull in the
Electron-specific FS code on the web version
2023-06-09 16:06:18 -04:00
Jed Fox
e660e1e727 More import-related ESLint rules (#1070)
- Enforce that imports from the same package are merged into a single
import
- In `loot-core`, require that imports of other `loot-core` files use a
relative import (like the vast majority of such imports) rather than
specifiers starting with `loot-core/` (probably a result of moving files
out of other packages into `loot-core`)
2023-05-29 13:31:01 -04:00
Jed Fox
ad89aea45c Integrate useMemo into useLiveQuery (#1064) 2023-05-28 07:38:37 -04:00
Alberto Gasparin
f618055aab Migrate top common components to TS (#979) 2023-05-09 20:31:22 +10:00
Jed Fox
54fa4bccf6 Enable 'curly' rule (#1015)
Multi-line `if`/`for` statements in JS can be confusing since there
aren’t braces to indicate which code is enclosed in the statement. I set
the configuration to `multi-line` to enforce usage of braces for
multi-line statement bodies, but still allow things like `if (foo)
return;`. I additionally added the `consistent` option to require braces
for all elements of an if/else chain if one element has it. As you can
see, this set of options pretty closely matches the existing code style.

I was going to comment in #1008 about this stylistic change but realized
that it’s (IMO) a little impolite to ask for code style changes unless
they can be automatically enforced.

Note that `if (foo) { \n return; \n }` is still valid and won’t be
collapsed. I tried to automatically collapse all such cases but it was a
lot of files and I didn’t want to pick out the useful from the useless
differences.
2023-05-08 22:54:17 -04:00
Trevor Farlow
bd14b51e1c @typescript-eslint/no-unused-vars (#974)
Switch to TS version of `no-unused-vars` rule.
2023-04-30 17:20:55 -06:00
Jed Fox
944c7ff30f Improve sidebar auto-floating behavior (#868)
I got some feedback in the discord that this behavior was disruptive
when zooming in.

- I’ve reduced the breakpoint so hopefully the disruption of the
transition is matched by a significant improvement in available space
now.
- Also the 2 places in the app that use window width (including here)
now check for the width of the `<html>` tag, not the width of the
viewport (those 2 values can be different when doing a pinch-zoom,
causing undesirable layout shifts.)
- Most of the logic has been rewritten to improve the transitions

Mobile & desktop experience

https://user-images.githubusercontent.com/25517624/233653721-b13c5e22-ae11-4bdf-a494-a6916556d05e.mov

https://user-images.githubusercontent.com/25517624/233654784-b6cc1006-44ea-4066-be7a-8d0dd786fb5b.mov

(I’d like tapping on something to close the sidebar on mobile, but that
can be approached in a future PR)
2023-04-21 17:48:47 -04:00
Alberto Gasparin
5dec98e754 Migrate core to TS p2 (#889)
Another batch of files from `loot-core` migrated to TS (loose mode)
2023-04-12 11:09:42 -04:00
Alberto Gasparin
79ad04dd88 Convert loot-core to TS p1 (#841)
Part 1 of the conversion. Mostly renaming js to ts and making sure
things make still sense. Added also handy TS ESLint rules.

In order to support the various .web/.electron/... I ended up adopting
`index.d.ts` as pattern to share type definition. Let me know if that
makes sense for you too. Right now the function type definition is
duplicated, but the solution will be importing from `index.d.ts` and
using `const fn: FnDef = () => ...` that way we can keep all variants in
sync from a single type file.

Such rewrite however is better done in another PR otherwise we risk
confusing git and loosing history (rename + too many changes). Another
thing that might do in the next PR is convert all files to ESModules, as
things get confusing between CJS exports, ESM default/named and TS adds
extra complains.
2023-04-03 10:29:59 -04:00
Jed Fox
3cb18683c6 nit: use curly apostrophes throughout the UI (#791) 2023-03-21 13:48:31 -04:00
Jed Fox
49eda0f4a0 Enable most of the disabled ESLint rules (#720) 2023-03-05 09:23:12 -05:00
Matiss Janis Aboltins
28b5124dd8 🚨 re-enable react-hooks/rules-of-hooks eslint rule (#715) 2023-03-02 17:03:11 +00:00
Matiss Janis Aboltins
18eae3ebf6 🏗️ moving back to create-react-app (#697) 2023-02-28 08:50:49 +00:00
Matiss Janis Aboltins
093dbeb8a6 ⬆️ upgrade eslint-plugin-import and fix issues (#492)
* ⬆️  upgrade eslint-plugin-import and fix issues

* Change import ordering
2023-01-25 18:50:11 +00:00
Matiss Janis Aboltins
b0e2511603 🚨 enabling no-unused-vars eslint rule (#469)
* 🚨  enabling no-unused-vars eslint rule

* fix more lint issues
2023-01-18 22:14:37 +00:00
Matiss Janis Aboltins
e4cd389510 fix: re-disable no-unused-vars eslint rule 2023-01-02 19:47:36 +00:00
Matiss Janis Aboltins
d2b210088f chore: fix eslint issues and make warnings CI blocking 2022-12-30 18:46:57 +00:00
Tom French
9c0df36e16 Sort import in alphabetical order (#238)
* style: enforce sorting of imports

* style: alphabetize imports

* style: merge duplicated imports
2022-09-02 15:07:24 +01:00
Tom French
dc53a74459 Separate external, monorepo and internal imports (#237)
* style: enforce ordering of imports

* style: sort imports in loot-core

* style: sort imports in desktop-client

* style: sort imports in loot-design

* style: manual fixes
2022-09-02 12:43:37 +01:00
Tom French
1d0b2721db style: prettify .eslintrc.js 2022-08-25 16:36:02 +01:00
Tom French
a44834c0d3 style: enforce prettier rules in linter 2022-07-24 08:53:04 +01:00