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

no-irregular-whitespace will give an error to irregular-whitespace if skipTemplates is true but template literal line breaks are included #13852

Closed
eai04191 opened this issue Nov 16, 2020 · 1 comment

Comments

@eai04191
Copy link

@eai04191 eai04191 commented Nov 16, 2020

Tell us about your environment

  • ESLint Version: 7.13.0
  • Node Version: v12.18.0
  • npm Version: v6.14.4

What parser are you using?: default

Please show your full configuration:

Configuration
{
    "extends": ["eslint:recommended"],
    "env": {
        "es6": true,
        "browser": true,
        "jest": true,
        "node": true
    },
    "rules": {
        "no-unused-vars": "off",
        "no-irregular-whitespace": [
            "error",
            {
                "skipTemplates": true
            }
        ]
    }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

const passed = `hoge fuga`;
const error = `hoge fuga
hoge fuga`;

// \U3000 is included between all `hoge` and `fuga`.
// But ESLint only gives an error on the 3rd line.
yarn eslint .\src\no-irregular-whitespace.js

What did you expect to happen?

ESLint does not raise an error for irregular-whitespace in template literals.

What actually happened? Please include the actual, raw output from ESLint.

  3:5  error  Irregular whitespace not allowed  no-irregular-whitespace

Are you willing to submit a pull request to fix this bug?

Probably difficult. I want to see if this is a bug or the correct behavior.

@mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Nov 16, 2020

Hi @eai04191, thanks for the bug report!

I confirmed this bug in our online demo and prepared a fix.

Loading

mdjermanovic added a commit that referenced this issue Nov 20, 2020
…13853)

* Fix: no-irregular-whitespace skipTemplates false positive (fixes #13852)

* Add more tests
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants