Skip to content

vue/html-indent errors while using <textarea> #1752

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
cheeze2000 opened this issue Jan 2, 2022 · 2 comments · Fixed by #1755
Closed
2 tasks done

vue/html-indent errors while using <textarea> #1752

cheeze2000 opened this issue Jan 2, 2022 · 2 comments · Fixed by #1755
Labels

Comments

@cheeze2000
Copy link

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.6.0
  • eslint-plugin-vue version: 8.2.0
  • Node version: 16.13.1
  • Operating System: Ubuntu 20.04.3

Please show your full configuration:

module.exports = {
	"env": {
		"commonjs": true,
	},
	"extends": [
		"eslint:recommended",
		"plugin:vue/vue3-strongly-recommended"
	],
	"parserOptions": {
		"ecmaVersion": 13,
		"sourceType": "module"
	},
	"plugins": [
		"vue"
	],
	"rules": {
		"vue/html-indent": ["error", "tab"]
	}
};

What did you do?

<template>
	<textarea class="red">
		abc
</template>

What did you expect to happen?
Linting errors about missing a closing textarea tag

What actually happened?

Oops! Something went wrong! :(

ESLint: 8.6.0

TypeError: Cannot read properties of null (reading 'range')
Occurred while linting /home/cheeze/repos/test-app/App.vue:1
Rule: "vue/html-indent"
    at TokenStore.getTokensBetween (/home/cheeze/repos/test-app/node_modules/vue-eslint-parser/index.js:4240:107)
    at setPreformattedTokens (/home/cheeze/repos/test-app/node_modules/eslint-plugin-vue/lib/utils/indent-common.js:314:36)
    at EventEmitter.VElement (/home/cheeze/repos/test-app/node_modules/eslint-plugin-vue/lib/utils/indent-common.js:971:9)
    at EventEmitter.emit (node:events:402:35)
    at NodeEventGenerator.applySelector (/home/cheeze/repos/test-app/node_modules/vue-eslint-parser/index.js:3826:26)
    at NodeEventGenerator.applySelectors (/home/cheeze/repos/test-app/node_modules/vue-eslint-parser/index.js:3840:22)
    at NodeEventGenerator.enterNode (/home/cheeze/repos/test-app/node_modules/vue-eslint-parser/index.js:3848:14)
    at traverse (/home/cheeze/repos/test-app/node_modules/vue-eslint-parser/index.js:117:13)
    at traverse (/home/cheeze/repos/test-app/node_modules/vue-eslint-parser/index.js:124:21)
    at traverseNodes (/home/cheeze/repos/test-app/node_modules/vue-eslint-parser/index.js:135:5)

Repository to reproduce this issue

https://github.com/cheeze2000/eslint-vue-error
To reproduce the error, npm install and npm run lint.

@cheeze2000
Copy link
Author

A more minimal App.vue:

<template>
	<textarea>
</template>

However, changing the <textarea> to other tags like <p> does not throw any error.

@ota-meshi ota-meshi added the bug label Jan 5, 2022
@ota-meshi
Copy link
Member

Thank you for posting this issue and providing repository to reproduce the 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