这是indexloc提供的服务,不要输入任何密码
Skip to content

feat(turbo.json): allow for trailing commas #10537

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

Conversation

chris-olszewski
Copy link
Member

Description

Fixes #10499

Testing Instructions

[0 olszewski@macbookpro] /tmp/trailing $ turbo build
turbo 2.5.4-canary.0

turbo_json_parse_error

  × Failed to parse turbo.json.
  ╰─▶   × Expected a property but instead found '}'.
          ╭─[turbo.json:9:5]
        8 │       "outputs": [".next/**", "!.next/cache/**"],
        9 │     },
          ·     ─
       10 │     "lint": {
          ╰────

[1 olszewski@macbookpro] /tmp/trailing $ turbo_dev --skip-infer build
turbo 2.5.4

• Packages in scope: @repo/eslint-config, @repo/typescript-config, @repo/ui, docs, web
• Running build in 5 packages
• Remote caching disabled

@chris-olszewski chris-olszewski requested a review from a team as a code owner June 2, 2025 17:30
@chris-olszewski chris-olszewski requested a review from tknickman June 2, 2025 17:30
Copy link

vercel bot commented Jun 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 6:11pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 6:11pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 6:11pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 6:11pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 6:11pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 6:11pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 6:11pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 6:11pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 6:11pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
turbo-site ⬜️ Skipped (Inspect) Jun 2, 2025 6:11pm

@@ -1,5 +1,5 @@
{
"$schema": "https://turborepo.com/schema.json",,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For whatever reason, double , with trailing commas really creates a wild output that isn't useful when snapshot. The error could be better, but ITG as the first error still highlights the double ,,

turbo_json_parse_error                                                                                                                                                        
                                                                                                                                                                              
  × Failed to parse turbo.json.                                                                                                                                               
  ├─▶   × expected `}` but instead found `,`                                                                                                                                  
  │      ╭─[turbo.json:2:50]                                                                                                                                                  
  │    1 │ {                                                                                                                                                                  
  │    2 │   "$schema": "https://turborepo.com/schema.json",,                                                                                                                 
  │      ·                                                  ─                                                                                                                 
  │    3 │   "ui": "tui",                                                                                                                                                     
  │      ╰────                                                                                                                                                                
  ├─▶   × End of file expected                                                                                                                                                
  │      ╭─[turbo.json:3:3]                                                                                                                                                   
  │    2 │   "$schema": "https://turborepo.com/schema.json",,                                                                                                                 
  │    3 │   "ui": "tui",                                                                                                                                                     
  │      ·   ────                                                                                                                                                             
  │    4 │   "tasks": {                                                                                                                                                       
  │      ╰────                                                                                                                                                                
  ├─▶   × End of file expected                                                                                                                                                
  │      ╭─[turbo.json:3:7]
  │    2 │   "$schema": "https://turborepo.com/schema.json",,
  │    3 │   "ui": "tui",
  │      ·       ─
  │    4 │   "tasks": {
  │      ╰────
  ├─▶   × End of file expected
  │      ╭─[turbo.json:3:9]
  │    2 │   "$schema": "https://turborepo.com/schema.json",,
  │    3 │   "ui": "tui",
  │      ·         ─────
  │    4 │   "tasks": {
  │      ╰────
  ├─▶   × End of file expected
  │      ╭─[turbo.json:3:14]
  │    2 │   "$schema": "https://turborepo.com/schema.json",,
  │    3 │   "ui": "tui",
  │      ·              ─
  │    4 │   "tasks": {
  │      ╰────
  ├─▶   × End of file expected
  │      ╭─[turbo.json:4:3]
  │    3 │   "ui": "tui",
  │    4 │   "tasks": {
  │      ·   ───────
  │    5 │     "build": {
  │      ╰────
  ├─▶   × End of file expected
  │      ╭─[turbo.json:4:10]
  │    3 │   "ui": "tui",
  │    4 │   "tasks": {
  │      ·          ─
  │    5 │     "build": {
  │      ╰────
  ├─▶   × End of file expected
  │       ╭─[turbo.json:4:12]
  │     3 │       "ui": "tui",
  │     4 │ ╭─▶   "tasks": {
  │     5 │ │       "build": {
  │     6 │ │         "dependsOn": ["^build"],
  │     7 │ │         "inputs": ["$TURBO_DEFAULT$", ".env*"],
  │     8 │ │         "outputs": [".next/**", "!.next/cache/**"],
  │     9 │ │       },
  │    10 │ │       "lint": {
  │    11 │ │         "dependsOn": ["^lint"]
  │    12 │ │       },
  │    13 │ │       "check-types": {
  │    14 │ │         "dependsOn": ["^check-types"]
  │    15 │ │       },
  │    16 │ │       "dev": {
  │    17 │ │         "cache": false,
  │    18 │ │         "persistent": true
  │    19 │ │       }
  │    20 │ ╰─▶   }
  │    21 │     }
  │       ╰────
  ├─▶   × End of file expected
  │       ╭─[turbo.json:21:1]
  │    20 │   }
  │    21 │ }
  │       · ─
  │       ╰────
  ╰─▶   × turbo.json has an incorrect type, expected an object, but received an array.

@chris-olszewski chris-olszewski merged commit ad9c6c3 into main Jun 2, 2025
40 checks passed
@chris-olszewski chris-olszewski deleted the chrisolszewski/turbo-4729-turbojsonc-does-not-play-well-with-prettier branch June 2, 2025 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

turbo.jsonc does not play well with prettier
2 participants