Skip to content
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

[eslint-plugin-turbo] not picking up Package Configurations #9955

Open
1 task done
bitttttten opened this issue Feb 13, 2025 · 1 comment
Open
1 task done

[eslint-plugin-turbo] not picking up Package Configurations #9955

bitttttten opened this issue Feb 13, 2025 · 1 comment
Labels
kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage

Comments

@bitttttten
Copy link
Contributor

bitttttten commented Feb 13, 2025

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Expected behavior

We have a root turbo.json

// turbo.json
{
  "$schema": "https://turbo.build/schema.json",
  "ui": "tui",
  "globalDependencies": ["**/.env", ".env"],
  "tasks": {
    "build": {
      "dependsOn": ["^build"],
      "env": [
        "CIRCLE_BRANCH",
        "DEBUG",
        "ABSOLUTE_PUBLIC_PATH",
        "POSTBUILD_DEBUG",
        "PROJECT_NAME",
        "PLATFORM"
      ]
    },
  }
}

Then another turbo.json that lists

// apps/example/turbo.json
{
  "$schema": "https://turbo.build/schema.json",
  "extends": ["//"],
  "tasks": {
    "build": {
      "env": ["TOKEN"]
    }
  }
}

This line should not fail the linter:

const token = process.env.TOKEN
invariant(token, 'TOKEN is not set')

Actual behavior

The linter complains, even though the TOKEN env var is set in the

To Reproduce

Image

Additional context

No response

@bitttttten bitttttten added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage labels Feb 13, 2025
@Timmy0o0
Copy link

Timmy0o0 commented Feb 17, 2025

I have the same issue. The error can only be resolved by adding the environment variable to globalEnv, but what if this environment variable belongs to a sub-project?

update:
I have found the correct configuration method. The environment variables required for the subproject are specified as follows, where web is the name of the 1subproject.

"tasks": {
    "web#build": {
      "env": [
        "AWS_ACCESS_KEY_ID",
        "AWS_SECRET_ACCESS_KEY",
        "AWS_REGION",
        "AWS_DATABASE_URL",
        "AWS_S3_BUCKET",
        "SES_FROM_EMAIL",
        "DATABASE_URL",
        "DATABASE_URL_LOCAL",
        "NEXTAUTH_SECRET",
        "NEXTAUTH_URL",
        "GITHUB_ID",
        "GITHUB_SECRET",
        "GOOGLE_CLIENT_ID",
        "GOOGLE_CLIENT_SECRET",
        "STRIPE_SECRET_KEY",
        "STRIPE_PUBLISHABLE_KEY",
        "OPENAI_API_KEY"
      ]
    },
  ....
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage
Projects
None yet
Development

No branches or pull requests

2 participants