Skip to content

issue with vue files without templates: TypeError: Cannot read property 'range' of null #23

@simllll

Description

@simllll

Hy all,
thanks for this eslint plugin!
We just discovered some issue with vue files without a in it.. e.g. we extend some components, but only extend the script or the style part, and want to keep the template from the extending component. This works fine with vue, but this plugins throws an error of "TypeError: Cannot read property 'range' of null".

Backtrace:

 TypeError: Cannot read property 'range' of null Occurred while linting /home/simon/Dev/hokify/hokify-dashboard/src/components/LineChart.vue:2 at Object.insertTextBefore (/home/simon/Dev/hokify/hokify-dashboard/node_modules/eslint/lib/linter/rule-fixer.js:72:55) at Object.fix (/home/simon/Dev/hokify/hokify-dashboard/node_modules/eslint-plugin-vue-scoped-css/dist/rules/require-scoped.js:39:42) at normalizeFixes (/home/simon/Dev/hokify/hokify-dashboard/node_modules/eslint/lib/linter/report-translator.js:178:28) at /home/simon/Dev/hokify/hokify-dashboard/node_modules/eslint/lib/linter/report-translator.js:205:18 at Array.map (<anonymous>) at mapSuggestions (/home/simon/Dev/hokify/hokify-dashboard/node_modules/eslint/lib/linter/report-translator.js:199:31) at /home/simon/Dev/hokify/hokify-dashboard/node_modules/eslint/lib/linter/report-translator.js:344:55 at Object.report (/home/simon/Dev/hokify/hokify-dashboard/node_modules/eslint/lib/linter/linter.js:905:41) at CommentDirectivesReporter.report (/home/simon/Dev/hokify/hokify-dashboard/node_modules/eslint-plugin-vue-scoped-css/dist/styles/context/comment-directive/index.js:154:26) at report (/home/simon/Dev/hokify/hokify-dashboard/node_modules/eslint-plugin-vue-scoped-css/dist/rules/require-scoped.js:30:22) 

How to reproduce:
Create a a.vue file, with some random content:

<template>hy</template> <script> export default {  }</script> <style></style>

and now another one called b.vue, with following content:

<script> import a from './a.vue'; export default { extends: a }</script> <style>.html { color: green; }</style>

the second file will throw this eslint error I'm referring to.

Thanks a lot,
Simon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions