Repository: deno
Issue: [feature request] Support extending Deno configs
Labels: suggestion,workspaces

This is a feature request to add an `extends`-like option to deno.json [like tsconfig.json has](https://www.typescriptlang.org/tsconfig#extends). Eg, consider a shared common config, deno-base.json:

```jsonc
// deno-base.json
{
  "compilerOptions": {
    "noImplicitOverride": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "useUnknownInCatchVariables": true
  }
}
```

The common config could be mixed into a specific usage to avoid repeating all the common settings:

```jsonc
//  subproject/deno.json
{
  "extends": "../deno-base.jsonc",
  "compilerOptions": {
    // All the options set in deno-base.json apply here.
    "exactOptionalPropertyTypes": true
  }
}
```

## Example use case

I have multi-Deno config project where each project has its own deno.json:

```
polyrepo
  deno.json
  sub-a
    deno.json
  sub-b
    deno.json
```

Each config has a lot of overlap and I think I could share some of it if a TypeScript-like `extends` option was supported.

```jsonc
// Example polyrepo root config.
{
  // https://deno.land/manual@main/typescript/configuration
  "compilerOptions": {
    "exactOptionalPropertyTypes": true,
    "noImplicitOverride": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "useUnknownInCatchVariables": true,
    "lib": ["dom", "deno.ns"]
  },
  "fmt": {
    "files": {
      "exclude": ["dist", "mem/dist", "linear-text", "nature-elsewhere"]
    },
    "options": { "semiColons": false, "singleQuote": true }
  },
  "imports": {
    "@/atlas-pack": "./atlas-pack/mod.ts",
    "@/green-field": "./demos/green-field/mod.ts",
    "@/mem": "./mem/mod.ts",
    "@/nttt": "./nttt/mod.ts",
    "@/ooz": "./ooz/mod.ts",
    "@/solitaire": "./solitaire/mod.ts",
    "@/super-patience": "./super-patience/mod.ts",
    "@/void": "./void/mod.ts",
    "std/": "https://deno.land/std@0.179.0/"
  },
  "lint": {
    "files": {
      "exclude": ["dist", "mem/dist", "linear-text", "nature-elsewhere"]
    },
    "rules": {
      "exclude": ["no-empty-interface", "no-inferrable-types", "no-namespace"]
    }
  },
  "lock": false,
  "test": {
    "files": {
      "exclude": ["dist", "mem/dist", "linear-text", "nature-elsewhere"]
    }
  }
}
```

```
// Example submodule config.
{
  // https://deno.land/manual@main/typescript/configuration
  "compilerOptions": {
    "exactOptionalPropertyTypes": true,
    "noImplicitOverride": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "useUnknownInCatchVariables": true,
    "lib": ["dom", "deno.ns"]
  },
  "fmt": {
    "files": { "exclude": ["dist"] },
    "options": { "semiColons": false, "singleQuote": true }
  },
  "imports": {
    "@/atlas-pack": "./mod.ts",
    "@/ooz": "https://deno.land/x/ooz@v0.0.13/mod.ts",
    "std/": "https://deno.land/std@0.179.0/"
  },
  "lint": {
    "files": { "exclude": ["dist"] },
    "rules": {
      "exclude": ["no-empty-interface", "no-inferrable-types", "no-namespace"]
    }
  },
  "lock": false,
  "test": { "files": { "exclude": ["dist"] } }
}
```

I feel it's hard to share the config well but maybe a good start would be deep merging `compilerOptions`, `fmt.options`, `lint.rules`, and `lock`.

## References

Some loosely related references:
- https://www.typescriptlang.org/tsconfig#extends
- https://github.com/denoland/deno/issues/12763
- https://github.com/denoland/deno/issues/15300
- https://github.com/denoland/deno/issues/4275
- https://github.com/denoland/vscode_deno/issues/501
- https://github.com/denoland/vscode_deno/blob/main/docs/workspaceFolders.md#mixed-deno-projects