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

Loosen @typescript-eslint/naming-convention rule to allow more formats for import names #388

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Feb 19, 2025

The bump to a more recent version of the TypeScript ESLint plugin added support for specifying naming conventions for import names (import name from 'package';). We didn't add a case for this, so the default format of camelCase applied, meaning that this is not allowed:

import SomeClass from 'some-package';

I've updated the rule to allow camelCase, PascalCase, snake_case, and UPPER_CASE, since the names of imports can depend on the (3rd party) package, and it feels unnecessary to enforce more strict formats in this case.

@Mrtenz Mrtenz marked this pull request as ready for review February 19, 2025 13:13
@Mrtenz Mrtenz requested review from a team as code owners February 19, 2025 13:13
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

Note that we could still alias the imports, so we're not beholden to package authors completely here.

But still, loosening this seems harmless to me, LGTM

@Mrtenz Mrtenz force-pushed the mrtenz/allow-more-import-casings branch from d6b10ac to 0fa8bf3 Compare February 19, 2025 14:35
@Mrtenz
Copy link
Member Author

Mrtenz commented Feb 19, 2025

Note that we could still alias the imports, so we're not beholden to package authors completely here.

True, but in the case of class imports for example, we'd want to use PascalCase, which previously wasn't allowed.

@Mrtenz Mrtenz merged commit 3302ab8 into main Feb 19, 2025
22 checks passed
@Mrtenz Mrtenz deleted the mrtenz/allow-more-import-casings branch February 19, 2025 14:40
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