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

feat(eslint): making a couple of our internal custom rules open source #871

Merged
merged 9 commits into from
Aug 8, 2024

Conversation

erunion
Copy link
Member

@erunion erunion commented Aug 8, 2024

🧰 Changes

This makes a couple of our internal ESLint rules open source by pulling them into our eslint-plugin-readme package. The rules included in this are:

  • readme/no-decorators-on-private-properties: Prevents the use of decorators on private properties as they cannot be introspected.
  • readme/prefer-unicode-ellipsis: Prefer using a unicode ellipsis () instead of three periods (...).

Those rules have been pulled over verbatim from our internal codebase.

In addition to that I'm also introducing a new (and definitely not enabled) rule, readme/prefer-typescript, to prefer that a codebase is written in TypeScript by asserting file extensions.

@erunion erunion added the enhancement New feature or request label Aug 8, 2024
},
create: context => {
return {
Program(node) {
Copy link
Member Author

@erunion erunion Aug 8, 2024

Choose a reason for hiding this comment

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

I can see if a file actually contains TS by checking if it uses import or some sort of type but because a file could potentially have neither of those, and still be perfectly fine, I'm leaving it to just assert the filename.

Though maybe in those cases the warning could just be ignored? I'm not sure.

Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

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

one question below otherwise LGTM!

Copy link
Member

Choose a reason for hiding this comment

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

hard to tell when skimming through this code but is this code smart enough to distinguish spread syntax?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep! spreads are a SpreadElement which i'm not looking for here

Screenshot 2024-08-08 at 8 20 28 AM

@erunion erunion merged commit 3d41bb5 into main Aug 8, 2024
2 checks passed
@erunion erunion deleted the feat/expanded-homegrown-rules branch August 8, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants