lib/rules/lines-around-directive.js
function reportError(node, location, expected) {
            context.report({
                node,
                messageId: expected ? "expected" : "unexpected",
                data: {
                    value: node.expression.value,
                    location
                },
                fix(fixer) {
                    const lastToken = getLastTokenOnLine(node);

                    if (expected) {
                        return location === "before" ? fixer.insertTextBefore(node, "\n") : fixer.insertTextAfter(lastToken, "\n");
                    }
                    return fixer.removeRange(location === "before" ? [node.range[0] - 1, node.range[0]] : [lastToken.range[1], lastToken.range[1] + 1]);
                }
            });
        }
function reportError(node, location, expected) {
            context.report({
                node,
                messageId: expected ? "expected" : "unexpected",
                data: {
                    value: node.expression.value,
                    location
                },
                fix(fixer) {
                    const lastToken = getLastTokenOnLine(node);

                    if (expected) {
                        return location === "before" ? fixer.insertTextBefore(node, "\n") : fixer.insertTextAfter(lastToken, "\n");
                    }
                    return fixer.removeRange(location === "before" ? [node.range[0] - 1, node.range[0]] : [lastToken.range[1], lastToken.range[1] + 1]);
                }
            });
        }
function reportError ( node , location , expected ) { context . report ( { node , messageId : expected ? "expected" : "unexpected" , data : { value : node . expression . value , location } , fix ( fixer ) { const lastToken = getLastTokenOnLine ( node ) ; if ( expected ) { return location === "before" ? fixer . insertTextBefore ( node , "\n" ) : fixer . insertTextAfter ( lastToken , "\n" ) ; } return fixer . removeRange ( location === "before" ? [ node . range [ 0 ] - 1 , node . range [ 0 ] ] : [ lastToken . range [ 1 ] , lastToken . range [ 1 ] + 1 ] ) ; } } ) ; }
Report errors for newlines around directives.
@param {ASTNode} node Node to check.
@param {string} location Whether the error was found before or after the directive.
@param {boolean} expected Whether or not a newline was expected or unexpected.
@returns {void}
Report errors for newlines around directives .