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
Fix "TypeError: opts.node.rangeBy is not a function" with PostCSS 8.4.4 #5766
Comments
Could it happen because of the different PostCSS versions at chimera’s AST containing nodes from different PostCSS versions? Can you look |
In our case we have a problem using https://github.com/ismay/stylelint-no-unsupported-browser-features/blob/master/package.json this package has postcss as a dependency |
this is npm ls from this example └─┬ stylelint@14.0.1
└── postcss@8.4.4 and this is from another project (new angular 13 project) (works fine) └─┬ stylelint@14.0.1
├─┬ postcss-safe-parser@6.0.0
│ └── postcss@8.3.6 deduped
└── postcss@8.3.11 |
I'm also seeing this on the |
I've created a reproduction repository, but such a https://github.com/ybiquitous/stylelint-issue-5766/runs/4451383596?check_suite_focus=true#step:6:1 |
@fomenkogregory can you try to update dependencies by running |
thanks! I'll try to clone your repo and see if it will work on my side. Then I will compare lock file and node_modules and to see what's differs. |
In my case I just added PostCSS to my project by |
Also started with a fresh install of |
Thanks for the help. I will try to find solution during this weekend. |
And moreover, you can then uninstall postcss and all works fine for current and all future projects. I wasn't been able to reproduce the issue for any new projects as well. |
Seems to be related to/a duplicate of: #5756 |
Add a custom Vite plugin that generates RTL versions of all built .css files. This causes our Codex build to generate both codex.style.css and codex.style-rtl.css. Pin postcss at v8.3.11 to prevent stylelint from crashing, see stylelint/stylelint#5766 Bug: T295189 Change-Id: I4b7203375b8f8a40dc8c24086544dc7a011e88bf
When will it ship ? |
@Yohandah the solution was not found. Please help in investigation and send PR if you want to fix it sooner. |
Sorry I read too fast I thought a PR was ready. A weird thing happened while I was looking for a fix. I removed |
totally uninstalling postcss & stylelint with their plugins helped me. I Installed postcss at first and then stylelint and have no errors now |
It seems the error only happens when I comment using // instead of /* ? Screenshare.-.2022-02-02.10_57_16.AM.mp4 |
Installing |
I can confirm this. When I removed the |
@ai I'm not so familiar with the source codes from |
@JounQin |
@ai It's still unclear where |
@JounQin The assignment of the rangeBy function is done here https://github.com/postcss/postcss/blob/main/lib/container.js#L415-L423 via Object.setPrototypeOf() However the node that is throwing the error is of type if (node.type === 'atrule') {
Object.setPrototypeOf(node, AtRule.prototype)
} else if (node.type === 'rule') {
Object.setPrototypeOf(node, Rule.prototype)
} else if (node.type === 'decl') {
Object.setPrototypeOf(node, Declaration.prototype)
} else if (node.type === 'comment') {
Object.setPrototypeOf(node, Comment.prototype)
} The function is being called for the root type. @ai could that be the issue? |
@snebjorn exactly! I added the fix postcss/postcss@f289e17 I released a fix in PostCSS 8.4.15. Can we try it? |
Not sure where
Dependency tree
|
@snebjorn sorry, can you try again with PostCSS 8.4.16? It was a small typo and we have not tests for AST migration hack. |
Gentlemen, we have a winner!
|
Thanks for the quick responses. It kept me motivated :) |
hi! so users have to wait stylelint v14.9.2, yep?) update: no, i've just updated postcss to 8.4.16 and it all works *___* thx a lot guys! |
This bug has affected a stylelint plugin I maintain and I'm a little confused by it. My lib has a peerdep on stylelint However, it's still affecting users of my plugin that are on stylelint v13. Would the only way to address this for users of stylelint 13 be to backport a fix to stylelint v13? And is that a feasible solution? Because I'm thinking of just restricting my peerdep range to stylelint v14 just to resolve this for users of my lib, but I want to make sure that I understand exactly what's going on. |
@ismay No, only postcss needs to be upgraded to v8.4.16. |
@ismay I mean it's not required to upgrade to v14, you only need to upgrade the postcss dep on your side. |
Upgraded postcss to fix a type error when running stylelint --fix. See stylelint/stylelint#5766. Fixed the fileglob for CSS files and made simple fixes for stylelint errors. Change-Id: If838a740f97532b9b29ad16fb6aeb5de72ed49d1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/455956 Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
I face that type error again after upgrading to
|
@AndyOGo That error should never occur if you are using the latest PostCSS. Please recheck your dependency tree. |
Edit: Indeed, I'm surprised too. npm ls postcss
└─┬ stylelint@15.0.0
├─┬ @csstools/selector-specificity@2.1.1
│ └── postcss@8.4.21 deduped
├─┬ postcss-safe-parser@6.0.0
│ └── postcss@8.4.21 deduped
└── postcss@8.4.21 FYI: |
What steps are needed to reproduce the bug?
folder structure:
package.json
.stylelintrc.json
styles.scss (empty file)
package.json:
npm i
npm run lint
What Stylelint configuration is needed to reproduce the bug?
How did you run Stylelint?
npx stylelint '**/*.scss'
Which version of Stylelint are you using?
^14.1.0
What did you expect to happen?
I expect stylelint to show list of errors.
What actually happened?
The problem is in this line
Does the bug relate to non-standard syntax?
No
Proposal to fix the bug
Works correctly with exactly 8.3.11 version of postcss.
I compared the code in
warning.js
between these versions of postcss (8.3.11 and 8.4.4), they changed the method name. :(Proposal: change dependencies of stylelint to use exactly 8.3.11 version.
The text was updated successfully, but these errors were encountered: