Repository: eslint/eslint
File: lib/rules/no-unused-vars.js (JavaScript)

Code before:
         */
        function getUsedIgnoredMessageData(usedIgnoredVar) {
            const def = usedIgnoredVar.defs && usedIgnoredVar.defs[0];
            let additional = "";

            if (def) {
                const defType = def.type;
                let type;
                let pattern;

                if (defType === "CatchClause" && config.caughtErrorsIgnorePattern) {
                    type = "args";
                    pattern = config.caughtErrorsIgnorePattern.toString();
                } else if (defType === "Parameter" && config.argsIgnorePattern) {
                    type = "args";
                    pattern = config.argsIgnorePattern.toString();
                } else if (defType !== "Parameter" && config.varsIgnorePattern) {
                    type = "vars";
                    pattern = config.varsIgnorePattern.toString();
                } else if (def.name.parent.type === "ArrayPattern" && config.destructuredArrayIgnorePattern) {
                    type = "elements of array destructuring";
                    pattern = config.destructuredArrayIgnorePattern.toString();
                }

                if (type) {
                    additional = `. Allowed unused ${type} must not match ${pattern}`;
                }
            }

            return {
                varName: usedIgnoredVar.name,
                additional
            };
        }

        //--------------------------------------------------------------------------
        // Helpers
        //--------------------------------------------------------------------------

        const STATEMENT_TYPE = /(?:Statement|Declaration)$/u;

        /**
         * Determines if a given variable is being exported from a module.
         * @param {Variable} variable eslint-scope variable object.
         * @returns {boolean} True if the variable is exported, false if not.
         * @private
         */
        function isExported(variable) {

            const definition = variable.defs[0];


Review comment (suggestion):
```suggestion
                    additional = `. Used ${type} must not match ${pattern}`;
```

Code after:
        function getDefinedMessageData(unusedVar) {
            const def = unusedVar.defs && unusedVar.defs[0];
            let additionalMessageData = "";

            if (def) {
                let pattern;
                let variableDescription;

                switch (def.type) {
                    case "CatchClause":
                        if (config.caughtErrorsIgnorePattern) {
                            [variableDescription, pattern] = getVariableDescription("catch-clause");
                        }
                        break;

                    case "Parameter":
                        if (config.argsIgnorePattern) {
                            [variableDescription, pattern] = getVariableDescription("parameter");
                        }
                        break;

                    default:
                        if (config.varsIgnorePattern) {
                            [variableDescription, pattern] = getVariableDescription("variable");
                        }
                        break;
                }

                if (pattern && variableDescription) {
                    additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`;
                }
            }

            return {
                varName: unusedVar.name,
                action: "defined",
                additional: additionalMessageData
            };
        }

        /**
         * Generate the warning message about the variable being
         * assigned and unused, including the ignore pattern if configured.
         * @param {Variable} unusedVar eslint-scope variable object.
         * @returns {UnusedVarMessageData} The message data to be used with this unused variable.
         */
        function getAssignedMessageData(unusedVar) {
            const def = unusedVar.defs && unusedVar.defs[0];
            let additionalMessageData = "";

            if (def) {