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

ESLint rule to warn about template string usage in the className prop #218

Open
valerybugakov opened this issue Sep 22, 2021 · 2 comments
Open
Assignees
Labels
good first issue Good for newcomers

Comments

@valerybugakov
Copy link
Member

Problem statement

Recently we refactored the main Sourcegraph codebase to be consistent in usage of the classNames utility to create className prop in React Components. To prevent usage of the template literal, we need to create an ESLint rule that communicates to a developer that the classNames util is the preferred approach.

Success criteria

  1. The linter rule is created that detects the use of the template literal inside of the className prop and show a warning that suggests using classNames utility instead:
// Bad
<div className={`d-flex ${props.classname}`} />

// Good
<div className={classNames('d-flex', props.classname)} />

Things to learn/practice during the implementation

  1. How to write custom ESLint rules to boost codebase consistency.

Estimated amount of work

T-shirt size abstract estimate: M.

@valerybugakov valerybugakov added the good first issue Good for newcomers label Sep 22, 2021
@valerybugakov valerybugakov added this to To do [Experienced] in Good first issues Sep 22, 2021
@rafaeelaudibert
Copy link

Hey @valerybugakov! Could you assign this to me? It'd be pretty nice to test my AST skills :)

@valerybugakov
Copy link
Member Author

@rafaeelaudibert, feel free to pick it up!

@oleggromov oleggromov self-assigned this Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Good first issues
To do [Experienced] 🏋🏻
Status: Backlog
Development

No branches or pull requests

3 participants