fleetlint Policy for a fleet of repositories
v0.9
Getting started

types/strict/node

tsconfig enables the strict compiler flags

Implements types/strict for node.

Severitywarning
Tiers1, 2
Stacksnode
Scopeeach
Kindexpr
Sourcelibrary v0.6.0
Selected byfleetlint-recommended@v0.6.0

Requirement

tsconfig.json sets every flag in params.required to true, directly, through a local base configuration it extends (one level), or by extending @tsconfig/strictest. A tsconfig that extends another package is not checked.

Why

strict alone leaves indexed access, optional properties and switch fallthrough unchecked; these flags close the gaps that produce undefined at run time.

Applies when

file("tsconfig.json") && [json("tsconfig.json")].exists(t, t != null
  && (!has(t.extends) || (type(t.extends) == list ? t.extends : dyn([t.extends]))
    .all(e, e.startsWith(".") || e.startsWith("@tsconfig/strictest"))))

Check

For each item in:

params.required
[json("tsconfig.json")].exists(t,
  (has(t.compilerOptions) && t.compilerOptions != null && item in t.compilerOptions)
    ? t.compilerOptions[item] == true
    : has(t.extends) && (type(t.extends) == list ? t.extends : dyn([t.extends])).exists(e,
        e.startsWith("@tsconfig/strictest")
        || (e.startsWith(".") && [e.endsWith(".json") ? e : e + ".json"].exists(p, file(p)
          && [json(p)].exists(b, b != null && has(b.compilerOptions) && b.compilerOptions != null
            && item in b.compilerOptions && b.compilerOptions[item] == true)))))

Parameters

  • required: [strict noUncheckedIndexedAccess exactOptionalPropertyTypes noImplicitOverride noFallthroughCasesInSwitch]

Fix

Set the missing flags to true under compilerOptions (fleetlint fix --apply merges them into a tsconfig.json without comments).

Agent instruction: Set each reported flag to true in tsconfig.json compilerOptions, run tsc –noEmit and list the errors that appear instead of silencing them.

fleetlint fix can apply this rule’s fix automatically (1 action(s)).

Sources


Generated by fleetlint docs from catalog v0.6.0.