Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2021-11-04 20:21:00 +0300
committerGar <gar+gh@danger.computer>2021-11-05 00:45:18 +0300
commit225645420cf3d13bc0b0d591f7f7bf21a9c24e47 (patch)
tree107797bef3206793cda93d7dad97f3ab54ef3cd8 /lib/workspaces
parentde45f90eebbf51205748ed3f09fbeab6cc000b3e (diff)
chore: update to latest eslint and linting rules
This brings us in line with the rest of the linting rules we are wanting to use on the npm cli repos. There were several hundred over-length lines and instead of editing them all by hand I piped the failing file through `prettier` and back through `eslint` just to save some time and energy. This means there may be some quirks in the linting those files have, but we can fix those if we see them and they bother us. Other than that there were about 50 lines that are legitimately over-length, all are now explicitly overridden. Many are tests that could be snapshots. PR-URL: https://github.com/npm/cli/pull/3995 Credit: @wraithgar Close: #3995 Reviewed-by: @lukekarrys
Diffstat (limited to 'lib/workspaces')
-rw-r--r--lib/workspaces/get-workspaces.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/workspaces/get-workspaces.js b/lib/workspaces/get-workspaces.js
index 3eb8e4865..a59b5a6c5 100644
--- a/lib/workspaces/get-workspaces.js
+++ b/lib/workspaces/get-workspaces.js
@@ -10,18 +10,21 @@ const getWorkspaces = async (filters, { path, includeWorkspaceRoot }) => {
const pkg = await rpj(resolve(path, 'package.json'))
const workspaces = await mapWorkspaces({ cwd: path, pkg })
let res = new Map()
- if (includeWorkspaceRoot)
+ if (includeWorkspaceRoot) {
res.set(pkg.name, path)
+ }
- if (!filters.length)
+ if (!filters.length) {
res = new Map([...res, ...workspaces])
+ }
for (const filterArg of filters) {
for (const [workspaceName, workspacePath] of workspaces.entries()) {
if (filterArg === workspaceName
|| resolve(path, filterArg) === workspacePath
- || minimatch(workspacePath, `${resolve(path, filterArg)}/*`))
+ || minimatch(workspacePath, `${resolve(path, filterArg)}/*`)) {
res.set(workspaceName, workspacePath)
+ }
}
}