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

TypeError: Cannot read property 'startLine' of undefined (v0.13.0) #158

Closed
viceice opened this issue Jan 26, 2021 · 2 comments · Fixed by #168
Closed

TypeError: Cannot read property 'startLine' of undefined (v0.13.0) #158

viceice opened this issue Jan 26, 2021 · 2 comments · Fixed by #168

Comments

@viceice
Copy link
Contributor

viceice commented Jan 26, 2021

I get the following error if i try to update to newest version


$ prettier "{**/*,*}.*" -u --list-different
--
1183 | [error] dir\file.xml: TypeError: Cannot read property 'startLine' of undefined
1184 | [error]     at Object.element (C:\drone\src\node_modules\@prettier\plugin-xml\src\printer.js:336:34)
1185 | [error]     at Object.genericPrint [as print] (C:\drone\src\node_modules\@prettier\plugin-xml\src\printer.js:412:30)
1186 | [error]     at callPluginPrintFunction (C:\drone\src\node_modules\prettier\index.js:14718:18)
1187 | [error]     at C:\drone\src\node_modules\prettier\index.js:14649:47
1188 | [error]     at Object.printComments (C:\drone\src\node_modules\prettier\index.js:14305:19)
1189 | [error]     at printGenerically (C:\drone\src\node_modules\prettier\index.js:14649:22)
1190 | [error]     at FastPath.call (C:\drone\src\node_modules\prettier\index.js:14441:20)
1191 | [error]     at C:\drone\src\node_modules\@prettier\plugin-xml\src\printer.js:308:27
1192 | [error]     at Array.map (<anonymous>)
1193 | [error]     at Object.element (C:\drone\src\node_modules\@prettier\plugin-xml\src\printer.js:304:19)


dir\file.xml

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<Event>
    <Process id="XXX.Notification">

    </Process>
    <!--<Process id="XXX.Notification.Tmpl" >
        <Condition>[v:NType] == 'Tmpl'</Condition>
    </Process>-->
</Event>
@lboehm
Copy link

lboehm commented Jan 30, 2021

+1 I've got the same error. In my case this file content leads to the error:

<mvc:View controllerName="demo.controller.App" xmlns:html="http://www.w3.org/1999/xhtml" 
xmlns:mvc="sap.ui.core.mvc" 
displayBlock="true"
	xmlns="sap.m">
	<App id="app">
	</App>
</mvc:View>

@Tarrowren
Copy link

<!-- this is ok -->
<a>
  <b></b>
</a>

<!-- add line feed or space throws the error-->
<a>
  <b> </b>
</a>

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

Successfully merging a pull request may close this issue.

3 participants