microsoft / just

The task library that just works
https://microsoft.github.io/just
MIT License
1.96k stars 94 forks source link

Pass env variables through to eslint cli #752

Closed sstchur closed 2 months ago

sstchur commented 2 months ago

Overview

ESLint documentation clearly indicates that node ENV variables should be available in custom formatters, and indeed, if I invoke eslint locally like so: npx eslint -f path/to/my/formatters.js

It works! And I can see/accessible the desired ENV variables.

However, in Bohemia, we invoke eslint through just-script's eslintTask, and that task does not pass ENV variables on through. Rather, it creates a mostly empty env object and passes that through. As a result, my customer formatter was not receiving the ENV variable it expected.

This simple PR just modifies the env variable passed through to the eslintTask by spreading ...process.env into it when it is initialized.