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

Disable the Non-null Assertion Operator with Linting #7

Closed
0x4007 opened this issue Jul 10, 2023 · 15 comments
Closed

Disable the Non-null Assertion Operator with Linting #7

0x4007 opened this issue Jul 10, 2023 · 15 comments

Comments

@0x4007
Copy link
Member

0x4007 commented Jul 10, 2023

There's a lot of abuse in our codebases with contributors using "!"

Example:

let element: HTMLElement | null = document.getElementById('test');

// This would throw a TypeScript error without the "!" because element could be null
let value: string = element!.innerText;

Enforce that this can not pass our linters.

@b4s36t4
Copy link

b4s36t4 commented Jul 10, 2023

@pavlovcik Rule should be enabled in this repo only right? https://github.com/ubiquity/ubiquibot

@ubiquibot
Copy link

ubiquibot bot commented Jul 10, 2023

Available commands

- /assign: Assign the origin sender to the issue automatically.
- /unassign: Unassign the origin sender from the issue automatically.
- /help: List all available commands.
- /payout: Disable automatic payment for the issue.
- /multiplier: Set bounty multiplier (for treasury)
- /allow: Set access control. (Admin Only)
- /wallet: <WALLET_ADDRESS | ENS_NAME>: Register the hunter's wallet address. 
  ex1: /wallet 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 
  ex2: /wallet vitalik.eth

@b4s36t4

@0x4007
Copy link
Member Author

0x4007 commented Jul 10, 2023

In this template. We have to manually fix every issue based on the linter settings set up here.

@b4s36t4
Copy link

b4s36t4 commented Jul 10, 2023

@0x4007
Copy link
Member Author

0x4007 commented Jul 11, 2023

I was cleaning a handful of them yesterday in pay.ubq.fi repository so I'm not sure.

Either way, they shouldn't be used in almost every example that I've come across.

Yes we should disable in our linter.

@baibhavKumar1
Copy link

@pavlovcik , we can disable this in the linter, but what's alternate for "!" in codebase in your opinion? Should we change it with "?" mark?

@ubiquibot
Copy link

ubiquibot bot commented Aug 24, 2023

Available commands

- /start: Assign the origin sender to the issue automatically.
- /stop: Unassign the origin sender from the issue automatically.
- /help: List all available commands.
- /autopay: Toggle automatic payment for the completion of the current issue.
- /query: Comments the users multiplier and address
- /multiplier: Set the bounty payout multiplier for a specific contributor, and provide the reason for why. 
  example usage: "/wallet @user 0.5 'Multiplier reason'"
- /allow: Set access control. (Admin Only)
- /wallet: <WALLET_ADDRESS | ENS_NAME>: Register the hunter's wallet address. 
  ex1: /wallet 0x0000000000000000000000000000000000000000
  ex2: /wallet vitalik.eth

@Wholesomebruh

@0x4007
Copy link
Member Author

0x4007 commented Aug 24, 2023

@pavlovcik , we can disable this in the linter, but what's alternate for "!" in codebase in your opinion? Should we change it with "?" mark?

Correct typings. Just never use any.

It's straightforward if you know typings. Just more work with certain complex objects.

@3scava1i3r
Copy link

@pavlovcik , we can disable this in the linter, but what's alternate for "!" in codebase in your opinion? Should we change it with "?" mark?

Correct typings. Just never use any.

It's straightforward if you know typings. Just more work with certain complex objects.

In this template or every repo by ubiquity?

@ubiquibot
Copy link

ubiquibot bot commented Sep 22, 2023

Available commands

- /start: Assign the origin sender to the issue automatically.
- /stop: Unassign the origin sender from the issue automatically.
- /help: List all available commands.
- /autopay: Toggle automatic payment for the completion of the current issue.
- /query: Comments the users multiplier and address
- /ask: Ask a technical question to the Ubiquity AI. 
  example usage: "/ask How do I do X?"
- /multiplier: Set the bounty payout multiplier for a specific contributor, and provide the reason for why. 
  example usage: "/wallet @user 0.5 'Multiplier reason'"
- /allow: Set access control. (Admin Only)
- /wallet: <WALLET_ADDRESS | ENS_NAME>: Register the hunter's wallet address. 
  ex1: /wallet 0x0000000000000000000000000000000000000000
  ex2: /wallet vitalik.eth

@3scava1i3r

@0x4007
Copy link
Member Author

0x4007 commented Sep 23, 2023

@pavlovcik , we can disable this in the linter, but what's alternate for "!" in codebase in your opinion? Should we change it with "?" mark?

Correct typings. Just never use any.

It's straightforward if you know typings. Just more work with certain complex objects.

In this template or every repo by ubiquity?

Both!

Copy link

ubiquibot bot commented Jan 23, 2024

+ Evaluating results. Please wait...

@wannacfuture wannacfuture reopened this Jan 23, 2024
@ubiquity ubiquity deleted a comment from ubiquibot bot Jan 23, 2024
@0x4007 0x4007 reopened this Jan 23, 2024
@0x4007 0x4007 closed this as completed Jan 23, 2024
Copy link

ubiquibot bot commented Jan 23, 2024

+ Evaluating results. Please wait...

Copy link

ubiquibot bot commented Jan 23, 2024

@pavlovcik the deadline is at 2024-01-23T10:27:00.632Z

Copy link

ubiquibot bot commented Jan 23, 2024

! action has an uncaught error

ariesgun added a commit to ariesgun/work.ubq.fi that referenced this issue Oct 13, 2024
* feat: initial commit

* feat: add TS support

* feat: add conventional commits

* feat: add dotenv

* docs: add readme

* feat: add pull request template

* Create cloudflare-deploy

* feat: create helloWorld index.html

* feat: push action for development branch

* feat: update readme

* Update cloudflare-deploy.yml

* fix: rename pull_request_template

* Update conventional-commits.yml

Use our version which supports GitHub UI updates.

* chore: update dependencies and prettier

* chore: update package json

* Update conventional-commits.yml

* Update cloudflare-deploy.yml

Had to fix because `.nvmrc` is not compatible 

```
error telegram-ubiquibot@1.0.0: The engine "node" is incompatible with this module. Expected version ">=v20.3.0". Got "18.14.1"
```

* Update cloudflare-deploy.yml

* feat: format on lint-staged

* fix: commit-msg script and add lint-staged command

* feat: prefer named functions

* feat: add naming conventions rule

* feat: easy ui support

* feat: easy ui support

* fix: prettier for css

* chore: add .env file to .gitignore

* fix: lint staged

* fix: lint staged

* chore: remove tabs

ubiquity-os/ubiquity-os-kernel#2 (comment)

* feat: reusable deploy script

* feat: ban non null assertions

resolves ubiquity/ts-template#7

* Update README.md

* feat: spell check on commit

* feat: copy typescript rules

https://github.com/krzkaczor/TypeStrict.git
thanks @krzkaczor

* chore: remove no unnecessary condition for false positives

* fix: forgot to include cspell

* fix: cspell ci

* fix(ci): cspell

* chore: remove deprecated

* feat(cspell): support colors

* fix(ci): cspell

* feat: production deploys

related ubiquity/pay.ubq.fi#153

* chore: set up build for cd

* chore(deps): upgrade all

* chore: test on another brnach

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* feat: workflow dispatch

* Merge branch 'test/cd'

* chore: debug cd

* chore: debug cd

* chore: debug cd

* chore: debug cd

* feat: add knip CI configuration

Resolves: ubiquity/ts-template#12

* feat: commit or pr

* feat: workflow dispatch

* chore: test env vars

* Squashed commit of the following:

commit 1dcef50
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 06:52:34 2024 +0900

    chore: test env vars

commit 126e819
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 06:51:03 2024 +0900

    feat: workflow dispatch

commit dbec9e3
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 06:39:04 2024 +0900

    feat: commit or pr

commit d61f01e
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 04:18:18 2024 +0900

    chore: debug cd

commit 9a8fc77
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 04:07:39 2024 +0900

    chore: debug cd

commit ea72c5e
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 04:06:43 2024 +0900

    chore: debug cd

commit de20331
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 04:01:17 2024 +0900

    chore: debug cd

commit dc336a9
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 03:46:41 2024 +0900

    feat: workflow dispatch

commit 0002fec
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 03:41:18 2024 +0900

    chore: bump ci

commit 56a8cf8
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 03:34:16 2024 +0900

    chore: bump ci

commit ad2564c
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 03:33:38 2024 +0900

    chore: bump ci

commit 3ad759b
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 03:20:33 2024 +0900

    chore: bump ci

commit 8b25785
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 01:46:52 2024 +0900

    chore: bump ci

commit d117e10
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Mon Feb 19 23:33:58 2024 +0900

    chore: bump ci

commit d3b5d08
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Mon Feb 19 21:46:37 2024 +0900

    chore: test on another brnach

* fix: whitespace

* fix: transport secrets

* fix: app installation if

* feat: new github env style

* chore: update Knip yaml actions

As suggested during pull request review.

* chore: update supabase key name

ref: ubiquity/pay.ubq.fi#164 (comment)

* fix(ci): on prs

* fix: change dist to static

untested but in a rush and i think this is correct

* Update esbuild-server.ts

* fix: gitignore

* fix: commit sha

* feat: default Jest testing configuration

* Update .github/workflows/jest-testing.yml

* chore: moved jest config from js to ts

* chore: removed unused check to trigger Jest Action

* feat: cypress testing suite

* feat: default Jest testing configuration (ubiquity#19)

* feat: default Jest testing configuration

* Update .github/workflows/jest-testing.yml

* chore: moved jest config from js to ts

* chore: removed unused check to trigger Jest Action

---------

Co-authored-by: アレクサンダー.eth <4975670+pavlovcik@users.noreply.github.com>

* chore: updated yarn.lock

* chore: removed checks for warn messages in the console

* fix: disabled comments on every push, and added default value for coverage

* chore: moved knip configuration

* chore: workflow dispatch for knip

* chore: workflow dispatch for knip

* chore: changed action target to pull_request_target

* chore: added test section to README.md

* ci(cspell): fix

* Create CODEOWNERS

Congratulations on the promotion @FernandVEYRIER

* chore: added missing dep

* chore: added ignore rules to knip

* chore: removed ts-node dep and changed jest config

* chore: added ternary rules for eslint

* chore: fixed trailing space in conf

* ci: add init workflow

* feat: release please Action

* chore: changed release to target default branch

* chore: changed release to target default branch

* chore: added permissions to release please

* chore: removed npm env variable

* Update release-please.yml

* Update CODEOWNERS

* ci: pass cloudflare credentials

* ci: add reusable cloudflare deploy

* ci: use single action

* ci: update deploy.yml

* chore: add pascal case linter to enforce Erc20Permit and Erc721Permit naming conventions

* chore: enable StrictPascalCase on all Identifiers

* chore: undo unnecessary changes

* chore: add eslint-filename plugin

* revert camelCase deletions and change to strictCamelCase

* fix: use regex and ignore e2e.ts

* chore: eslint config type inference

* chore: update knip configuration in the template to run on pull_request

* fix: moved eslint from js to json and accept numbers in file names

* fix: workflow release please

* fix: workflow cypress

* chore: test reporting lib

* chore: test reporting lib

* chore: test reporting lib

* chore: test reporting lib

* Update jest-testing.yml

* chore: find PR number

* chore: remove event

* chore: test pr number

* chore: test pr number

* chore: test pr number

* chore: test comment

* chore: test comment

* chore: revert default branch for release-please.yml

* chore: revert default branch for release-please.yml

* fix: fixed conflicts

---------

Co-authored-by: rndquu <rndquu@gmail.com>
Co-authored-by: アレクサンダー.eth <gpg@pavlovcik.com>
Co-authored-by: 0xCodercrane <108444211+0xcodercrane@users.noreply.github.com>
Co-authored-by: アレクサンダー.eth <4975670+pavlovcik@users.noreply.github.com>
Co-authored-by: rndquu <119500907+rndquu@users.noreply.github.com>
Co-authored-by: Korrrba <gitcoiner@gmail.com>
Co-authored-by: Fernando <fernand.veyrier@epitech.eu>
Co-authored-by: Fernand <FernandVEYRIER@users.noreply.github.com>
Co-authored-by: jordan-ae <arreyetta1jnr@gmail.com>
Co-authored-by: jordan-ae <arreyetta1jrn@gmail.com>
Co-authored-by: Keyrxng <106303466+Keyrxng@users.noreply.github.com>
Co-authored-by: アレクサンダー.eth <4975670+0x4007@users.noreply.github.com>
Co-authored-by: Mentlegen <9807008+gentlementlegen@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Aries Gunawan <aries.thio@hotmail.com>
ariesgun added a commit to ariesgun/work.ubq.fi that referenced this issue Oct 13, 2024
* feat: initial commit

* feat: add TS support

* feat: add conventional commits

* feat: add dotenv

* docs: add readme

* feat: add pull request template

* Create cloudflare-deploy

* feat: create helloWorld index.html

* feat: push action for development branch

* feat: update readme

* Update cloudflare-deploy.yml

* fix: rename pull_request_template

* Update conventional-commits.yml

Use our version which supports GitHub UI updates.

* chore: update dependencies and prettier

* chore: update package json

* Update conventional-commits.yml

* Update cloudflare-deploy.yml

Had to fix because `.nvmrc` is not compatible 

```
error telegram-ubiquibot@1.0.0: The engine "node" is incompatible with this module. Expected version ">=v20.3.0". Got "18.14.1"
```

* Update cloudflare-deploy.yml

* feat: format on lint-staged

* fix: commit-msg script and add lint-staged command

* feat: prefer named functions

* feat: add naming conventions rule

* feat: easy ui support

* feat: easy ui support

* fix: prettier for css

* chore: add .env file to .gitignore

* fix: lint staged

* fix: lint staged

* chore: remove tabs

ubiquity-os/ubiquity-os-kernel#2 (comment)

* feat: reusable deploy script

* feat: ban non null assertions

resolves ubiquity/ts-template#7

* Update README.md

* feat: spell check on commit

* feat: copy typescript rules

https://github.com/krzkaczor/TypeStrict.git
thanks @krzkaczor

* chore: remove no unnecessary condition for false positives

* fix: forgot to include cspell

* fix: cspell ci

* fix(ci): cspell

* chore: remove deprecated

* feat(cspell): support colors

* fix(ci): cspell

* feat: production deploys

related ubiquity/pay.ubq.fi#153

* chore: set up build for cd

* chore(deps): upgrade all

* chore: test on another brnach

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* feat: workflow dispatch

* Merge branch 'test/cd'

* chore: debug cd

* chore: debug cd

* chore: debug cd

* chore: debug cd

* feat: add knip CI configuration

Resolves: ubiquity/ts-template#12

* feat: commit or pr

* feat: workflow dispatch

* chore: test env vars

* Squashed commit of the following:

commit 1dcef50
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 06:52:34 2024 +0900

    chore: test env vars

commit 126e819
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 06:51:03 2024 +0900

    feat: workflow dispatch

commit dbec9e3
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 06:39:04 2024 +0900

    feat: commit or pr

commit d61f01e
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 04:18:18 2024 +0900

    chore: debug cd

commit 9a8fc77
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 04:07:39 2024 +0900

    chore: debug cd

commit ea72c5e
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 04:06:43 2024 +0900

    chore: debug cd

commit de20331
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 04:01:17 2024 +0900

    chore: debug cd

commit dc336a9
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 03:46:41 2024 +0900

    feat: workflow dispatch

commit 0002fec
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 03:41:18 2024 +0900

    chore: bump ci

commit 56a8cf8
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 03:34:16 2024 +0900

    chore: bump ci

commit ad2564c
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 03:33:38 2024 +0900

    chore: bump ci

commit 3ad759b
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 03:20:33 2024 +0900

    chore: bump ci

commit 8b25785
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Tue Feb 20 01:46:52 2024 +0900

    chore: bump ci

commit d117e10
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Mon Feb 19 23:33:58 2024 +0900

    chore: bump ci

commit d3b5d08
Author: アレクサンダー.eth <gpg@pavlovcik.com>
Date:   Mon Feb 19 21:46:37 2024 +0900

    chore: test on another brnach

* fix: whitespace

* fix: transport secrets

* fix: app installation if

* feat: new github env style

* chore: update Knip yaml actions

As suggested during pull request review.

* chore: update supabase key name

ref: ubiquity/pay.ubq.fi#164 (comment)

* fix(ci): on prs

* fix: change dist to static

untested but in a rush and i think this is correct

* Update esbuild-server.ts

* fix: gitignore

* fix: commit sha

* feat: default Jest testing configuration

* Update .github/workflows/jest-testing.yml

* chore: moved jest config from js to ts

* chore: removed unused check to trigger Jest Action

* feat: cypress testing suite

* feat: default Jest testing configuration (ubiquity#19)

* feat: default Jest testing configuration

* Update .github/workflows/jest-testing.yml

* chore: moved jest config from js to ts

* chore: removed unused check to trigger Jest Action

---------

Co-authored-by: アレクサンダー.eth <4975670+pavlovcik@users.noreply.github.com>

* chore: updated yarn.lock

* chore: removed checks for warn messages in the console

* fix: disabled comments on every push, and added default value for coverage

* chore: moved knip configuration

* chore: workflow dispatch for knip

* chore: workflow dispatch for knip

* chore: changed action target to pull_request_target

* chore: added test section to README.md

* ci(cspell): fix

* Create CODEOWNERS

Congratulations on the promotion @FernandVEYRIER

* chore: added missing dep

* chore: added ignore rules to knip

* chore: removed ts-node dep and changed jest config

* chore: added ternary rules for eslint

* chore: fixed trailing space in conf

* ci: add init workflow

* feat: release please Action

* chore: changed release to target default branch

* chore: changed release to target default branch

* chore: added permissions to release please

* chore: removed npm env variable

* Update release-please.yml

* Update CODEOWNERS

* ci: pass cloudflare credentials

* ci: add reusable cloudflare deploy

* ci: use single action

* ci: update deploy.yml

* chore: add pascal case linter to enforce Erc20Permit and Erc721Permit naming conventions

* chore: enable StrictPascalCase on all Identifiers

* chore: undo unnecessary changes

* chore: add eslint-filename plugin

* revert camelCase deletions and change to strictCamelCase

* fix: use regex and ignore e2e.ts

* chore: eslint config type inference

* chore: update knip configuration in the template to run on pull_request

* fix: moved eslint from js to json and accept numbers in file names

* fix: workflow release please

* fix: workflow cypress

* chore: test reporting lib

* chore: test reporting lib

* chore: test reporting lib

* chore: test reporting lib

* Update jest-testing.yml

* chore: find PR number

* chore: remove event

* chore: test pr number

* chore: test pr number

* chore: test pr number

* chore: test comment

* chore: test comment

* chore: revert default branch for release-please.yml

* chore: revert default branch for release-please.yml

---------

Co-authored-by: rndquu <rndquu@gmail.com>
Co-authored-by: アレクサンダー.eth <gpg@pavlovcik.com>
Co-authored-by: 0xCodercrane <108444211+0xcodercrane@users.noreply.github.com>
Co-authored-by: アレクサンダー.eth <4975670+pavlovcik@users.noreply.github.com>
Co-authored-by: rndquu <119500907+rndquu@users.noreply.github.com>
Co-authored-by: Korrrba <gitcoiner@gmail.com>
Co-authored-by: Fernando <fernand.veyrier@epitech.eu>
Co-authored-by: Fernand <FernandVEYRIER@users.noreply.github.com>
Co-authored-by: jordan-ae <arreyetta1jnr@gmail.com>
Co-authored-by: jordan-ae <arreyetta1jrn@gmail.com>
Co-authored-by: Keyrxng <106303466+Keyrxng@users.noreply.github.com>
Co-authored-by: アレクサンダー.eth <4975670+0x4007@users.noreply.github.com>
Co-authored-by: Mentlegen <9807008+gentlementlegen@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants