chalk/supports-color

SyntaxError in index.js #146

tryptophane posted onGitHub

In our project, suppport-color gets installed as a dependency of lint-staged.

lint-staged: 13.1.0 support-color: 9.3.0 node: 12.22.3 (old, I know...)

We now get this error message when performing lint-staged:

file:///<my-project>/frontend/node_modules/lint-staged/node_modules/supports-color/index.js:6
function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
                                              ^

SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)

This seems to be caused by commit b3d6534a81085d61dc790b6bde20df2c18e64a57 (Improve Deno compatibility (#142))

function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {

We now have to lock supports-color to version 9.2.2 in package-lock.json to be able to perform lint-staged.


node: 12.22.3 (old, I know...)

12 isn't in maintenance mode anymore, it's indeed pretty old at this point. We tend to keep the features we support more or less in line with the Node LTS schedule. Currently the oldest version in maintenance mode is Node 14.

Not sure how I feel about the fix to be honest. A major probably would have been necessary but I'm also a fan of version pinning anyway, just as a rule.

posted by Qix- over 2 years ago

12 isn't in maintenance mode anymore, it's indeed pretty old at this point. We tend to keep the features we support more or less in line with the Node LTS schedule. Currently the oldest version in maintenance mode is Node 14.

In my company we are really slow when it comes up to update major versions of things like node or java, it's a pity. But it's work in progress.

Thanks for having it fixed so quickly nonetheless 👍

posted by tryptophane over 2 years ago

Fund this Issue

$0.00
Funded

Pull requests