Skip to main content

no-mixed-hook-representations

Disallow both hooks.json and inline hooks in the same Codex config layer.

Rule catalog ID: R012

Targeted pattern scope

  • **/.codex/config.toml
  • standalone *.config.toml profiles where applicable

What this rule reports

  • This .codex layer defines both hooks.json and inline [hooks]. Codex merges them and warns; keep one representation per layer.

Why this rule exists

Disallow both hooks.json and inline hooks in the same Codex config layer.

❌ Incorrect

A file in the targeted scope that produces any diagnostic listed above is incorrect for this rule.

✅ Correct

A file is correct when it uses the documented Codex structure and produces no diagnostic from this rule.

Behavior and migration notes

Included in:

  • codex.configs.recommended
  • codex.configs.strict
  • codex.configs.all

ESLint flat config example

The preset layers supply the correct Markdown, TOML, or JSON language configuration. Override the rule only in a later matching flat-config entry:

import codex from "@typpi/eslint-plugin-codex";

export default [
...codex.configs.recommended,
{
rules: { "codex/no-mixed-hook-representations": "error" },
},
];

Further reading