????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.148.211.202 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 Rule that warns when identifier names are shorter or longer * than the values provided in configuration. * @author Burak Yigit Kaya aka BYK */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = { meta: { type: "suggestion", docs: { description: "enforce minimum and maximum identifier lengths", category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/id-length" }, schema: [ { type: "object", properties: { min: { type: "integer", default: 2 }, max: { type: "integer" }, exceptions: { type: "array", uniqueItems: true, items: { type: "string" } }, properties: { enum: ["always", "never"] } }, additionalProperties: false } ], messages: { tooShort: "Identifier name '{{name}}' is too short (< {{min}}).", tooLong: "Identifier name '{{name}}' is too long (> {{max}})." } }, create(context) { const options = context.options[0] || {}; const minLength = typeof options.min !== "undefined" ? options.min : 2; const maxLength = typeof options.max !== "undefined" ? options.max : Infinity; const properties = options.properties !== "never"; const exceptions = (options.exceptions ? options.exceptions : []) .reduce((obj, item) => { obj[item] = true; return obj; }, {}); const SUPPORTED_EXPRESSIONS = { MemberExpression: properties && function(parent) { return !parent.computed && ( // regular property assignment (parent.parent.left === parent && parent.parent.type === "AssignmentExpression" || // or the last identifier in an ObjectPattern destructuring parent.parent.type === "Property" && parent.parent.value === parent && parent.parent.parent.type === "ObjectPattern" && parent.parent.parent.parent.left === parent.parent.parent) ); }, AssignmentPattern(parent, node) { return parent.left === node; }, VariableDeclarator(parent, node) { return parent.id === node; }, Property: properties && function(parent, node) { return parent.key === node; }, ImportDefaultSpecifier: true, RestElement: true, FunctionExpression: true, ArrowFunctionExpression: true, ClassDeclaration: true, FunctionDeclaration: true, MethodDefinition: true, CatchClause: true }; return { Identifier(node) { const name = node.name; const parent = node.parent; const isShort = name.length < minLength; const isLong = name.length > maxLength; if (!(isShort || isLong) || exceptions[name]) { return; // Nothing to report } const isValidExpression = SUPPORTED_EXPRESSIONS[parent.type]; if (isValidExpression && (isValidExpression === true || isValidExpression(parent, node))) { context.report({ node, messageId: isShort ? "tooShort" : "tooLong", data: { name, min: minLength, max: maxLength } }); } } }; } };