`nodeVersion: false` doesn't disable the related rules
XhmikosR opened this issue · 3 comments
C:\Users\xmr\Desktop\foo>node -v && npm -v && ver
v14.17.5
6.14.14
Microsoft Windows [Version 10.0.19043.1165]
C:\Users\xmr\Desktop\foo>npm ls xo
foo@1.0.0 C:\Users\xmr\Desktop\foo
`-- xo@0.44.0
I was trying to disable the following two rules:
- "node/no-unsupported-features/es-builtins"
- "node/no-unsupported-features/es-syntax"
but it doesn't have any effect. So then I saw that there's the nodeVersion
option that could control this. I tried setting it to false
but it doesn't work either.
A quick patch would be to change
Line 205 in bc6e05d
- ...(enginesOptions && enginesOptions.node && semver.validRange(enginesOptions.node) ? {nodeVersion: enginesOptions.node} : {}),
+ ...(xoOptions.nodeVersion !== false && enginesOptions && enginesOptions.node && semver.validRange(enginesOptions.node) ? {nodeVersion: enginesOptions.node} : {}),
But shouldn't it be possible to override the related rules?
A quick patch would be to change
Pull request welcome.
I can make a PR but I'm still not sure if it's the proper solution since IMHO it should be possible to override those rules only without overriding nodeVersion
.
But shouldn't it be possible to override the related rules?
Ideally, yes, but it's complicated. Rule overrides can come from your package.json, but it can also come from a shareable config, and we override before all the config is resolved, so we cannot reliably check whether it's already set.
Lines 309 to 313 in bc6e05d