Skip to content

Add a fix for the rule - #3

Open
bastienmoulia wants to merge 1 commit into
Sergiioo:masterfrom
bastienmoulia:rule-fix
Open

Add a fix for the rule#3
bastienmoulia wants to merge 1 commit into
Sergiioo:masterfrom
bastienmoulia:rule-fix

Conversation

@bastienmoulia

Copy link
Copy Markdown

Allow to replace fdescribe by describe, and fit by it.

@Sergiioo Sergiioo self-assigned this May 15, 2018
@Sergiioo

Copy link
Copy Markdown
Owner

Thanks for the PR - I appreciate your contribution, however auto fixing is something I have deliberately left out up to now.

I don't auto fix as fdescribe or fit are tools that you might want to use sometimes during local development, rather than obvious bugs. Imagine you have configured tslint --fix to run as part of your watch process and you decide to run a single spec with fit, then as soon as you save the change, tslint is going to helpfully "fix" that for you. Most of the rules with autofix options tend to fix obvious problems like whitespace, or bracket placement, or commas, etc.

I think your PR is a reasonable request though. Some people may want this to be auto fixed. Maybe they are only running tslint --fix in a pre-commit hook for example, or they will fix with their IDE.

I think all it needs is a bit more configuration. Something along the lines of:

"rules": {
  "defocus": true,    // same behaviour as now for backwards compatibility

"rules": {
  "defocus": "fix"    // will apply your fix, so the user can auto fix if running with the --fix flag 

I can take a look at this when I get a chance, or if you want to update your PR then that would be great.

@bastienmoulia

Copy link
Copy Markdown
Author

OK.

I'm not sure if "defocus": "fix" can work (is the first parameter readable?).
Another option is "defocus": [true, "fix"] .

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