Vscode-eslint: Some eslint plugins crash without NODE_ENV

Created on 29 May 2020  路  8Comments  路  Source: microsoft/vscode-eslint

Currently it's impossible to use vscode-eslint with any plugin that needs NODE_ENV because there's no way to define it.

The ideal solution would be to expose a eslint.nodeEnv setting, or a more generalized eslint.processEnv setting, so that users can define whatever environment variables are needed by their eslint plugins.

Example:

[eslint-import-resolver-babel-module] Error: Using babel-preset-razzle requires that you specify NODE_ENV or BABEL_ENV environment variables. Valid values are "development", "test", and "production". Instead, received: undefined.

This is essentially the same issue as #741, but for some reason, that issue was closed when a platform-dependent workaround was found (which didn't address the underlying root cause). Clearly, defining NODE_ENV for the entire VS Code process is overkill and not really a viable solution, as doing so is likely to cause other problems.

bug help wanted

Most helpful comment

Thanks a lot @mattlubner, I'm using eslint-import-resolver-babel-module also with a custom babel config that requires a custom NODE_ENV, so this feature will greatly improve my workflow :smile:.

@dbaeumer, do you have an ETA for a new version of the extension containing this feature ?

Thanks again for all your work !

All 8 comments

Anyone interested working on a PR for this?

I'm willing to take a stab at it, although I haven't worked with code in a VSCode extension before, or written much TypeScript either (just FYI).

Is this the right place to add environment variables? https://github.com/microsoft/vscode-eslint/blob/master/client/src/extension.ts#L886

Would these be the right places to add a new configuration setting?

PR is submitted, and changes seem to work correctly while running the debugging task! :)

Still waiting on a final PR review + merge. Some attention on this issue would be really appreciated! 馃檹馃槄馃檹

Sorry. Slipped through the cracks. Will have a look.

I merged the PR. Will look into a new version when we ship a new version of VS Code beginning of August.

Thanks a lot @mattlubner, I'm using eslint-import-resolver-babel-module also with a custom babel config that requires a custom NODE_ENV, so this feature will greatly improve my workflow :smile:.

@dbaeumer, do you have an ETA for a new version of the extension containing this feature ?

Thanks again for all your work !

Actually this got delayed due to the security work. I will look into it in September.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

greggman picture greggman  路  7Comments

bacsonvv picture bacsonvv  路  6Comments

kumarharsh picture kumarharsh  路  3Comments

lednhatkhanh picture lednhatkhanh  路  4Comments

MuhammadJamaluddin picture MuhammadJamaluddin  路  4Comments