Skip to content

format-validation

Check that .mjs/.cjs files contain the expected module format

PropertyValue
Rule IDfiles/format-validation
Categoryfiles
Severity🟡 warning
FixableNo

What it Checks

Files with the .mjs extension must contain ESM syntax, and files with .cjs must contain CommonJS syntax. A format mismatch causes runtime errors when Node.js tries to parse the file.

Configuration

Disable this rule:

bash
tspub check --ignore-rules "files/format-validation"

Or in tspub.config.ts:

typescript
export default {
  check: {
    severityOverrides: {
      "files/format-validation": "off",  // or "warning", "error", "info"
    },
  },
};

Released under the MIT License.