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

Empty class breaks eslint for vue/no-restricted-class #2424

Closed
2 tasks done
ibrahimBeladi opened this issue Mar 11, 2024 · 0 comments · Fixed by #2425
Closed
2 tasks done

Empty class breaks eslint for vue/no-restricted-class #2424

ibrahimBeladi opened this issue Mar 11, 2024 · 0 comments · Fixed by #2425
Labels

Comments

@ibrahimBeladi
Copy link

When we have an empty class with no ="" in the deceleration, like in

<template>
    <span class>Hello</span>
</template>

with vue/no-restricted-class being warn or error, then it breaks the ESLint job/process

After running yarn eslint src/your-file.vue:

Oops! Something went wrong! :(

ESLint: 8.57.0

TypeError: Cannot read properties of null (reading 'value')
Occurred while linting path-to-file.vue:1
Rule: "vue/no-restricted-class"
    at VAttribute[directive=false][key.name="class"] (/project-path/node_modules/eslint-plugin-vue/lib/rules/no-restricted-class.js:136:44)
    at EventEmitter.emit (node:events:513:28)
    at NodeEventGenerator.applySelector (/project-path/node_modules/vue-eslint-parser/index.js:4373:26)
    at NodeEventGenerator.applySelectors (/project-path/node_modules/vue-eslint-parser/index.js:4387:22)
    at NodeEventGenerator.enterNode (/project-path/node_modules/vue-eslint-parser/index.js:4395:14)
    at traverse (/project-path/node_modules/vue-eslint-parser/index.js:165:13)
    at traverse (/project-path/node_modules/vue-eslint-parser/index.js:172:21)
    at traverse (/project-path/node_modules/vue-eslint-parser/index.js:177:13)
    at traverse (/project-path/node_modules/vue-eslint-parser/index.js:172:21)
    at traverseNodes (/project-path/node_modules/vue-eslint-parser/index.js:183:5)
error Command failed with exit code 2.

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 8.57.0
  • eslint-plugin-vue version: 9.22.0
  • Vue version: 2.7.16
  • Node version: v18.14.0 (with npm 9.3.1)
  • Operating System: Linux Mint

Please show your full configuration:

module.exports = {
  extends: ['plugin:vue/recommended'],

  rules: {
    'vue/no-restricted-class': ['error', '/^(m|p)(l|r)-/']
  }
};

What did you do?

<template>
    <span class>Hello</span>
</template>

What did you expect to happen?
ESLint continues

What actually happened?
ESLint breaks

Repository to reproduce this issue

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