Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

docs update - Add hasFix metadata for the indent rule #3529

Merged
merged 3 commits into from
Dec 1, 2017
Merged

docs update - Add hasFix metadata for the indent rule #3529

merged 3 commits into from
Dec 1, 2017

Conversation

ChrisMBarr
Copy link
Contributor

PR checklist

  • Addresses an existing issue: #0000
  • New feature, bugfix, or enhancement
    • Includes tests
  • Documentation update

Overview of change:

Add the hasFix property to the metadata of the indent rule.

The docs for this rule mention auto-fixing, but the green "🔧 Has Fixer" badge doesn't appear, which could lead people to assume (like I did) that this rule has no fixer.

Future Suggestions:

Perhaps make the hasFix property required instead of optional so that rule authors are required to correctly set this properly. Further more, maybe add a check to see if hasFix: false is set but the rule contains a call on the Lint.Replacement, or Lint.RuleFailure has something passed into the 6th parameter for a fix.

@adidahiya
Copy link
Contributor

I think the docs description is misleading then. We need #3395 before declaring this rule as having a proper fixer.

@ChrisMBarr
Copy link
Contributor Author

I mean... it does have a fixer right now technically... but I see what you mean since the current one doesn't work in 100% of cases.

The docs do mention that it only works when certain options are set though, which seems sufficient enough to add this badge.

My use case & thought process: I work on a project with mixed tabs/spaces and I want to normalize them.

I enable this rule to see all the violations... wow there are a lot! I check the docs in hope of an auto-fix... nope, I guess I have to do all these fixes manually! This sucks... oh wait, it does have an auto fix. This is just a documentation issue,

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

ok, fair enough, if you think the documentation caveat is good enough :)

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

hm actually we should elaborate the docs about the required option for auto-fixing... we should say it doesn't auto-fix indent size, just indent style (tab vs. spaces)

@ChrisMBarr
Copy link
Contributor Author

@adidahiya Check out my latest changes, would adding text like that be sufficient?

@adidahiya
Copy link
Contributor

@ChrisMBarr looks good, but linting failed

@ajafff ajafff merged commit 0279553 into palantir:master Dec 1, 2017
@ChrisMBarr ChrisMBarr deleted the patch-4 branch December 1, 2017 12:39
HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this pull request Apr 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants