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

Enable some more @typescript-eslint rules #7287

Merged
merged 4 commits into from
Nov 21, 2024

Conversation

pjonsson
Copy link
Contributor

@pjonsson pjonsson commented Oct 1, 2024

What this PR does

Enable some more @typescript-eslint rules.

These rules seem worthy of keeping enabled so more of these issues don't get into the code base. I don't have a strong opinion that all of them have to be enabled, so if some rule is contentious, just let me know and I'll drop that commit so the rest of the PR can get merged.

Test me

Run yarn gulp lint and see that the linter passes.

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

This fixes the error:

error  Don't use `{}` as a type. `{}` actually means "any non-nullish value".
- If you want a type meaning "any object", you probably want `object` instead.
- If you want a type meaning "any value", you probably want `unknown` instead.
- If you want a type meaning "empty object", you probably want `Record<string, never>` instead.
- If you really want a type meaning "any non-nullish value", you probably want `NonNullable<unknown>` instead  @typescript-eslint/ban-types
This makes the return type correspond
to the boolean that the comment at
the interface suggests.
There is a single type signature
that does not pass this check in the current
code base, so update that signature and
enable the lint rule.
@pjonsson pjonsson changed the title Enable more lint Enable some more @typescript-eslint rules Oct 1, 2024
.eslintrc Outdated Show resolved Hide resolved
@ljowen ljowen self-assigned this Oct 13, 2024
Remove constructors that just call
super() with their arguments and
enable @typescript-eslint/no-useless-constructor.
@na9da
Copy link
Collaborator

na9da commented Nov 21, 2024

Looks good to me too. Thanks @pjonsson!

@na9da na9da merged commit dd8b882 into TerriaJS:main Nov 21, 2024
6 checks passed
@pjonsson pjonsson deleted the enable-more-lint branch November 21, 2024 10:36
@pjonsson pjonsson mentioned this pull request Nov 21, 2024
4 tasks
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.

3 participants