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

Rule Proposal: `template-curly-spacing` #5049

Closed
mysticatea opened this issue Jan 24, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@mysticatea
Copy link
Member

commented Jan 24, 2016

This is a rule for a stylistic issue.

We can write expressions in template strings with ${ and }.

`hello, ${people.name}!`

This rule enforce usage of spacing inside of the ${ and }.

This rule have an option:

  • "always" - It expects one or more spaces between the expression and the ${ and }.
  • "never" (by default) - It expects no space between the expression and the ${ and }.

The following patterns are considered problems:

/*eslint template-curly-spacing: 2*/

`hello, ${ people.name }!`  /*error Unexpected space(s) after '${'.*/
                            /*error Unexpected space(s) before '}'.*/

The following patterns are considered problems with "always":

/*eslint template-curly-spacing: [2, "always"]*/

`hello, ${people.name}!`  /*error Expected space(s) after '${'.*/
                          /*error Expected space(s) before '}'.*/

The following patterns are not considered problems:

/*eslint template-curly-spacing: 2*/

`hello, ${people.name}!`
`hello, ${
    people.name
}!`

The following patterns are not considered problems with "always":

/*eslint template-curly-spacing: [2, "always"]*/

`hello, ${ people.name }!`
`hello, ${
    people.name
}!`

Related Rules:

@nzakas

This comment has been minimized.

Copy link
Member

commented Jan 24, 2016

👍

@mysticatea

This comment has been minimized.

Copy link
Member Author

commented Jan 31, 2016

I'm working on this.

@mysticatea mysticatea self-assigned this Jan 31, 2016

mysticatea added a commit to mysticatea/eslint that referenced this issue Jan 31, 2016

mysticatea added a commit to mysticatea/eslint that referenced this issue Jan 31, 2016

mysticatea added a commit to mysticatea/eslint that referenced this issue Jan 31, 2016

@nzakas nzakas closed this in #5113 Feb 1, 2016

nzakas added a commit that referenced this issue Feb 1, 2016

Merge pull request #5113 from mysticatea/template-curly-spacing/new
New: `template-curly-spacing` rule (fixes #5049)

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

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.