Skip to content

Commit 59bb1c6

Browse files
authored
feat(core): allow disabling of tsconfig path sorting in format:write and formatFiles() (#28517)
1 parent 768e59e commit 59bb1c6

File tree

9 files changed

+88
-59
lines changed

9 files changed

+88
-59
lines changed

docs/generated/cli/format-check.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`
1717

1818
## Options
1919

20-
| Option | Type | Description |
21-
| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------- |
22-
| `--all` | boolean | Format all projects. |
23-
| `--base` | string | Base of the current branch (usually main). |
24-
| `--exclude` | string | Exclude certain projects from being processed. |
25-
| `--files` | string | Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces. |
26-
| `--head` | string | Latest commit of the current branch (usually HEAD). |
27-
| `--help` | boolean | Show help. |
28-
| `--libs-and-apps` | boolean | Format only libraries and applications files. |
29-
| `--projects` | string | Projects to format (comma/space delimited). |
30-
| `--uncommitted` | boolean | Uncommitted changes. |
31-
| `--untracked` | boolean | Untracked changes. |
32-
| `--version` | boolean | Show version number. |
20+
| Option | Type | Description |
21+
| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
22+
| `--all` | boolean | Format all projects. |
23+
| `--base` | string | Base of the current branch (usually main). |
24+
| `--exclude` | string | Exclude certain projects from being processed. |
25+
| `--files` | string | Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces. |
26+
| `--head` | string | Latest commit of the current branch (usually HEAD). |
27+
| `--help` | boolean | Show help. |
28+
| `--libs-and-apps` | boolean | Format only libraries and applications files. |
29+
| `--projects` | string | Projects to format (comma/space delimited). |
30+
| `--sort-root-tsconfig-paths` | boolean | Ensure the workspace's tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. (Default: `true`) |
31+
| `--uncommitted` | boolean | Uncommitted changes. |
32+
| `--untracked` | boolean | Untracked changes. |
33+
| `--version` | boolean | Show version number. |

docs/generated/cli/format-write.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`
1717

1818
## Options
1919

20-
| Option | Type | Description |
21-
| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------- |
22-
| `--all` | boolean | Format all projects. |
23-
| `--base` | string | Base of the current branch (usually main). |
24-
| `--exclude` | string | Exclude certain projects from being processed. |
25-
| `--files` | string | Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces. |
26-
| `--head` | string | Latest commit of the current branch (usually HEAD). |
27-
| `--help` | boolean | Show help. |
28-
| `--libs-and-apps` | boolean | Format only libraries and applications files. |
29-
| `--projects` | string | Projects to format (comma/space delimited). |
30-
| `--uncommitted` | boolean | Uncommitted changes. |
31-
| `--untracked` | boolean | Untracked changes. |
32-
| `--version` | boolean | Show version number. |
20+
| Option | Type | Description |
21+
| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
22+
| `--all` | boolean | Format all projects. |
23+
| `--base` | string | Base of the current branch (usually main). |
24+
| `--exclude` | string | Exclude certain projects from being processed. |
25+
| `--files` | string | Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces. |
26+
| `--head` | string | Latest commit of the current branch (usually HEAD). |
27+
| `--help` | boolean | Show help. |
28+
| `--libs-and-apps` | boolean | Format only libraries and applications files. |
29+
| `--projects` | string | Projects to format (comma/space delimited). |
30+
| `--sort-root-tsconfig-paths` | boolean | Ensure the workspace's tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. (Default: `true`) |
31+
| `--uncommitted` | boolean | Uncommitted changes. |
32+
| `--untracked` | boolean | Untracked changes. |
33+
| `--version` | boolean | Show version number. |

docs/generated/devkit/formatFiles.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# Function: formatFiles
22

3-
**formatFiles**(`tree`): `Promise`\<`void`\>
3+
**formatFiles**(`tree`, `options?`): `Promise`\<`void`\>
44

55
Formats all the created or updated files using Prettier
66

77
#### Parameters
88

9-
| Name | Type | Description |
10-
| :----- | :------------------------------------ | :------------------- |
11-
| `tree` | [`Tree`](../../devkit/documents/Tree) | the file system tree |
9+
| Name | Type | Description |
10+
| :------------------------------ | :------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
11+
| `tree` | [`Tree`](../../devkit/documents/Tree) | the file system tree |
12+
| `options?` | `Object` | - |
13+
| `options.sortRootTsconfigPaths` | `boolean` | TODO(v21): Stop sorting tsconfig paths by default, paths are now less common/important in Nx workspace setups, and the sorting causes comments to be lost. |
1214

1315
#### Returns
1416

docs/generated/packages/nx/documents/format-check.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`
1717

1818
## Options
1919

20-
| Option | Type | Description |
21-
| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------- |
22-
| `--all` | boolean | Format all projects. |
23-
| `--base` | string | Base of the current branch (usually main). |
24-
| `--exclude` | string | Exclude certain projects from being processed. |
25-
| `--files` | string | Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces. |
26-
| `--head` | string | Latest commit of the current branch (usually HEAD). |
27-
| `--help` | boolean | Show help. |
28-
| `--libs-and-apps` | boolean | Format only libraries and applications files. |
29-
| `--projects` | string | Projects to format (comma/space delimited). |
30-
| `--uncommitted` | boolean | Uncommitted changes. |
31-
| `--untracked` | boolean | Untracked changes. |
32-
| `--version` | boolean | Show version number. |
20+
| Option | Type | Description |
21+
| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
22+
| `--all` | boolean | Format all projects. |
23+
| `--base` | string | Base of the current branch (usually main). |
24+
| `--exclude` | string | Exclude certain projects from being processed. |
25+
| `--files` | string | Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces. |
26+
| `--head` | string | Latest commit of the current branch (usually HEAD). |
27+
| `--help` | boolean | Show help. |
28+
| `--libs-and-apps` | boolean | Format only libraries and applications files. |
29+
| `--projects` | string | Projects to format (comma/space delimited). |
30+
| `--sort-root-tsconfig-paths` | boolean | Ensure the workspace's tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. (Default: `true`) |
31+
| `--uncommitted` | boolean | Uncommitted changes. |
32+
| `--untracked` | boolean | Untracked changes. |
33+
| `--version` | boolean | Show version number. |

0 commit comments

Comments
 (0)