lib/rules/no-unused-vars.js
function getDefinedMessage(unusedVar) {
            const defType = unusedVar.defs && unusedVar.defs[0] && unusedVar.defs[0].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();
            }

            const additional = type ? ` Allowed unused ${type} must match ${pattern}.` : "";

            return `'{{name}}' is defined but never used.${additional}`;
        }
function getDefinedMessage(unusedVar) {
            const defType = unusedVar.defs && unusedVar.defs[0] && unusedVar.defs[0].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();
            }

            const additional = type ? ` Allowed unused ${type} must match ${pattern}.` : "";

            return `'{{name}}' is defined but never used.${additional}`;
        }
function getDefinedMessage ( unusedVar ) { const defType = unusedVar . defs && unusedVar . defs [ 0 ] && unusedVar . defs [ 0 ] . 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 ( ) ; } const additional = type ? ` ${ type } ${ pattern } ` : "" ; return ` ${ additional } ` ; }
Generate the warning message about the variable being
defined and unused, including the ignore pattern if configured.
@param {Variable} unusedVar - eslint-scope variable object.
@returns {string} The warning message to be used with this unused variable.
Generate the warning message about the variable being defined and unused including the ignore pattern if configured .