Skip to content

Add linter rule to guide people to the right dayjs import#8156

Merged
mariusandra merged 2 commits intomasterfrom
restrict-dayjs-imports
Jan 20, 2022
Merged

Add linter rule to guide people to the right dayjs import#8156
mariusandra merged 2 commits intomasterfrom
restrict-dayjs-imports

Conversation

@pauldambra
Copy link
Copy Markdown
Member

Changes

We have a specific DayJS import to use in lib/dayjs

However, on first attempting to use any DayJS code in a file, an IDE will prompt to import directly from the DayJS module.

This adds a linter rule to guide the developer to use the correct import.

How did you test this code?

Adding the rule and seeing that the linter shows an error when directly importing DayJS

Copy link
Copy Markdown
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

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

Very nice!

@mariusandra mariusandra enabled auto-merge (squash) January 20, 2022 09:59
@mariusandra mariusandra disabled auto-merge January 20, 2022 09:59
@mariusandra
Copy link
Copy Markdown
Collaborator

only... this rule now caught some old broken code. Can you update these imports as well?

@mariusandra mariusandra merged commit c38d2c3 into master Jan 20, 2022
@mariusandra mariusandra deleted the restrict-dayjs-imports branch January 20, 2022 12:13
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