Repository: eslint/eslint
File: lib/rules/complexity.js (JavaScript)

Code before:
        docs: {
            description: "Enforce a maximum cyclomatic complexity allowed in a program",
            recommended: false,
            url: "https://eslint.org/docs/latest/rules/complexity"
        },

        schema: [
            {
                oneOf: [
                    {
                        type: "integer",
                        minimum: 0
                    },
                    {
                        type: "object",
                        properties: {
                            maximum: {
                                type: "integer",
                                minimum: 0
                            },
                            max: {
                                type: "integer",
                                minimum: 0
                            },
                            variant: {
                                type: "string",
                                enum: ["classic", "modified"]
                            }
                        },
                        additionalProperties: false
                    }
                ]
            }
        ],

        messages: {
            complex: "{{name}} has a complexity of {{complexity}}. Maximum allowed is {{max}}."
        }
    },

    create(context) {
        const option = context.options[0];
        let THRESHOLD = 20;
        let VARIANT = "classic";

        if (typeof option === "object") {
            if (Object.hasOwn(option, "maximum") || Object.hasOwn(option, "max")) {
                THRESHOLD = option.maximum || option.max;
            }

            if (Object.hasOwn(option, "variant")) {

Review comment (suggestion):
```suggestion
```

`type` is not necessary with enums.

Code after:
        docs: {
            description: "Enforce a maximum cyclomatic complexity allowed in a program",
            recommended: false,
            url: "https://eslint.org/docs/latest/rules/complexity"
        },

        schema: [
            {
                oneOf: [
                    {
                        type: "integer",
                        minimum: 0
                    },
                    {
                        type: "object",
                        properties: {
                            maximum: {
                                type: "integer",
                                minimum: 0
                            },
                            max: {
                                type: "integer",
                                minimum: 0
                            },
                            variant: {
                                enum: ["classic", "modified"]
                            }
                        },
                        additionalProperties: false
                    }
                ]
            }
        ],

        messages: {
            complex: "{{name}} has a complexity of {{complexity}}. Maximum allowed is {{max}}."
        }
    },

    create(context) {
        const option = context.options[0];
        let THRESHOLD = 20;
        let VARIANT = "classic";

        if (typeof option === "object") {
            if (Object.hasOwn(option, "maximum") || Object.hasOwn(option, "max")) {
                THRESHOLD = option.maximum || option.max;
            }

            if (Object.hasOwn(option, "variant")) {
                VARIANT = option.variant;