Skip to content

The :not() pseudo-class is a negation selector — it matches packages that do not match the given selector list. It works like the CSS :not() selector.

Syntax

:not(<selector-list>)

Examples

Exclude by name

Find all packages except react:

Terminal
$ vlt query ':root > :not([name=react])'

Exclude by license

Find packages without an MIT license:

Terminal
$ vlt query ':not([license=MIT])'

Exclude by type

Find all non-registry dependencies:

Terminal
$ vlt query ':not(:type(registry))'

What gets selected

Given this dependency graph:

my-app
├── react@18.2.0 ← license: MIT
├── typescript@5.3.0 ← license: Apache-2.0
└── vite@5.0.0 ← license: MIT

:root > :not([license=MIT]) selects:

my-app
├── react@18.2.0
├── typescript@5.3.0 ✅ license is NOT MIT
└── vite@5.0.0

Combining with other pseudo-classes

Find non-dev dependencies that are outdated:

Terminal
$ vlt query ':not(:dev):outdated'

Find packages that are not private and not workspaces:

Terminal
$ vlt query ':not(:private):not(:workspace)'

See also

  • :is() — forgiving selector list matching
  • :has() — descendant matching