Skip to content
This documentation is for v14 alpha, the docs for v13 stable are archived.

lint

Lint all versions and ranges and exit with 0 or 1 based on whether all files match your Syncpack configuration file.

Terminal window
# Find all issues in "dependencies" or "devDependencies"
syncpack lint --dependency-types prod,dev
# Only lint issues in "react" specifically
syncpack lint --dependencies react
# Look for issues in dependencies containing "react" in the name
syncpack lint --dependencies '**react**'
# Find issues in scoped packages only
syncpack lint --dependencies '@types/**'
# Find issues everywhere except "peerDependencies"
syncpack lint --dependency-types '!peer'
# Only look for issues where an exact version is used (eg "1.2.3")
syncpack lint --specifier-types exact
# Sort dependencies by how many times they are used
syncpack lint --sort count
# See more examples
syncpack lint --help
# See a short summary of options
syncpack lint -h

* ! { } etc

When passing values to syncpack via the command line, remember to add quotes around values containing special characters so your shell does not interpret them.

--config <file-path>

Section titled “--config ”

syncpack searches the monorepo root directory for a config file which follows its naming convention, but this can be overridden by providing a path to a specific configuration file instead.

The only requirement is that the file must have a file extension and that it is one of .cjs, .cts, .js, .json, .mjs, .mts, .ts, .yaml, or .yml.

syncpack lint --config ./config/syncpack.json

--dependencies <dependency-name-pattern>

Section titled “--dependencies ”

Include dependencies whose name matches the given glob pattern.

To exclude, put a ! at the start of your query.

# Exact match for "react"

syncpack lint --dependencies 'react'

# Substring match for "react"

syncpack lint --dependencies '**react**'

# All dependencies under the AWS SDK scope

syncpack lint --dependencies '@aws-sdk/**'

# Exact match for "react" or "webpack" (2 approaches)

syncpack lint --dependencies 'react' --dependencies 'webpack'
syncpack lint --dependencies '{react,webpack}'

# Substring match for "react" or "webpack" (2 approaches)

syncpack lint --dependencies '**react**' --dependencies '**webpack**'
syncpack lint --dependencies '**{react,webpack}**'

--dependency-types <comma-separated-dependency-type-names>

Section titled “--dependency-types ”

Include dependencies of the given dependency types and/or custom types.

To exclude, put a ! at the start of your query.

# devDependencies only

syncpack lint --dependency-types dev

# dependencies and devDependencies only

syncpack lint --dependency-types dev,prod

# everything except peerDependencies

syncpack lint --dependency-types '!peer'

--log-levels <comma-separated-log-level-names>

Section titled “--log-levels ”

Control how detailed the log output should be

LevelWhat is written to this channel
infoThe standard output which forms syncpack's UI, including lint issues
warnPossible mistakes in your setup, or highlights of known gaps in syncpack
errorFatal exceptions or errors outside the normal running of syncpack
debugExtremely verbose detail on why syncpack assigns each status code
# Turn off logging completely

syncpack lint --log-levels off

# Only show verbose debugging logs

syncpack lint --log-levels debug

# Show everything

syncpack lint --log-levels error,warn,info,debug

Syncpack will print colours and clickable hyperlinks to the terminal using ANSI escape code unless this option is set.

syncpack lint --no-ansi

--show <comma-separated-detail-names>

Section titled “--show ”

Control what information is displayed in terminal output

NameDescription
instancesShow every instance of every dependency
hintsShow a hint alongside dependencies developed in this repo
statusesShow specifically how/why a dependency or instance is valid or invalid
allShorthand to enable all of the above
noneShorthand to disable all of the above
# Only opt into showing status codes

syncpack lint --show statuses

# Show all instances, not just their names

syncpack lint --show instances

# Show highest level of detail

syncpack lint --show all

# Show lowest level of detail

syncpack lint --show none

Change the order in which dependencies are displayed

# Sort by count, in descending order

syncpack lint --sort count

# Sort A-Z by name

syncpack lint --sort name

--source <file-pattern>

Section titled “--source ”

Only run syncpack lint on package.json files matching the provided pattern(s).

Syncpack will look in the following places for glob patterns matching package.json files, in this order of precedence, and stop looking when a match is found:

  1. If --source CLI options are provided, use those.
  2. If source is defined in configuration, use that.
  3. If using npm workspaces or Yarn workspaces, read workspaces from ./package.json.
  4. If using pnpm, read packages from ./pnpm-workspace.yaml.
  5. If using Lerna, read packages from ./lerna.json.
  6. Default to 'package.json' and 'packages/*/package.json'.
# only the root package
syncpack lint --source 'package.json'

# only packages matching a glob

syncpack lint --source 'packages/beta-*'

# multiple values can be provided

syncpack lint --source 'package.json' --source 'packages/beta-*'

--specifier-types <comma-separated-specifier-type-names>

Section titled “--specifier-types ”

Include only instances whose version specifiers are of the given specifier types.

To exclude, put a ! at the start of your query.

# Exact versions only

syncpack lint --show instances --specifier-types exact

# Missing or unsupported versions

syncpack lint --show instances --specifier-types missing,unsupported

# Latest or workspace protocol only

syncpack lint --show instances --specifier-types latest,workspace-protocol

Display a list of CLI options and other help information.

# Display a short summary of commands and options

syncpack lint -h

# Display full help with examples

syncpack lint --help