Skip to content

Resolution

Every rule is matched against the file an import resolves to, not the text of the specifier. The resolve block tells the tools how to resolve, per part of the repository.

resolve:
scopes:
- files: "^packages/web/"
language: typescript
options: { tsconfig: tsconfig.resolve-web.json }
- files: ""
language: typescript
options: { tsconfig: tsconfig.resolve.json }
unresolved: error
ignoreUnresolved: []

A scope sets the language and options for the files it covers. Use several when one tsconfig’s paths don’t fit every package.

Field Meaning
files A regular expression (not a glob) matched against the importing file’s path.
language The language pack, e.g. typescript.
options The language’s options. An unknown key is an error at load.

The first matching scope wins, so put the catch-all files: "" last.

Option Meaning
tsconfig Repo-relative tsconfig whose paths and baseUrl apply. Required.
extensions Tried on an extensionless specifier. Default .ts .tsx .js .jsx .mjs .cjs .json.
conditionNames Package exports conditions. Default import require node default.
mainFields package.json fields tried for a bare package. Default main types.
Kind What it is Governed by
local a file inside the repository imports.allow, deny
external a third-party package imports.external
builtin a runtime builtin, e.g. node:crypto neither

imports.external matches the package name (effect, @scope/name). allow and deny match the resolved path, so to forbid one subpath of a package, match where it resolves.

unresolved defaults to "error", because an unresolved import escapes every rule.

  • ignoreUnresolved — regexes matched against the specifier, for virtual modules or files generated after lint time. Comment each entry.
  • unresolved: "off" — for a first-day adoption spike only.