Skip to content

Commit 97fde57

Browse files
hosembaferjaysoo
andauthored
feat(linter): add peerDepsVersionStrategy option to dependency-checks (#33417)
Adds a new peerDepsVersionStrategy option that allows configuring how peer dependencies versions are set when auto-fixing. When set to 'workspace', peer dependencies will use 'workspace:*' instead of the installed or root package version. Defaults to 'installed' to maintain backward compatibility. ## Current Behavior A concrete peer dependency version is being fixed. ## Expected Behavior User can choose between `installed` and `workspace` version strategies. --------- Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
1 parent 0da6921 commit 97fde57

4 files changed

Lines changed: 680 additions & 19 deletions

File tree

astro-docs/src/content/docs/reference/inputs.mdoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ Source file inputs are defined like this:
3535
"{projectRoot}/**/*", // All files in a project
3636
"{workspaceRoot}/.gitignore", // A specific file in the workspace
3737
"{projectRoot}/**/*.ts", // A glob pattern for files
38-
"!{projectRoot}/**/*.spec.ts" // Excluding files matching a glob pattern
39-
]
38+
"!{projectRoot}/**/*.spec.ts", // Excluding files matching a glob pattern
39+
],
4040
}
4141
```
4242

@@ -46,7 +46,7 @@ Alternatively, you can use the object format with the `fileset` property:
4646

4747
```jsonc
4848
{
49-
"inputs": [{ "fileset": "{projectRoot}/**/*" }]
49+
"inputs": [{ "fileset": "{projectRoot}/**/*" }],
5050
}
5151
```
5252

@@ -199,8 +199,8 @@ You can reference named inputs from specific projects or from project dependenci
199199

200200
// Reference a named input from all project dependencies
201201
// Equivalent to: { "input": "production", "dependencies": true }
202-
"^production"
203-
]
202+
"^production",
203+
],
204204
}
205205
```
206206

astro-docs/src/content/docs/technologies/eslint/eslint-plugin/Guides/dependency-checks.mdoc

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export default [
119119
ignoredFiles: ['webpack.config.js', 'eslint.config.mjs'], // list of files that should be skipped for check
120120
includeTransitiveDependencies: true, // collect dependencies transitively from children
121121
useLocalPathsForWorkspaceDependencies: true, // toggle to disable
122+
peerDepsVersionStrategy: 'installed', // or 'workspace' to use workspace:* for peer dependencies
122123
},
123124
],
124125
},
@@ -143,6 +144,7 @@ export default [
143144
"ignoredFiles": ["webpack.config.js", "eslint.config.mjs"], // list of files that should be skipped for check
144145
"includeTransitiveDependencies": true, // collect dependencies transitively from children
145146
"useLocalPathsForWorkspaceDependencies": true, // toggle to disable
147+
"peerDepsVersionStrategy": "installed", // or 'workspace' to use workspace:* for peer dependencies
146148
},
147149
],
148150
}
@@ -153,14 +155,15 @@ export default [
153155

154156
## Options
155157

156-
| Property | Type | Default | Description |
157-
| ------------------------------------- | --------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
158-
| buildTargets | _Array<string>_ | _["build"]_ | List of build target names |
159-
| checkMissingDependencies | _boolean_ | _true_ | Disable to skip checking for missing dependencies |
160-
| checkObsoleteDependencies | _boolean_ | _true_ | Disable to skip checking for unused dependencies |
161-
| checkVersionMismatches | _boolean_ | _true_ | Disable to skip checking if version specifier matches installed version |
162-
| ignoredDependencies | _Array<string>_ | _[]_ | List of dependencies to ignore for checks |
163-
| ignoredFiles | _Array<string>_ | N/A | List of files to ignore when collecting dependencies. The default value will be set based on the selected executor during the generation. |
164-
| includeTransitiveDependencies | _boolean_ | _false_ | Enable to collect dependencies of children projects |
165-
| useLocalPathsForWorkspaceDependencies | _boolean_ | _false_ | Set workspace dependencies as relative file:// paths. Useful for monorepos that link via file:// in package.json files. |
166-
| runtimeHelpers | _Array<string>_ | _[]_ | List of helper packages used by the built output (e.g. `tslib` when using `tsc` and `importHelpers` is set to `true`). The rule already detects some of them in some scenarios, but this option can be used to detect them when it doesn't happen automatically. |
158+
| Property | Type | Default | Description |
159+
| ------------------------------------- | ---------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
160+
| buildTargets | _Array<string>_ | _["build"]_ | List of build target names |
161+
| checkMissingDependencies | _boolean_ | _true_ | Disable to skip checking for missing dependencies |
162+
| checkObsoleteDependencies | _boolean_ | _true_ | Disable to skip checking for unused dependencies |
163+
| checkVersionMismatches | _boolean_ | _true_ | Disable to skip checking if version specifier matches installed version |
164+
| ignoredDependencies | _Array<string>_ | _[]_ | List of dependencies to ignore for checks |
165+
| ignoredFiles | _Array<string>_ | N/A | List of files to ignore when collecting dependencies. The default value will be set based on the selected executor during the generation. |
166+
| includeTransitiveDependencies | _boolean_ | _false_ | Enable to collect dependencies of children projects |
167+
| useLocalPathsForWorkspaceDependencies | _boolean_ | _false_ | Set workspace dependencies as relative file:// paths. Useful for monorepos that link via file:// in package.json files. |
168+
| peerDepsVersionStrategy | _"installed" \| "workspace"_ | _"installed"_ | Strategy for version specifiers in peer dependencies. Use `"installed"` to use the installed version, or `"workspace"` to use `workspace:*` protocol for monorepo packages. |
169+
| runtimeHelpers | _Array<string>_ | _[]_ | List of helper packages used by the built output (e.g. `tslib` when using `tsc` and `importHelpers` is set to `true`). The rule already detects some of them in some scenarios, but this option can be used to detect them when it doesn't happen automatically. |

0 commit comments

Comments
 (0)