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

`Quotes` rule has no default #4270

Closed
IanVS opened this Issue Oct 27, 2015 · 6 comments

Comments

Projects
None yet
4 participants
@IanVS
Member

IanVS commented Oct 27, 2015

Currently, it is possible to set the rule to 2 (error), and it will do nothing unless a quote type is also provided. As it says in the docs:

The first option is "double", "single" or "backtick" for double-quotes, single-quotes or backticks respectively. There is no default.

I think generally we try to provide some kind of default for all rules, and while I really don't care which type is chosen for a default, it seems like there should at least be one. So, that raises two questions:

  1. Should a default style be added?
  2. If so, what style should it be?
@michaelficarra

This comment has been minimized.

Show comment
Hide comment
@michaelficarra

michaelficarra Oct 27, 2015

Member

We should just change the schema to not allow that particular configuration. A default would not make sense for this rule.

Member

michaelficarra commented Oct 27, 2015

We should just change the schema to not allow that particular configuration. A default would not make sense for this rule.

@ilyavolodin

This comment has been minimized.

Show comment
Hide comment
@ilyavolodin

ilyavolodin Oct 27, 2015

Member

@michaelficarra Default would make this rule opinionated, but I think it does make sense. Having a rule that does absolutely nothing it you forgot to specify an option is pretty strange. In all honesty default for this rule should probably be autoconfig (as in, count all types of quotes, take larges number as a default and report the rest).
Maybe modifying schema to require a parameter is not a bad option either.

Member

ilyavolodin commented Oct 27, 2015

@michaelficarra Default would make this rule opinionated, but I think it does make sense. Having a rule that does absolutely nothing it you forgot to specify an option is pretty strange. In all honesty default for this rule should probably be autoconfig (as in, count all types of quotes, take larges number as a default and report the rest).
Maybe modifying schema to require a parameter is not a bad option either.

@michaelficarra

This comment has been minimized.

Show comment
Hide comment
@michaelficarra

michaelficarra Oct 27, 2015

Member

Having a rule that does absolutely nothing it you forgot to specify an option is pretty strange.

Of course, which is why I suggested it fail immediately.

Member

michaelficarra commented Oct 27, 2015

Having a rule that does absolutely nothing it you forgot to specify an option is pretty strange.

Of course, which is why I suggested it fail immediately.

@IanVS

This comment has been minimized.

Show comment
Hide comment
@IanVS

IanVS Oct 27, 2015

Member

Is it worth making this rule the only one which cannot be set with only a severity, only to avoid choosing a default? There are other rules like indent which could be considered being opinionated in their default, why should this one be treated any differently?

Member

IanVS commented Oct 27, 2015

Is it worth making this rule the only one which cannot be set with only a severity, only to avoid choosing a default? There are other rules like indent which could be considered being opinionated in their default, why should this one be treated any differently?

@nzakas

This comment has been minimized.

Show comment
Hide comment
@nzakas

nzakas Oct 27, 2015

Member

Does the schema check the file or just the finished options? If the former, then there's no way to update the schema to make this work because you can change just the severity of the rule at any point and inherit the options from another file.

If we can't do it schema wise, let's just set to double by default. We have a 50/50 chance that it's correct, and people can always change it if they want.

Member

nzakas commented Oct 27, 2015

Does the schema check the file or just the finished options? If the former, then there's no way to update the schema to make this work because you can change just the severity of the rule at any point and inherit the options from another file.

If we can't do it schema wise, let's just set to double by default. We have a 50/50 chance that it's correct, and people can always change it if they want.

@IanVS

This comment has been minimized.

Show comment
Hide comment
@IanVS

IanVS Oct 30, 2015

Member

I was wrong, it is already defaulting to double quotes. The docs just need to be updated to reflect this.

Member

IanVS commented Oct 30, 2015

I was wrong, it is already defaulting to double quotes. The docs just need to be updated to reflect this.

@IanVS IanVS closed this in b29fd49 Oct 30, 2015

ilyavolodin added a commit that referenced this issue Oct 30, 2015

Merge pull request #4296 from eslint/issue4270
Docs: Specify 'double' as default for quotes (fixes #4270)

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.