forked from vercel/turborepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eslint): support turbo.json workspace configs (vercel#3846)
Support turbo.json workspace configs. Still to do: - [x] Support workspace specific linting There exists one edge case here, if a user forgets to add an "extend" to workspace config, we _can_ treat it as root. I punted on this one for now since it's not this packages domain to solve that (at the moment)
- Loading branch information
Showing
44 changed files
with
805 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/eslint-plugin-turbo/__tests__/fixtures/configs/single/turbo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"globalEnv":[ | ||
"NEW_STYLE_GLOBAL_ENV_KEY", | ||
"$NEW_STYLE_GLOBAL_ENV_KEY" | ||
], | ||
"globalDependencies":[ | ||
"$GLOBAL_ENV_KEY" | ||
], | ||
"pipeline":{ | ||
"test":{ | ||
"outputs":[ | ||
"coverage/**" | ||
], | ||
"dependsOn":[ | ||
"^build" | ||
] | ||
}, | ||
"lint":{ | ||
"outputs":[] | ||
}, | ||
"dev":{ | ||
"cache":false | ||
}, | ||
"build":{ | ||
"outputs":[ | ||
"dist/**/*", | ||
".next/**/*" | ||
], | ||
"env":[ | ||
"NEW_STYLE_ENV_KEY" | ||
], | ||
"dependsOn":[ | ||
"^build", | ||
"$TASK_ENV_KEY", | ||
"$ANOTHER_ENV_KEY" | ||
] | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/eslint-plugin-turbo/__tests__/fixtures/workspace-configs/apps/docs/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default function docs() { | ||
if (process.env.ENV_1 === undefined) { | ||
return 'does not exist'; | ||
} | ||
return 'exists' | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/eslint-plugin-turbo/__tests__/fixtures/workspace-configs/apps/docs/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "docs", | ||
"version": "1.0.0" | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/eslint-plugin-turbo/__tests__/fixtures/workspace-configs/apps/web/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default function web() { | ||
if (!process.env.ENV_2) { | ||
return 'bar'; | ||
} | ||
return 'foo' | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/eslint-plugin-turbo/__tests__/fixtures/workspace-configs/apps/web/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "web", | ||
"version": "1.0.0" | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/eslint-plugin-turbo/__tests__/fixtures/workspace-configs/apps/web/turbo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"extends": ["//"], | ||
"pipeline": { | ||
"build": { | ||
"env": ["ENV_2"] | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/eslint-plugin-turbo/__tests__/fixtures/workspace-configs/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"private": true, | ||
"workspaces": [ | ||
"apps/*", | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"build": "turbo run build" | ||
}, | ||
"devDependencies": { | ||
"turbo": "latest" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/eslint-plugin-turbo/__tests__/fixtures/workspace-configs/packages/ui/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default function foo() { | ||
if (!process.env.IS_SERVER) { | ||
return 'bar'; | ||
} | ||
return 'foo' | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/eslint-plugin-turbo/__tests__/fixtures/workspace-configs/packages/ui/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "ui", | ||
"version": "1.0.0" | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/eslint-plugin-turbo/__tests__/fixtures/workspace-configs/packages/ui/turbo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"extends": ["//"], | ||
"pipeline": { | ||
"build": { | ||
"env": ["IS_SERVER"] | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/eslint-plugin-turbo/__tests__/fixtures/workspace-configs/turbo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"globalEnv": ["CI"], | ||
"pipeline": { | ||
"build": { | ||
"env": ["ENV_1"] | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
packages/eslint-plugin-turbo/__tests__/fixtures/workspace/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
packages/eslint-plugin-turbo/__tests__/lib/findTurboConfig.test.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.