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

Reduce the number of files ignored by tsc linting #1452

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

kzar
Copy link
Collaborator

@kzar kzar commented Oct 13, 2022

The TypeScript linter tsc is set to ignore some modules, since there
are some linting errors in those files. The problem with that (other
than missing out on the benefits of type checking), is that when one
of the ignored modules is later imported by a non-ignored module, the
previously-ignored module will start being checked again. This results
in a kind of trap where importing the wrong module suddenly results in
dozens of linting errors!

Let's improve the situation by reducing the number of ignored
modules.

One interesting linting error I hit was:

Module '"X"' declares 'Y' locally, but it is not exported.

It turned out, that was caused by modules that used CommonJS exports,
but that started with an ES import. To fix those errors, I switched
back to CommonJS imports in those situations. We should obviously
switch to ES modules generally in the future.

Reviewer: @jonathanKingston

Description:

Steps to test this PR:

Automated tests:

  • Unit tests
  • Integration tests
Reviewer Checklist:
  • Ensure the PR solves the problem
  • Review every line of code
  • Ensure the PR does no harm by testing the changes thoroughly
  • Get help if you're uncomfortable with any of the above!
  • Determine if there are any quick wins that improve the implementation
PR Author Checklist:
  • Get advice or leverage existing code
  • Agree on technical approach with reviewer (if the changes are nuanced)
  • Ensure that there is a testing strategy (and documented non-automated tests)
  • Ensure there is a documented monitoring strategy (if necessary)
  • Consider systems implications

@kzar kzar force-pushed the fix-tsc-errors branch 2 times, most recently from 46ff08a to cec091e Compare October 13, 2022 14:55
The TypeScript linter tsc is set to ignore some modules, since there
are some linting errors in those files. The problem with that (other
than missing out on the benefits of type checking), is that when one
of the ignored modules is later imported by a non-ignored module, the
previously-ignored module will start being checked again. This results
in a kind of trap where importing the wrong module suddenly results in
dozens of linting errors!

Let's improve the situation by reducing the number of ignored
modules.

One interesting linting error I hit was:

    Module '"X"' declares 'Y' locally, but it is not exported.

It turned out, that was caused by modules that used CommonJS exports,
but that started with an ES import. To fix those errors, I switched
back to CommonJS imports in those situations. We should obviously
switch to ES modules generally in the future.
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.

None yet

2 participants