-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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(packages): eslint-plugin-turbo #1620
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
93f70b3
to
9409e92
Compare
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.
First bit.
packages/eslint-plugin-turbo/__tests__/lib/env-var-dependencies.test.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin-turbo/docs/rules/no-uncached-env-vars.md
Outdated
Show resolved
Hide resolved
{ | ||
"pipeline": { | ||
"build": { | ||
"dependsOn": ["^build", "$MY_API_TOKEN"], |
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.
Can we actually detect package vs. task vs. global?
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.
I did spend some time thinking about this, and I don't believe we could reliably infer this (without actually running the tasks)
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.
I made the comment because the correct
patterns were in different locations and a tiny bit confusing. I don't think there is anything wrong with it; but it did make me pause.
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.
Small suggestion that may or may not conform to the existing workflow in the repo: It would be helpful to split the work that creates the utils package into a separate commit.
Other than that a meager review and mostly a bunch of questions! The meat of the implementation and tests look good to me other than @nathanhammond's suggestions!
function findDependsOnEnvVars({ | ||
dependencies, | ||
}: { | ||
dependencies?: Array<string>; |
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.
TS q... iiuc ?
means that the argument is optional. Could we get by with assigning a default value to the arg (and therefore prevent the if
check in the function body? (not a blocker, just curious!
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.
This is a transitive-to-user-input ?
, so at some point it'll have to be optional. We can choose where we put the if statement, basically.
9409e92
to
5a77144
Compare
5a77144
to
a404d47
Compare
Addressed everything but the naming for now (still thinking about this one). Thanks for the reviews! |
a404d47
to
253511d
Compare
Name updated ( |
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.
Tiny things!
```json | ||
{ | ||
"rules": { | ||
"turbo/rule-name": "error" |
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.
"turbo/rule-name": "error" | |
"turbo/no-undeclared-env-vars": "error" |
{ | ||
"name": "eslint-plugin-turbo", | ||
"version": "0.0.1", | ||
"description": "Static analysis for turbo", |
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.
Do you hold your pinky out when you drink your coffee?
"description": "Static analysis for turbo", | |
"description": "ESLint plugin for Turborepo", |
253511d
to
aa38df5
Compare
eslint-plugin-turbo
Only one rule for now: error when an env var is provided that is not present in the turbo config.
NOTE: I'm building
turbo-utils
right now, because I want to tree shake it. But, I'm still exploring options for this with a pure internal library.Fixes TURBO-201