-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(eslint-plugin): add new configuration style #2041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(eslint-plugin): add new configuration style #2041
Conversation
@iduuck is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
const envVarSet = new Set( | ||
allEnvVars.map((envVar) => envVar.slice(1, envVar.length)) | ||
allEnvVars.map((envVar) => | ||
envVar.startsWith("$") ? envVar.slice(1, envVar.length) : envVar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to clean $
from vars in env
or globalEnv
(because an env name with a leading $
could be a valid env var and we want to respect that). So instead of cleaning here, let's remove this altogether and move the cleaning to findDependsOnEnvVars
since this will only be called for dependsOn
or globalDependencies
. Then we can leave env
and globalEnv
as is.
@@ -9,6 +9,7 @@ const ruleTester = new RuleTester({ | |||
const getTestTurboConfig = () => { | |||
return { | |||
$schema: "./docs/public/schema.json", | |||
globalEnv: ["NEW_STYLE_GLOBAL_ENV_KEY"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a test case where we have an env var that is prefixed with $
here and in env
below.
For example,
globalEnv: ["NEW_STYLE_GLOBAL_ENV_KEY", "$NEW_STYLE_GLOBAL_ENV_KEY"],
And then this should pass:
const val = process.env["$NEW_STYLE_GLOBAL_ENV_KEY"];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. Didn't think of this :)
Thanks for the contribution @iduuck! A few quick comments, but overall looks 🔥. Thanks for being ahead of the game 😄 |
@tknickman Fixed this and implemented the missing $-prefixed environment variables. Thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, ty!
As I saw a new version popping up through my renovate integration, I updated. Though, linting is failing, since we are using the
eslint-plugin-turbo
plugin, and this is not yet updated to aim at the new configuration style.This PR aims to fix this.