Repository: eslint/eslint
File: lib/linter/linter.js (JavaScript)

Code before:
 * comment specified no specific rules, so it applies to all rules (e.g. `eslint-disable`)
 * @param {string} options.justification The justification of the directive
 * @param {ASTNode|token} options.node The Comment node/token.
 * @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
 * @param {Language} language The language to use to adjust the location information.
 * @returns {Object} Directives and problems from the comment
 */
function createDisableDirectives({ type, value, justification, node }, ruleMapper, language) {
    const ruleIds = Object.keys(commentParser.parseListConfig(value));
    const directiveRules = ruleIds.length ? ruleIds : [null];
    const result = {
        directives: [], // valid disable directives
        directiveProblems: [] // problems in directives
    };
    const parentDirective = { node, ruleIds };

    for (const ruleId of directiveRules) {

        // push to directives, if the rule is defined(including null, e.g. /*eslint enable*/)
        if (ruleId === null || !!ruleMapper(ruleId)) {
            if (type === "disable-next-line") {
                const { line, column } = updateLocationInformation(
                    {
                        line: node.loc.end.line,
                        column: node.loc.end.column
                    },
                    language
                );

                result.directives.push({
                    parentDirective,
                    type,
                    line,
                    column,
                    ruleId,
                    justification
                });
            } else {
                const { line, column } = updateLocationInformation(
                    {
                        line: node.loc.start.line,
                        column: node.loc.start.column
                    },
                    language
                );

                result.directives.push({
                    parentDirective,
                    type,
                    line,
                    column,

Review comment (refactor):
Can we simplify like this?
```suggestion
                const { line, column } = updateLocationInformation(
                    node.loc.end,
```

Code after:
 * comment specified no specific rules, so it applies to all rules (e.g. `eslint-disable`)
 * @param {string} options.justification The justification of the directive
 * @param {ASTNode|token} options.node The Comment node/token.
 * @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
 * @param {Language} language The language to use to adjust the location information.
 * @returns {Object} Directives and problems from the comment
 */
function createDisableDirectives({ type, value, justification, node }, ruleMapper, language) {
    const ruleIds = Object.keys(commentParser.parseListConfig(value));
    const directiveRules = ruleIds.length ? ruleIds : [null];
    const result = {
        directives: [], // valid disable directives
        directiveProblems: [] // problems in directives
    };
    const parentDirective = { node, ruleIds };

    for (const ruleId of directiveRules) {

        // push to directives, if the rule is defined(including null, e.g. /*eslint enable*/)
        if (ruleId === null || !!ruleMapper(ruleId)) {
            if (type === "disable-next-line") {
                const { line, column } = updateLocationInformation(
                    node.loc.end,
                    language
                );

                result.directives.push({
                    parentDirective,
                    type,
                    line,
                    column,
                    ruleId,
                    justification
                });
            } else {
                const { line, column } = updateLocationInformation(
                    node.loc.start,
                    language
                );

                result.directives.push({
                    parentDirective,
                    type,
                    line,
                    column,
                    ruleId,
                    justification
                });
            }
        } else {
            result.directiveProblems.push(createLintingProblem({ ruleId, loc: node.loc, language }));