question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'stringify' of undefined (8.3.0 -> 8.4.16)

See original GitHub issue

I faced an issue with upgrading my Nx codebase (React+StyledComponents) to the latrst version. The change I noticed is that version goes up 8.3.0 -> 8.4.16 I do not have working small reproduction, if you think you will need it can you explain what sample will satisfy your needs (complexity)

My assumption here is that now this module cannot handle empty files or files without styled components

 $) stylelint "**/*.{ts,tsx}"

TypeError: Cannot read property 'stringify' of undefined
    at Function.stringify (D:\sources\rmboa\node_modules\postcss-syntax\stringify.js:8:38)
    at MapGenerator.generate (D:\sources\rmboa\node_modules\stylelint\node_modules\postcss\lib\map-generator.js:323:12)
    at LazyResult.stringify (D:\sources\rmboa\node_modules\stylelint\node_modules\postcss\lib\lazy-result.js:277:20)
    at LazyResult.runAsync (D:\sources\rmboa\node_modules\stylelint\node_modules\postcss\lib\lazy-result.js:443:17)
    at LazyResult.async (D:\sources\rmboa\node_modules\stylelint\node_modules\postcss\lib\lazy-result.js:221:30)
    at LazyResult.then (D:\sources\rmboa\node_modules\stylelint\node_modules\postcss\lib\lazy-result.js:206:17)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
omjokinecommented, Aug 15, 2022

I have this same issue. Unfortunately I don’t have very simple piece of code to reproduce this issue, but got the same stack trace as OP had.

This happened when updated postcss from 8.4.14 to 8.4.16. So I can reproduce it simply running npm update postcss and then running stylelint. So I guess it is regression in postcss, not in stylelint.

0reactions
aicommented, Aug 17, 2022

Seems like postcss-syntax is hack the AST.

We can’t just remove node.type === 'root' because it is fixed another bug.

Here are my suggestions:

  1. Fix Stylelint and set .source.syntax.stringify to some custom analog of docStringify
  2. Find a way to detect Document from postcss-syntax and avoid conversation. But I afraid it will break AST normalization fix.
Read more comments on GitHub >

github_iconTop Results From Across the Web

[stylelint] TypeError: Cannot read property 'stringify' of null #614
When I added linaria/stylelint-config to .stylelintrc.js according to the document, I got the following error. $ npx stylelint src/index.tsx -- ...
Read more >
JSON - Uncaught TypeError: Cannot read property of undefined
I want take some JSON values and make variable from them, but when I do it I get an error. In first stage...
Read more >
cannot read properties of undefined (reading 'type') nestjs
When i try to leftJoin and load all products of a category I get error: TypeError: Cannot read properties of undefined (reading 'joinColumns')....
Read more >
StylelintでCSS-in-JSをlintする時にハマったこと - Zenn
TypeError : Cannot read properties of undefined (reading 'stringify') at Function.stringify ...
Read more >
Resolving the JavaScript Promise Error "TypeError: Cannot ...
TypeError - Cannot read property 'then' of undefined is thrown when the caller is expecting a Promise to be returned and instead receives ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found