-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
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
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
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.
d39d786
to
859a695
Compare
`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, |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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 any
s so I don't think we should disable this right now.
eslint.config.js
Outdated
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
varsIgnorePattern: '^_', | ||
argsIgnorePattern: '^_', | ||
}, | ||
], | ||
}, |
There was a problem hiding this comment.
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.
Because we genuinely expect an error! See [this comment][0]. [0]: #243 (comment)
There was a problem hiding this 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.
I'll plan to do that in a followup. |
npm run lint:eslint
(run as part ofnpm lint
andnpm test
) now checks our code with ESLint.This also fixes or disables all lint failures.