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

negated rule API #3837

Open
abitrolly opened this issue Jan 4, 2024 · 3 comments
Open

negated rule API #3837

abitrolly opened this issue Jan 4, 2024 · 3 comments
Labels

Comments

@abitrolly
Copy link
Contributor

I am trying add the new rule to fix #3810 and I find the lines around negated puzzling. For example,

const negated = (when?: string) => when === 'never';

Why each rule has to calculate this negated property?
Why it can not just receive the negated as a bool param?
Where this negated is realistically used?

@escapedcat
Copy link
Member

Sorry, can't really answer this question

@abitrolly
Copy link
Contributor Author

If you can't answer, then I have no chance to understand it too. :D

@knocte
Copy link
Contributor

knocte commented Feb 13, 2024

IMO, if the when param always has values 'always' or 'never' in commitlint's codebase, then, yes, we should refactor to make it a bool. Maybe we should check git-blame to see who coded this in the first place and ask her/him why did he choose a string? Maybe she/he was envisioning more things besides 'always', 'never', ...? (I wonder how a 'sometimes' could work.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants