Skip to content

no-trailing-spaces "ignoreComments: true" displays error in html comments #233

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

Closed
2 tasks done
theetrain opened this issue Aug 19, 2022 · 1 comment · Fixed by #240
Closed
2 tasks done

no-trailing-spaces "ignoreComments: true" displays error in html comments #233

theetrain opened this issue Aug 19, 2022 · 1 comment · Fixed by #240
Labels

Comments

@theetrain
Copy link

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.17.0

What version of eslint-plugin-svelte are you using?

2.6.0

What did you do?

Configuration
{
  "extends": ["prettier", "standard"],
  "plugins": ["@typescript-eslint"],
  "parser": "@typescript-eslint/parser",
  "rules": {
    "arrow-parens": ["error", "as-needed"],
    "operator-linebreak": ["error", "before"],
    "no-trailing-spaces": [
      "error",
      {
        "ignoreComments": true
      }
    ]
  },
  "overrides": [
    {
      "files": ["*.svelte"],
      "parser": "svelte-eslint-parser",
      "rules": {
        "import/first": 0,
        "import/no-duplicates": 0,
        "import/no-mutable-exports": 0,
        "import/no-unresolved": 0,
        "import/prefer-default-export": 0,
        "eslint-plugin-html": 0,
        "no-multiple-empty-lines": 0
      }
    }
  ],
  "env": {
    "node": true
  }
}

In my component, I have a code comment with 2 empty spaces at the end if the first line: ...blends in with paragraph in order to support line-breaks when hovering the component and viewing its description.

<!-- @component
  InlineButton - A button that blends in with paragraph  
  styles, but is interactive.
-->
<button>
  <slot />
</button>

What did you expect to happen?

I would hope ESLint would be ok with it, given my config. No errors appear in my .js files.

What actually happened?

Trailing spaces not allowed. eslint(no-trailing-spaces)

Link to Minimal Reproducible Example

https://ota-meshi.github.io/eslint-plugin-svelte/playground/#shortenedhash

In the playground, the no-trailing-spaces rule only has "on" or "off" functionality, without me able to include the "ignoreComments": true config.

Additional comments

I've had good success with this linting tool while programming in Svelte. Thank you for maintaining!

@ota-meshi
Copy link
Member

Thank you for posting the issue.
I think we need to add a new rule svelte/no-trailing-spaces that extends no-trailing-spaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants