Skip to content

All Rules

tspub includes 70 rules across 6 categories. Each rule has a severity level, and many support auto-fix.

TIP

Run tspub check --list-rules to see all rules in your terminal.

Legend

BadgeMeaning
🔴 errorFails the check
🟡 warningWarns but doesn't fail
:blue_circle: infoInformational only
🔧 safeAuto-fixable with --fix
⚠️ unsafeAuto-fixable with --fix --unsafe

Exports (28 rules)

RuleDescriptionSeverityFixable
type-moduleCheck that type: "module" is set🔴 error🔧 safe
exports-fieldCheck that exports field exists🔴 error⚠️ unsafe
dot-entryCheck that exports["."] is defined🔴 error⚠️ unsafe
types-orderCheck that types condition comes first🔴 error🔧 safe
import-conditionCheck for import condition🔴 error⚠️ unsafe
file-existsCheck exported files exist on disk🟡 warning
value-invalidCheck export values start with ./🔴 error
default-lastCheck default is last condition key🔴 error🔧 safe
module-before-requireCheck module precedes require🟡 warning🔧 safe
imports-fieldValidate imports field🔴 error
jsx-extensionsCheck JSX extensions in exports🔴 error
format-mismatchCheck ESM/CJS format consistency🟡 warning
module-esm-onlyCheck module points to ESM🟡 warning
fallback-arrayWarn against fallback arrays🟡 warning
types-formatCheck .d.ts/.d.cts format matching🟡 warning
condition-typesCheck conditions have sibling types🟡 warning
no-deprecated-subpathFlag trailing / in export keys🟡 warning
imports-key-invalidCheck imports keys start with #🔴 error
browser-conflictWarn on browser + exports conflict🟡 warning
browser-value-conflictDetect when exports values are remapped by the browser field🟡 warning
file-not-publishedCheck exported files are in files🔴 error
glob-matched-filesValidate wildcard patterns match files🟡 warning
cjs-esmodule-interopCheck CJS __esModule interop issues🟡 warning
cjs-default-exportDetect CJS-only default export:blue_circle: info
types-firstCheck that types is the first condition in every condition map🔴 error🔧 safe
esm-main-no-exportsWarn when main is ESM but exports is missing🟡 warning
module-no-exportsWarn when module field exists but exports is missing🟡 warning
types-not-exportedCheck that types field is also represented in exports conditions🟡 warning

Imports (6 rules)

RuleDescriptionSeverityFixable
default-lastCheck that default is the last key in imports condition maps🔴 error🔧 safe
module-esm-onlyCheck that module condition in imports points to ESM🟡 warning
module-before-requireCheck that module comes before require in imports🟡 warning🔧 safe
fallback-arrayWarn against fallback arrays in imports🟡 warning
glob-matched-filesValidate that wildcard patterns in imports match files🟡 warning
no-deprecated-subpathWarn on trailing / in imports keys (use /* instead)🟡 warning

Types (14 rules)

RuleDescriptionSeverityFixable
tsconfig-existsCheck tsconfig.json exists🟡 warning
declarationCheck declaration generation is enabled:blue_circle: info
strictCheck strict mode is enabled🟡 warning
moduleCheck tsconfig module setting🟡 warning
module-resolutionCheck moduleResolution setting🟡 warning
isolated-modulesCheck isolatedModules is enabled:blue_circle: info
declaration-completenessCheck all exports have .d.ts files🟡 warning
no-any-exportFlag excessive any in declarations🟡 warning
resolutionVerify types resolve in node10/node16/bundler🔴 error
false-cjs-esmDetect format mismatch between declaration files and JS (FalseCJS/FalseESM)🔴 error
false-export-defaultDetect export default in types with module.exports in JS🟡 warning
missing-export-equalsDetect CJS modules whose types lack export =:blue_circle: info
esm-dynamic-onlyDetect when package is only available via dynamic import for ESM🟡 warning
cjs-resolves-esmDetect when CJS require() would resolve to an ESM file🔴 error

Files (10 rules)

RuleDescriptionSeverityFixable
files-fieldCheck files field exists🟡 warning🔧 safe
sensitiveCheck for .env, credentials🔴 error
bin-shebangCheck bin files have shebang🟡 warning
bin-executableCheck bin files have executable permissions🟡 warning
all-files-formatCheck JS file format consistency🟡 warning
format-validationCheck that .mjs/.cjs files contain the expected module format🟡 warning
implicit-index-formatCheck that implicit index.js matches the declared package type🟡 warning
prepublishCheck prepublishOnly script exists🟡 warning🔧 safe
duplicate-depCheck for duplicate dependencies🔴 error
local-dependencyCheck for file: protocol deps🔴 error

Metadata (11 rules)

RuleDescriptionSeverityFixable
licenseCheck license field exists🟡 warning⚠️ unsafe
license-fileCheck LICENSE file exists🟡 warning
repositoryCheck repository field exists:blue_circle: info
repository-formatCheck that repository field has a valid format🟡 warning
enginesCheck engines.node is specified🟡 warning⚠️ unsafe
side-effectsCheck sideEffects field is set🟡 warning
deprecated-fieldsFlag deprecated fields🟡 warning
field-value-typeCheck that common package.json fields have correct value types🔴 error
peer-dep-conflictCheck peer dependency conflicts🟡 warning
use-exports-browserPrefer exports over browser field:blue_circle: info
module-esmCheck that top-level module field points to ESM content🟡 warning

Size (1 rule)

RuleDescriptionSeverityFixable
package-sizeCheck package size is reasonable🟡 warning

Released under the MIT License.