Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: add eslint rule restrict-template-expressions #2325

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thisconnect
Copy link
Collaborator

So that we do not accidentally pass undefined, null, booleans or just any type in tempalte literals, see:

`all these should error ${false} ${undefined} ${[]} ${null}`

This is a eslint rule, so only make weblint will check.

So that we do not accidentally pass undefined, null, booleans or
just any type in tempalte literals, see:

    `all these should error ${false} ${undefined} ${[]} ${null}`

This is a eslint rule, so only make weblint will check.
@thisconnect thisconnect marked this pull request as draft October 31, 2023 10:49
@thisconnect
Copy link
Collaborator Author

15 problems 🎉

> npm run typescript && eslint --ext .jsx,.js,.ts,.tsx ./src


> [email protected] typescript
> tsc -p tsconfig.json


/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/api/subscribe.ts
  45:33  error  Invalid type "TEvent" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/components/forms/select.tsx
  44:21  error  Invalid type "string | number | readonly string[] | undefined" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/components/icon/logo.tsx
  70:258  error  Invalid type "any" of template literal expression  @typescript-eslint/restrict-template-expressions
  71:261  error  Invalid type "any" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/i18n/i18n.test.tsx
  42:34  error  Invalid type "string | null" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/routes/account/info/buyReceiveCTA.tsx
  48:25  error  Invalid type "string | undefined" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/routes/account/info/info.tsx
  83:57  error  Invalid type "ScriptType | undefined" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/routes/account/send/send.tsx
  372:95  error  Invalid type "string | true" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/routes/device/bitbox01/restore.tsx
  101:57  error  Invalid type "any" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/routes/device/bitbox01/settings/components/mobile-pairing.tsx
  205:58  error  Invalid type "string | boolean" of template literal expression  @typescript-eslint/restrict-template-expressions
  211:60  error  Invalid type "boolean" of template literal expression           @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/routes/device/bitbox01/setup/initialize.tsx
  110:35  error  Invalid type "string | null" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/routes/device/bitbox01/setup/security-information.tsx
  66:96  error  Invalid type "string | null" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/routes/device/bitbox02/passphrase.tsx
  88:42  error  Invalid type "number | undefined" of template literal expression  @typescript-eslint/restrict-template-expressions

/opt/go/src/github.com/digitalbitbox/bitbox-wallet-app/frontends/web/src/routes/settings/components/device-settings/attestation-check-setting.tsx
  47:64  error  Invalid type "boolean" of template literal expression  @typescript-eslint/restrict-template-expressions

✖ 15 problems (15 errors, 0 warnings)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant