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

test: check code with ESLint #243

Merged
merged 9 commits into from
Oct 2, 2024
Merged

test: check code with ESLint #243

merged 9 commits into from
Oct 2, 2024

Conversation

EvanHahn
Copy link
Contributor

@EvanHahn EvanHahn commented Sep 3, 2024

npm run lint:eslint (run as part of npm lint and npm test) now checks our code with ESLint.

This also fixes or disables all lint failures.

EvanHahn referenced this pull request Sep 3, 2024
This change should have no user impact.

There's almost always something better than `// @ts-ignore` and
`// @ts-expect-error`. They can be problematic because they're very
broad, and typically broader than we want. For details, see
["At least 7 reasons to avoid @ts-expect-error and @ts-ignore"][0].

This removes all of them in favor of more targeted solutions. (Or, in
one case, just removes it and everything was fine!)

I think this is a useful change on its own, but it should make [an
upcoming change][1] easier too.

[0]: https://shane-o.dev/articles/any-or-expect
[1]: https://github.com/digidem/mapeo-schema/pull/243
EvanHahn referenced this pull request Sep 3, 2024
This change should have no user impact.

This removes a few unused imports from a few files.

I think this is a useful change on its own, but it should make [an
upcoming change][1] easier too.

[1]: https://github.com/digidem/mapeo-schema/pull/243
EvanHahn referenced this pull request Sep 3, 2024
This change should have no user impact.

This removes a few unused imports from a few files.

I think this is a useful change on its own, but it should make [an
upcoming change][1] easier too.

[1]: https://github.com/digidem/mapeo-schema/pull/243
`npm run lint:eslint` (run as part of `npm lint` and `npm test`) now
checks our code with ESLint.

This also fixes or disables all lint failures.
@EvanHahn EvanHahn force-pushed the add-eslint branch 2 times, most recently from d39d786 to 859a695 Compare September 5, 2024 20:26
`npm run lint:eslint` (run as part of `npm lint` and `npm test`) now
checks our code with ESLint.

This also fixes or disables all lint failures.
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-expect-error': false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default still allows this, but makes us leave a comment.

'ts-expect-error': false,
},
],
'@typescript-eslint/no-explicit-any': 'off',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use a lot of anys so I don't think we should disable this right now.

eslint.config.js Outdated
Comment on lines 22 to 29
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
},
],
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matches rules we have elsewhere.

@EvanHahn EvanHahn marked this pull request as ready for review September 5, 2024 20:31
src/lib/utils.ts Outdated Show resolved Hide resolved
@EvanHahn EvanHahn removed the request for review from tomasciccola September 25, 2024 19:55
@EvanHahn EvanHahn requested a review from gmaclennan September 25, 2024 20:10
Copy link
Member

@gmaclennan gmaclennan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Small niggle, can be ignored: we use filter-obj in a couple of other modules, and I would lean towards using a well-maintained and tested module like that rather than our own implementation, which is doesn't have tests for edge-cases, e.g. symbol properties.

@EvanHahn EvanHahn merged commit 5fcb728 into main Oct 2, 2024
6 checks passed
@EvanHahn EvanHahn deleted the add-eslint branch October 2, 2024 14:20
@EvanHahn
Copy link
Contributor Author

EvanHahn commented Oct 2, 2024

I'll plan to do that in a followup.

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.

2 participants