import nx from "@nx/eslint-plugin";
import baseConfig from "../../../eslint.config.mjs";

export default [
    ...nx.configs["flat/angular"],
    ...nx.configs["flat/angular-template"],
    ...baseConfig,
    {
        files: [
            "**/*.ts"
        ],
        rules: {
            "@angular-eslint/directive-selector": [
                "error",
                {
                    type: "attribute",
                    prefix: "lib",
                    style: "camelCase"
                }
            ],
            "@angular-eslint/component-selector": [
                "error",
                {
                    type: "element",
                    prefix: "lib",
                    style: "kebab-case"
                }
            ],
            // Per ADR-0023: the colour-blind-safe palette lives in
            // `_internal/palette.ts` and is the *only* source of
            // palettes. Importing `d3-scale-chromatic` anywhere else
            // in the lib would bypass the a11y contract.
            "no-restricted-imports": [
                "error",
                {
                    paths: [
                        {
                            name: "d3-scale-chromatic",
                            message: "Import palettes from `_internal/palette.ts`. Direct `d3-scale-chromatic` imports bypass the chart lib's colour-blind-safe contract (ADR-0023)."
                        }
                    ]
                }
            ]
        }
    },
    {
        // Exempt the palette module itself — it IS the wrapper.
        files: ["**/lib/_internal/palette.ts"],
        rules: {
            "no-restricted-imports": "off"
        }
    },
    {
        files: [
            "**/*.html"
        ],
        // Override or add rules here
        rules: {}
    }
];
