TypeError: Cannot read property 'stringify' of undefined (8.3.0 -> 8.4.16)
See original GitHub issueI 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:
- Created a year ago
- Comments:11 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
to8.4.16
. So I can reproduce it simply runningnpm update postcss
and then running stylelint. So I guess it is regression in postcss, not in stylelint.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:
.source.syntax.stringify
to some custom analog ofdocStringify
Document
frompostcss-syntax
and avoid conversation. But I afraid it will break AST normalization fix.