Rules

Updated Jul 27, 2026

`df12/complex-conditional`

Purpose: keep branch predicates readable by forcing complex decisions into named helpers or guard clauses.

Scope and behaviour: the rule checks branch predicates and reports expressions with more logical operators than the configured threshold. It counts && and ||. Ternary predicates are counted by default. Nullish coalescing is counted only when includeNullishCoalescing is enabled.

Configuration:

{
  "df12/complex-conditional": [
    "error",
    {
      "maxLogicalOperators": 1,
      "includeTernary": true,
      "includeNullishCoalescing": false
    }
  ]
}

What is allowed:

if (isReady && hasAccess) {
  runTask();
}

What is denied:

if (isReady && hasAccess && isFresh) {
  runTask();
}

How to fix: extract the predicate or split the condition into guard clauses.

if (canRunTask(input)) {
  runTask();
}

`df12/require-module-jsdoc`

Purpose: make every linted source file state its module role at the top of the file.

Scope and behaviour: the rule checks JavaScript and TypeScript files included in the Oxlint run. Each file must start with a JSDoc block containing @file.

Configuration:

{
  "df12/require-module-jsdoc": "error"
}

What is allowed:

/** @file Utilities for repository lint configuration. */

export const value = 1;

What is denied:

export const value = 1;

How to fix: add a file-level JSDoc block before imports and declarations.

`df12/require-public-jsdoc`

Purpose: make exported functions usable from documentation and generated API references without reading their implementations.

Scope and behaviour: the rule checks exported function declarations, default-exported functions, exported function expressions, and re-exported local functions. Public JSDoc must include a usage-oriented description, @param entries for named parameters, @returns when a value is returned, and @throws or @rejects when errors can escape.

Configuration:

{
  "df12/require-public-jsdoc": "error"
}

What is allowed:

/**
 * Formats a rule identifier for display.
 *
 * @param name Rule name without the namespace.
 * @returns A namespaced rule identifier.
 */
export function ruleId(name: string): string {
  return `df12/${name}`;
}

What is denied:

export function ruleId(name: string): string {
  return `df12/${name}`;
}

How to fix: add a complete JSDoc to the exported function, including tags for each parameter and returned or thrown values.

`df12/require-private-jsdoc`

Purpose: make private top-level helpers scannable without requiring full public API documentation.

Scope and behaviour: the rule checks private top-level function declarations and private top-level function variables. Their JSDoc must be one concise summary line.

Configuration:

{
  "df12/require-private-jsdoc": "error"
}

What is allowed:

/** Normalizes one rule name. */
function normalizeRuleName(name: string): string {
  return name.trim();
}

What is denied:

function normalizeRuleName(name: string): string {
  return name.trim();
}

How to fix: add a short one-line JSDoc summary, or export the function and write the complete public JSDoc contract.