question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set environment variable to lint-staged task

See original GitHub issue

Let me say I have the following lint-staged configuration. "lint-staged": { "*.{css,scss}": [ "prettier --fix", "git add" ], "*.{js,vue}": [ "eslint --fix --ext js,vue", "jest --findRelatedTests", "git add" ] },

But, I would like to set extra environment variable for “jest” task. I would like to set the task as NODE_ENV=production BABEL_ENV=node jest --findRelatedTests.

Right now lint-staged will report error that NODE_ENV is not a command.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
okonetcommented, Dec 11, 2017

@oliverzy I see a documentation PR opportunity here.

1reaction
oliverzycommented, Dec 11, 2017

Thanks, The Solution 2 is great. I think this issue can be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linting Staged Git Files with lint-staged
To get started, check that your project already has ESLint, stylelint or Prettier configured (either via a .xxxrc configuration file or a key ......
Read more >
node_modules/lint-staged · master · simmalik / xylem-website
lint -staged uses the debug module internally to log information about staged files, commands being executed, location of binaries, etc. Debug ...
Read more >
javascript - lint-staged not running on precommit
But to make it less confusing for you: it simply queries git for changed files and saves result in $jsfiles variable. You can...
Read more >
flightproject - node_modules - lint-staged - GitLab
Linting commands do not support the shell convention of expanding environment variables. To enable the convention yourself, use a tool like cross-env ....
Read more >
mrm-task-lint-staged
For example, if you have lint script that runs ESLint for js and ts files, the task will add lint-staged rule that runs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found