Skip to content

type-module

Check that type: "module" is set appropriately

PropertyValue
Rule IDexports/type-module
Categoryexports
Severity🔴 error
Fixable🔧 Auto-fixable (safe)

What it Checks

Ensures your package.json has "type": "module". Without this, Node.js treats .js files as CommonJS, breaking ESM imports.

Examples

❌ Incorrect

json
{ "name": "my-pkg" }

✅ Correct

json
{ "name": "my-pkg", "type": "module" }

Configuration

Disable this rule:

bash
tspub check --ignore-rules "exports/type-module"

Or in tspub.config.ts:

typescript
export default {
  check: {
    severityOverrides: {
      "exports/type-module": "off",  // or "warning", "error", "info"
    },
  },
};

Released under the MIT License.