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

Disallow using require for imports #405

Merged
merged 1 commit into from
Mar 19, 2021
Merged

Disallow using require for imports #405

merged 1 commit into from
Mar 19, 2021

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Mar 17, 2021

The ESLint rule @typescript-eslint/no-require-imports has been re-enabled, which prevents using require to import modules. We have been using require in this codebase primarily to avoid the warning from TypeScript about each dependency that lacks types. That warning has been adding an empty declaration for each third-party module we use that lacks types. Effectively this declares them as type any.

@Gudahtt
Copy link
Member Author

Gudahtt commented Mar 17, 2021

This depends upon #404

rickycodes
rickycodes previously approved these changes Mar 19, 2021
Copy link
Member

@rickycodes rickycodes left a comment

Choose a reason for hiding this comment

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

LGTM

Base automatically changed from es-module-interop to develop March 19, 2021 15:01
@Gudahtt Gudahtt dismissed rickycodes’s stale review March 19, 2021 15:01

The base branch was changed.

@Gudahtt Gudahtt marked this pull request as ready for review March 19, 2021 15:11
@Gudahtt Gudahtt requested a review from a team as a code owner March 19, 2021 15:11
The ESLint rules `@typescript-eslint/no-require-imports` and
`@typescript-eslint/no-var-requires` have been re-enabled, which
prevents using `require` to import modules. We have been using
`require` in this codebase primarily to avoid the warning from
TypeScript about each dependency that lacks types. That warning has
been adding an empty declaration for each third-party module we use
that lacks types. Effectively this declares them as type `any`.

The `ethjs-util` dependency has also been added to fix type errors
resulting from using the methods from `ethjs-util` that were re-
exported by `ethereumjs-util`. The errors were caused by incomplete
types provided by `ethereumjs-util` (they were missing the re-exported
functions). We're using the exact same version that was being used
transitively, so this should not result in any functional change.
Copy link
Contributor

@NiranjanaBinoy NiranjanaBinoy left a comment

Choose a reason for hiding this comment

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

LGTM

@Gudahtt Gudahtt merged commit 5aa47dc into develop Mar 19, 2021
@Gudahtt Gudahtt deleted the no-require-imports branch March 19, 2021 19:03
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The ESLint rules `@typescript-eslint/no-require-imports` and
`@typescript-eslint/no-var-requires` have been re-enabled, which
prevents using `require` to import modules. We have been using
`require` in this codebase primarily to avoid the warning from
TypeScript about each dependency that lacks types. That warning has
been adding an empty declaration for each third-party module we use
that lacks types. Effectively this declares them as type `any`.

The `ethjs-util` dependency has also been added to fix type errors
resulting from using the methods from `ethjs-util` that were re-
exported by `ethereumjs-util`. The errors were caused by incomplete
types provided by `ethereumjs-util` (they were missing the re-exported
functions). We're using the exact same version that was being used
transitively, so this should not result in any functional change.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The ESLint rules `@typescript-eslint/no-require-imports` and
`@typescript-eslint/no-var-requires` have been re-enabled, which
prevents using `require` to import modules. We have been using
`require` in this codebase primarily to avoid the warning from
TypeScript about each dependency that lacks types. That warning has
been adding an empty declaration for each third-party module we use
that lacks types. Effectively this declares them as type `any`.

The `ethjs-util` dependency has also been added to fix type errors
resulting from using the methods from `ethjs-util` that were re-
exported by `ethereumjs-util`. The errors were caused by incomplete
types provided by `ethereumjs-util` (they were missing the re-exported
functions). We're using the exact same version that was being used
transitively, so this should not result in any functional change.
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