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

@eslint-community/eslint-comments/disable-enable-pair crash in HTML files #162

Open
Samuel-Therrien-Beslogic opened this issue Dec 20, 2023 · 4 comments
Labels

Comments

@Samuel-Therrien-Beslogic

Version: @eslint-community/[email protected]

.eslintrc.json

  "rules": {
    "@eslint-community/eslint-comments/disable-enable-pair": [
      "error",
      {
        "allowWholeFile": true
      }
    ]
  },

Error:

Oops! Something went wrong! :(

ESLint: 8.56.0

TypeError: Cannot read properties of undefined (reading 'length')
Occurred while linting <snip>.html:1
Rule: "@eslint-community/eslint-comments/disable-enable-pair"
    at Program (<snip>\node_modules\@eslint-community\eslint-plugin-eslint-comments\lib\rules\disable-enable-pair.js:47:49)
    at ruleErrorHandler (<snip>\node_modules\eslint\lib\linter\linter.js:1076:28)      
    at <snip>\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (<snip>\node_modules\eslint\lib\linter\safe-emitter.js:45:38)       
    at NodeEventGenerator.applySelector (<snip>\node_modules\eslint\lib\linter\node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (<snip>\node_modules\eslint\lib\linter\node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (<snip>\node_modules\eslint\lib\linter\node-event-generator.js:340:14)
    at CodePathAnalyzer.enterNode (<snip>\node_modules\eslint\lib\linter\code-path-analysis\code-path-analyzer.js:803:23)
    at <snip>\node_modules\eslint\lib\linter\linter.js:1111:32
@github-actions github-actions bot added the Stale label Feb 18, 2024
Copy link

This issue has been automatically closed because we haven't received a response from the original author 🙈. This automation helps keep the issue tracker clean from issues that aren't actionable. Please reach out if you have more information for us! 🙂

@Samuel-Therrien-Beslogic
Copy link
Author

Hi, can this be reopenned? (CC @MichaelDeBoey @eslint-community , see #164 )

@Samuel-Therrien-Beslogic
Copy link
Author

Samuel-Therrien-Beslogic commented Jul 4, 2024

Can you try to reproduce this error in the playground?

eslint-online-playground.netlify.app

Doesn't look like the playground supports HTML files:
File ignored because of a matching ignore pattern. Use "--no-ignore" to disable file ignore settings or use "--no-warn-ignored" to suppress this warning.

But here's an example:

<div>
  <!-- eslint-disable @angular-eslint/template/no-inline-styles -->
  <span style="font-size: 10px;"></span>
  <!-- eslint-enable @angular-eslint/template/no-inline-styles -->
</div>

More complete example with Angular

<div>
  <!-- eslint-disable @angular-eslint/template/no-inline-styles -->
  @if (enableFilterByType) {
  <div>{{ 'filter.type' | transloco }} <span style="font-size: 10px;"></span></div>
  }
  @if (enableFilterBySources) {
  <div>{{ 'filter.sources' | transloco }} <span style="font-size: 10px;"></span></div>
  }
  @if (enableFilterByDate) {
  <div>{{ 'filter.date' | transloco }} <span style="font-size: 10px;"></span></div>
  }
  @if (enableSortBy) {
  <div>{{ 'filter.sort-by' | transloco }} <span style="font-size: 10px;"></span></div>
  }
  <!-- eslint-enable @angular-eslint/template/no-inline-styles -->
</div>

@MichaelDeBoey MichaelDeBoey reopened this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants