????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.48 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/forge/node_modules/eslint/lib/rules/ |
Upload File : |
/**
* @fileoverview Enforces or disallows inline comments.
* @author Greg Cochard
*/
"use strict";
const astUtils = require("../util/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "disallow inline comments after code",
category: "Stylistic Issues",
recommended: false,
url: "https://eslint.org/docs/rules/no-inline-comments"
},
schema: []
},
create(context) {
const sourceCode = context.getSourceCode();
/**
* Will check that comments are not on lines starting with or ending with code
* @param {ASTNode} node The comment node to check
* @private
* @returns {void}
*/
function testCodeAroundComment(node) {
// Get the whole line and cut it off at the start of the comment
const startLine = String(sourceCode.lines[node.loc.start.line - 1]);
const endLine = String(sourceCode.lines[node.loc.end.line - 1]);
const preamble = startLine.slice(0, node.loc.start.column).trim();
// Also check after the comment
const postamble = endLine.slice(node.loc.end.column).trim();
// Check that this comment isn't an ESLint directive
const isDirective = astUtils.isDirectiveComment(node);
// Should be empty if there was only whitespace around the comment
if (!isDirective && (preamble || postamble)) {
context.report({ node, message: "Unexpected comment inline with code." });
}
}
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
Program() {
const comments = sourceCode.getAllComments();
comments.filter(token => token.type !== "Shebang").forEach(testCodeAroundComment);
}
};
}
};