From 304c34ece6760726f54d3b4a4249fbda2f284c90 Mon Sep 17 00:00:00 2001 From: Mykola Bilochub Date: Thu, 18 Oct 2018 01:48:28 +0300 Subject: [PATCH] Use eslint-config-metarhia and fix linting issues Refs: https://github.com/metarhia/Metarhia/issues/22 --- .eslintrc.yml | 177 +------- lib/array.js | 8 +- lib/auth.js | 44 +- lib/cache.js | 2 +- lib/events.js | 2 +- lib/fp.js | 2 +- lib/id.js | 26 +- lib/iterator.js | 1 + lib/math.js | 2 +- lib/mp.js | 2 +- lib/network.js | 5 +- lib/strings.js | 48 +-- lib/time.js | 5 +- lib/units.js | 2 +- lib/utilities.js | 1 + package-lock.json | 700 +++++++++++++++++++------------ package.json | 4 +- test/array.js | 8 +- test/auth.js | 102 ++--- test/cache.js | 8 +- test/callback.js | 20 +- test/curry.js | 34 +- test/curryN.js | 4 +- test/data.js | 14 +- test/either.js | 10 +- test/enum.js | 16 +- test/events.js | 12 +- test/id.js | 18 +- test/math.js | 14 +- test/mixin.js | 2 +- test/mp.js | 6 +- test/network.js | 2 +- test/omap.js | 4 +- test/partial.js | 4 +- test/replicate.js | 2 +- test/restLeft.js | 2 +- test/safe.js | 8 +- test/sort.js | 8 +- test/uint64.js | 4 +- test/utilities.js | 4 +- test/zip.js | 4 +- test/zipWith.js | 2 +- tools/unicode-category-parser.js | 6 +- 43 files changed, 663 insertions(+), 686 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 64a26d59..b327b9bf 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,176 +1 @@ -env: - node: true - es6: true -extends: 'eslint:recommended' -globals: - api: false - application: false - connection: false - impress: false -rules: - indent: - - error - - 2 - - SwitchCase: 1 - VariableDeclarator: - var: 2 - let: 2 - const: 1 - MemberExpression: 1 - linebreak-style: - - error - - unix - quotes: - - error - - single - semi: - - error - - always - eqeqeq: - - error - - always - no-loop-func: - - error - strict: - - error - - global - block-spacing: - - error - - always - brace-style: - - error - - 1tbs - - allowSingleLine: true - camelcase: - - error - comma-style: - - error - - last - comma-spacing: - - error - - before: false - after: true - eol-last: - - error - func-call-spacing: - - error - - never - key-spacing: - - error - - beforeColon: false - afterColon: true - mode: minimum - keyword-spacing: - - error - - before: true - after: true - overrides: - function: - after: false - max-len: - - error - - code: 80 - ignoreUrls: true - max-nested-callbacks: - - error - - max: 5 - new-cap: - - error - - newIsCap: true - capIsNew: true - properties: true - new-parens: - - error - no-lonely-if: - - error - no-trailing-spaces: - - error - no-unneeded-ternary: - - error - no-whitespace-before-property: - - error - object-curly-spacing: - - error - - always - operator-assignment: - - error - - always - operator-linebreak: - - error - - after - semi-spacing: - - error - - before: false - after: true - space-before-blocks: - - error - - always - space-before-function-paren: - - error - - never - space-in-parens: - - error - - never - space-infix-ops: - - error - space-unary-ops: - - error - - words: true - nonwords: false - overrides: - typeof: false - no-unreachable: - - error - no-global-assign: - - error - no-self-compare: - - error - no-unmodified-loop-condition: - - error - no-constant-condition: - - error - - checkLoops: false - no-console: - - off - no-useless-concat: - - error - no-useless-escape: - - error - no-shadow-restricted-names: - - error - no-use-before-define: - - error - - functions: false - arrow-body-style: - - error - - as-needed - arrow-spacing: - - error - no-confusing-arrow: - - error - - allowParens: true - no-useless-computed-key: - - error - no-useless-rename: - - error - no-var: - - error - object-shorthand: - - error - - always - prefer-arrow-callback: - - error - prefer-const: - - error - prefer-numeric-literals: - - error - prefer-rest-params: - - error - prefer-spread: - - error - rest-spread-spacing: - - error - - never - template-curly-spacing: - - error - - never +extends: 'metarhia' diff --git a/lib/array.js b/lib/array.js index 72447b49..410475b4 100644 --- a/lib/array.js +++ b/lib/array.js @@ -13,9 +13,7 @@ const splitAt = (index, array) => { // Shuffle an array // arr - // Returns: -const shuffle = arr => ( - arr.sort(() => Math.random() - 0.5) -); +const shuffle = arr => arr.sort(() => Math.random() - 0.5); // Generate int array from given range // from - , range start @@ -64,9 +62,7 @@ const sequence = (seq, max) => { // Get last element of array // arr - // Returns: , element -const last = arr => ( - arr[arr.length - 1] -); +const last = arr => arr[arr.length - 1]; module.exports = { splitAt, diff --git a/lib/auth.js b/lib/auth.js index acdff0ef..d242151d 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -41,20 +41,20 @@ const passwordTests = { MIN_LENGTH: { test: (password, options) => password.length >= options.minLength, hint: options => ({ name: 'MIN_LENGTH', minLength: options.minLength }), - options: { minLength: 10 } + options: { minLength: 10 }, }, MAX_LENGTH: { test: (password, options) => password.length <= options.maxLength, hint: options => ({ name: 'MAX_LENGTH', maxLength: options.maxLength }), - options: { maxLength: 128 } + options: { maxLength: 128 }, }, MIN_PASSPHRASE_LENGTH: { test: (password, options) => password.length >= options.minLength, hint: options => ({ name: 'MIN_PASSPHRASE_LENGTH', - minLength: options.minLength + minLength: options.minLength, }), - options: { minLength: 20 } + options: { minLength: 20 }, }, MAX_REPEATED_CHARS: { test: (password, options) => { @@ -62,21 +62,21 @@ const passwordTests = { return !regexp.test(password); }, hint: options => ({ name: 'MAX_REPEATED_CHARS', number: options.number }), - options: { number: 2 } + options: { number: 2 }, }, MIN_LOWERCASE_CHARS: { - test: (password, option) => ( - stringIncludesChars(password, unicodeCategories.Ll, option.number) + test: (password, option) => stringIncludesChars( + password, unicodeCategories.Ll, option.number ), hint: options => ({ name: 'MIN_LOWERCASE_CHARS', number: options.number }), - options: { number: 1 } + options: { number: 1 }, }, MIN_UPPERCASE_CHARS: { - test: (password, options) => ( - stringIncludesChars(password, unicodeCategories.Lu, options.number) + test: (password, options) => stringIncludesChars( + password, unicodeCategories.Lu, options.number ), hint: options => ({ name: 'MIN_UPPERCASE_CHARS', number: options.number }), - options: { number: 1 } + options: { number: 1 }, }, MIN_NUMBERS: { test: (password, options) => { @@ -84,7 +84,7 @@ const passwordTests = { return stringIncludesChars(password, NUMBERS_RANGE, options.number); }, hint: options => ({ name: 'MIN_NUMBERS', number: options.number }), - options: { number: 1 } + options: { number: 1 }, }, MIN_SPECIAL_CHARS: { test: (password, options) => { @@ -93,20 +93,20 @@ const passwordTests = { return stringIncludesChars(password, SPECIAL_CHARS_RANGE, options.number); }, hint: options => ({ name: 'MIN_SPECIAL_CHARS', number: options.number }), - options: { number: 1 } - } + options: { number: 1 }, + }, }; const loginTests = { MIN_LENGTH: { test: (login, options) => login.length >= options.minLength, hint: options => ({ name: 'MIN_LENGTH', minLength: options.minLength }), - options: { minLength: 6 } + options: { minLength: 6 }, }, MAX_LENGTH: { test: (login, options) => login.length <= options.maxLength, hint: options => ({ name: 'MAX_LENGTH', maxLength: options.maxLength }), - options: { maxLength: 50 } + options: { maxLength: 50 }, }, IS_EMAIL: { test: login => { @@ -123,9 +123,11 @@ const loginTests = { localPart.length <= MAX_LOCAL_PART_LENGTH && EMAIL_REGEXP.test(login); } + + return false; }, hint: () => ({ name: 'IS_EMAIL' }), - } + }, }; const loginPasswordTests = { @@ -136,7 +138,7 @@ const loginPasswordTests = { PASSWORD_INCLUDES_LOGIN: { test: (login, password) => !password.includes(login), hint: () => ({ name: 'PASSWORD_INCLUDES_LOGIN' }), - } + }, }; class AuthenticationStrength { @@ -221,7 +223,7 @@ const checkPassword = (password, required, optional = []) => { 'MIN_NUMBERS', 'MIN_SPECIAL_CHARS', 'MIN_UPPERCASE_CHARS', - 'MIN_LOWERCASE_CHARS' + 'MIN_LOWERCASE_CHARS', ]; } return makeTest(passwordTests, required, optional, password); @@ -237,7 +239,7 @@ const checkLoginPassword = (login, password, required, optional = []) => { if (!required) { required = [ 'PASSWORD_INCLUDES_LOGIN', - 'LOGIN_INCLUDES_PASSWORD' + 'LOGIN_INCLUDES_PASSWORD', ]; } return makeTest(loginPasswordTests, required, optional, login, password); @@ -246,5 +248,5 @@ const checkLoginPassword = (login, password, required, optional = []) => { module.exports = { checkLogin, checkPassword, - checkLoginPassword + checkLoginPassword, }; diff --git a/lib/cache.js b/lib/cache.js index bda84c62..a0323e13 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -52,7 +52,7 @@ Cache.prototype.clr = function(prefix, fn) { // Create Cache, enhanced Map // Returns: -const cache = () => (new Cache()); +const cache = () => new Cache(); module.exports = { cache, diff --git a/lib/events.js b/lib/events.js index 772281d0..085acc9f 100644 --- a/lib/events.js +++ b/lib/events.js @@ -74,7 +74,7 @@ EnhancedEmitter.prototype.forward = function(to, events) { // Create EnhancedEmitter, enhanced EventEmitter // with wildcard and forward method // Returns: -const emitter = () => (new EnhancedEmitter()); +const emitter = () => new EnhancedEmitter(); module.exports = { forwardEvents, diff --git a/lib/fp.js b/lib/fp.js index abf902b0..cc789e81 100644 --- a/lib/fp.js +++ b/lib/fp.js @@ -70,7 +70,7 @@ const zip = (...arrays) => { // count - , new array length // elem - , value to replicate // Returns: , replicated -const replicate = (count, elem) => (Array.from({ length: count }, () => elem)); +const replicate = (count, elem) => Array.from({ length: count }, () => elem); // Zip arrays using specific function // fn - , for zipping elements with index i diff --git a/lib/id.js b/lib/id.js index f764f656..0f037f0e 100644 --- a/lib/id.js +++ b/lib/id.js @@ -45,7 +45,7 @@ const generateGUID = () => { bytes.toString('hex', 4, 6), bytes.toString('hex', 6, 8), bytes.toString('hex', 8, 10), - bytes.toString('hex', 10, 16) + bytes.toString('hex', 10, 16), ].join('-'); }; @@ -53,13 +53,10 @@ const generateGUID = () => { // config - , { secret } // key - , SID key // Returns: , CRC -const crcSID = (config, key) => ( - crypto - .createHash('md5') - .update(key + config.secret) - .digest('hex') - .substring(0, 4) -); +const crcSID = (config, key) => crypto.createHash('md5') + .update(key + config.secret) + .digest('hex') + .substring(0, 4); // Generate random SID // config - , { length, characters, secret } @@ -87,19 +84,16 @@ const validateSID = (config, sid) => { // password - // salt - // Returns: , hash -const hash = (password, salt) => ( - crypto - .createHmac('sha512', salt) - .update(password) - .digest('hex') -); +const hash = (password, salt) => crypto.createHmac('sha512', salt) + .update(password) + .digest('hex'); // Validate hash // hash - // password - // salt - // Returns: -const validateHash = (hash, password, salt) => (hash(password, salt) === hash); +const validateHash = (hash, password, salt) => hash(password, salt) === hash; // Convert id to array of hex strings // id - @@ -157,5 +151,5 @@ module.exports = { generateStorageKey, idToChunks, idToPath, - pathToId + pathToId, }; diff --git a/lib/iterator.js b/lib/iterator.js index 7f379226..ef92a776 100644 --- a/lib/iterator.js +++ b/lib/iterator.js @@ -55,6 +55,7 @@ class Iterator { return value; } } + return undefined; } includes(element) { diff --git a/lib/math.js b/lib/math.js index b97799d6..a12d7b36 100644 --- a/lib/math.js +++ b/lib/math.js @@ -28,7 +28,7 @@ class CryptoRandomPrefetcher { // bufSize - , size in bytes of the buffer to preallocate // valueSize - , size in bytes of the produced chunks const cryptoPrefetcher = (bufSize, valueSize) => - (new CryptoRandomPrefetcher(bufSize, valueSize)); + new CryptoRandomPrefetcher(bufSize, valueSize); // Generate random integer value in given range // min - , range start diff --git a/lib/mp.js b/lib/mp.js index 24f7398c..e4fd1be2 100644 --- a/lib/mp.js +++ b/lib/mp.js @@ -3,7 +3,7 @@ // List method names // iface - , to be introspected // Returns: , method names -const methods = (iface) => { +const methods = iface => { const names = []; for (const name in iface) { if (typeof iface[name] === 'function') { diff --git a/lib/network.js b/lib/network.js index 0d9c0a4e..94e92c7a 100644 --- a/lib/network.js +++ b/lib/network.js @@ -6,9 +6,8 @@ const { alias } = require('./utilities'); // Convert IP string to number // ip - , IP address, default: '127.0.0.1' // Returns: -const ipToInt = (ip = '127.0.0.1') => ( - ip.split('.').reduce((res, item) => (res << 8) + (+item), 0) -); +const ipToInt = (ip = '127.0.0.1') => + ip.split('.').reduce((res, item) => (res << 8) + +item, 0); let LOCAL_IPS_CACHE; diff --git a/lib/strings.js b/lib/strings.js index 8aeb6965..e9551e32 100644 --- a/lib/strings.js +++ b/lib/strings.js @@ -8,7 +8,7 @@ const { nowDateTime } = require('./time'); const HTML_ESCAPE_REGEXP = new RegExp('[&<>"\'/]', 'g'); const HTML_ESCAPE_CHARS = { - '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''' + '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''', }; const ALPHA_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; @@ -22,8 +22,9 @@ const ALPHA_DIGIT = ALPHA + DIGIT; // Returns: // // Example: htmlEscape('5>=5') = '5<=5' -const htmlEscape = content => ( - content.replace(HTML_ESCAPE_REGEXP, char => HTML_ESCAPE_CHARS[char]) +const htmlEscape = content => content.replace( + HTML_ESCAPE_REGEXP, + char => HTML_ESCAPE_CHARS[char] ); // Substitute variables @@ -93,9 +94,8 @@ const subst = (tpl, data, dataPath, escapeHtml) => { // // Example: fileExt('/dir/file.txt') // Result: 'txt' -const fileExt = fileName => ( - path.extname(fileName).replace('.', '').toLowerCase() -); +const fileExt = fileName => path.extname(fileName) + .replace('.', '').toLowerCase(); // Remove file extension from file name // fileName - , file name @@ -103,19 +103,16 @@ const fileExt = fileName => ( // // Example: fileExt('file.txt') // Result: 'file' -const removeExt = fileName => ( - fileName.substr(0, fileName.lastIndexOf('.')) -); +const removeExt = fileName => fileName.substr(0, fileName.lastIndexOf('.')); const CAPITALIZE_REGEXP = /\w+/g; // Capitalize string // s - // Returns: -const capitalize = s => ( - s.replace(CAPITALIZE_REGEXP, (word) => ( - word.charAt(0).toUpperCase() + word.substr(1).toLowerCase() - )) +const capitalize = s => s.replace( + CAPITALIZE_REGEXP, + word => word.charAt(0).toUpperCase() + word.substr(1).toLowerCase() ); const UNDERLINE_REGEXP = /_/g; @@ -123,19 +120,16 @@ const UNDERLINE_REGEXP = /_/g; // Convert spinal case to camel case // name - // Returns: -const spinalToCamel = name => ( - name - .replace(UNDERLINE_REGEXP, '-') - .split('-') - .map((part, i) => (i > 0 ? capitalize(part) : part)) - .join('') -); +const spinalToCamel = name => name.replace(UNDERLINE_REGEXP, '-') + .split('-') + .map((part, i) => (i > 0 ? capitalize(part) : part)) + .join(''); const ESCAPE_REGEXP_SPECIALS = [ // order matters for these '-', '[', ']', // order doesn't matter for any of these - '/', '{', '}', '(', ')', '*', '+', '?', '.', '\\', '^', '$', '|' + '/', '{', '}', '(', ')', '*', '+', '?', '.', '\\', '^', '$', '|', ]; const ESCAPE_REGEXP = new RegExp( @@ -147,16 +141,12 @@ const ESCAPE_REGEXP = new RegExp( // Returns: // // Example: escapeRegExp('/path/to/res?search=this.that') -const escapeRegExp = s => ( - s.replace(ESCAPE_REGEXP, '\\$&') -); +const escapeRegExp = s => s.replace(ESCAPE_REGEXP, '\\$&'); // Generate escaped regular expression // s - // Returns: -const newEscapedRegExp = s => ( - new RegExp(escapeRegExp(s), 'g') -); +const newEscapedRegExp = s => new RegExp(escapeRegExp(s), 'g'); // Add trailing slash at the end if there isn't one // s - @@ -257,9 +247,7 @@ const rsection = (s, separator) => { // Result: ['a', 'b', 'c', 'd'] // Example: split('a,b,c,d', ',', 2) // Result: ['a', 'b'] -const split = (s, separator = ',', limit = -1) => ( - s.split(separator, limit) -); +const split = (s, separator = ',', limit = -1) => s.split(separator, limit); // Split string by multiple occurrences of separator // s - diff --git a/lib/time.js b/lib/time.js index 43fcb6e7..d6f2e648 100644 --- a/lib/time.js +++ b/lib/time.js @@ -6,9 +6,8 @@ // Returns: // // Example: isTimeEqual(sinceTime, buffer.stats.mtime) -const isTimeEqual = (time1, time2) => ( - new Date(time1).getTime() === new Date(time2).getTime() -); +const isTimeEqual = (time1, time2) => + new Date(time1).getTime() === new Date(time2).getTime(); const pad2 = n => (n < 10 ? '0' + n : '' + n); diff --git a/lib/units.js b/lib/units.js index 5ee1be49..13a42d8a 100644 --- a/lib/units.js +++ b/lib/units.js @@ -50,7 +50,7 @@ const durationToString = n => { }; const SIZE_UNITS = [ - '', ' Kb', ' Mb', ' Gb', ' Tb', ' Pb', ' Eb', ' Zb', ' Yb' + '', ' Kb', ' Mb', ' Gb', ' Tb', ' Pb', ' Eb', ' Zb', ' Yb', ]; // Convert integer to string, representing data size in Kb, Mb, Gb, and Tb diff --git a/lib/utilities.js b/lib/utilities.js index cab8bb60..c3e9d80e 100644 --- a/lib/utilities.js +++ b/lib/utilities.js @@ -77,6 +77,7 @@ const callerFilepath = (depth = 0, stack = null) => { const end = frame.indexOf(':', start + 1); return frame.substring(start + 1, end); } + return ''; }; const callerFilename = (depth = 0, stack = null) => diff --git a/package-lock.json b/package-lock.json index fd5313a0..70b8886d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1012,21 +1012,10 @@ } }, "acorn-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", - "dev": true, - "requires": { - "acorn": "^3.0.4" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", - "dev": true - } - } + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.0.tgz", + "integrity": "sha512-XkB50fn0MURDyww9+UYL3c1yLbOBz0ZFvrdYlGB8l+Ije1oSC75qAqrzSPjYQbdnQUzhlUGNKuesryAv0gxZOg==", + "dev": true }, "after": { "version": "0.8.2", @@ -1039,6 +1028,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, + "optional": true, "requires": { "co": "^4.6.0", "fast-deep-equal": "^1.0.0", @@ -1046,12 +1036,6 @@ "json-schema-traverse": "^0.3.0" } }, - "ajv-keywords": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", - "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", - "dev": true - }, "ansi-escapes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", @@ -1059,16 +1043,19 @@ "dev": true }, "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } }, "anymatch": { "version": "2.0.0", @@ -1265,17 +1252,6 @@ "dev": true, "optional": true }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -1610,6 +1586,12 @@ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", "dev": true }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, "builtin-status-codes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", @@ -1695,22 +1677,20 @@ "optional": true }, "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, "chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, "chokidar": { @@ -1807,7 +1787,8 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true + "dev": true, + "optional": true }, "collection-visit": { "version": "1.0.0", @@ -1934,6 +1915,12 @@ "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", "dev": true }, + "contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true + }, "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", @@ -2025,12 +2012,14 @@ } }, "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { - "lru-cache": "^4.0.1", + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" } @@ -2423,6 +2412,15 @@ "prr": "~1.0.1" } }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, "es5-ext": { "version": "0.10.46", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.46.tgz", @@ -2475,122 +2473,200 @@ "dev": true }, "eslint": { - "version": "4.19.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.19.1.tgz", - "integrity": "sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.8.0.tgz", + "integrity": "sha512-Zok6Bru3y2JprqTNm14mgQ15YQu/SMDkWdnmHfFg770DIUlmMFd/gqqzCHekxzjHZJxXv3tmTpH0C1icaYJsRQ==", "dev": true, "requires": { - "ajv": "^5.3.0", - "babel-code-frame": "^6.22.0", + "@babel/code-frame": "^7.0.0", + "ajv": "^6.5.3", "chalk": "^2.1.0", - "concat-stream": "^1.6.0", - "cross-spawn": "^5.1.0", - "debug": "^3.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", "doctrine": "^2.1.0", - "eslint-scope": "^3.7.1", + "eslint-scope": "^4.0.0", + "eslint-utils": "^1.3.1", "eslint-visitor-keys": "^1.0.0", - "espree": "^3.5.4", - "esquery": "^1.0.0", + "espree": "^4.0.0", + "esquery": "^1.0.1", "esutils": "^2.0.2", "file-entry-cache": "^2.0.0", "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", - "globals": "^11.0.1", - "ignore": "^3.3.3", + "globals": "^11.7.0", + "ignore": "^4.0.6", "imurmurhash": "^0.1.4", - "inquirer": "^3.0.6", - "is-resolvable": "^1.0.0", - "js-yaml": "^3.9.1", + "inquirer": "^6.1.0", + "is-resolvable": "^1.1.0", + "js-yaml": "^3.12.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", - "lodash": "^4.17.4", - "minimatch": "^3.0.2", + "lodash": "^4.17.5", + "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", "optionator": "^0.8.2", "path-is-inside": "^1.0.2", "pluralize": "^7.0.0", "progress": "^2.0.0", - "regexpp": "^1.0.1", + "regexpp": "^2.0.1", "require-uncached": "^1.0.3", - "semver": "^5.3.0", + "semver": "^5.5.1", "strip-ansi": "^4.0.0", - "strip-json-comments": "~2.0.1", - "table": "4.0.2", - "text-table": "~0.2.0" + "strip-json-comments": "^2.0.1", + "table": "^5.0.2", + "text-table": "^0.2.0" }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ms": "^2.1.1" } }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + } + } + }, + "eslint-config-metarhia": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-metarhia/-/eslint-config-metarhia-6.0.0.tgz", + "integrity": "sha512-D5wXVOLV10SiuvStVX3NZjewcDofCVMyI46xb0Kl6VIqHEQmRu+z8RBvuQv1tDarRvPg6vQlZr3R9KZg5iiJ7w==", + "dev": true + }, + "eslint-import-resolver-node": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz", + "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "resolve": "^1.5.0" + } + }, + "eslint-module-utils": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz", + "integrity": "sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=", + "dev": true, + "requires": { + "debug": "^2.6.8", + "pkg-dir": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "ms": "2.0.0" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, - "globals": { - "version": "11.7.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", - "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "pinkie-promise": "^2.0.0" } }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "pkg-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", + "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", "dev": true, "requires": { - "has-flag": "^3.0.0" + "find-up": "^1.0.0" + } + } + } + }, + "eslint-plugin-import": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz", + "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==", + "dev": true, + "requires": { + "contains-path": "^0.1.0", + "debug": "^2.6.8", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.1", + "eslint-module-utils": "^2.2.0", + "has": "^1.0.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.3", + "read-pkg-up": "^2.0.0", + "resolve": "^1.6.0" + }, + "dependencies": { + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" } } } }, "eslint-scope": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.3.tgz", - "integrity": "sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", "dev": true, "requires": { "esrecurse": "^4.1.0", "estraverse": "^4.1.1" } }, + "eslint-utils": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", + "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", + "dev": true + }, "eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", @@ -2598,13 +2674,22 @@ "dev": true }, "espree": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", - "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-4.1.0.tgz", + "integrity": "sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w==", "dev": true, "requires": { - "acorn": "^5.5.0", - "acorn-jsx": "^3.0.0" + "acorn": "^6.0.2", + "acorn-jsx": "^5.0.0", + "eslint-visitor-keys": "^1.0.0" + }, + "dependencies": { + "acorn": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.2.tgz", + "integrity": "sha512-GXmKIvbrN3TV7aVqAzVFaMW8F8wzVX7voEBRO3bDA64+EX37YSayggRJP5Xig6HYHBkWKpFg9W5gg6orklubhg==", + "dev": true + } } }, "esprima": { @@ -2780,14 +2865,25 @@ } }, "external-editor": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", "dev": true, "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", "tmp": "^0.0.33" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } } }, "extglob": { @@ -2878,7 +2974,8 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", - "dev": true + "dev": true, + "optional": true }, "fast-json-stable-stringify": { "version": "2.0.0", @@ -3767,13 +3864,13 @@ "har-schema": "^2.0.0" } }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "function-bind": "^1.1.1" } }, "has-binary2": { @@ -3885,6 +3982,12 @@ "minimalistic-crypto-utils": "^1.0.1" } }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, "http-errors": { "version": "1.6.3", "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", @@ -3948,9 +4051,9 @@ "dev": true }, "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, "imurmurhash": { @@ -3982,71 +4085,24 @@ "dev": true }, "inquirer": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", "dev": true, "requires": { "ansi-escapes": "^3.0.0", "chalk": "^2.0.0", "cli-cursor": "^2.1.0", "cli-width": "^2.0.0", - "external-editor": "^2.0.4", + "external-editor": "^3.0.0", "figures": "^2.0.0", - "lodash": "^4.3.0", + "lodash": "^4.17.10", "mute-stream": "0.0.7", "run-async": "^2.2.0", - "rx-lite": "^4.0.8", - "rx-lite-aggregates": "^4.0.8", + "rxjs": "^6.1.0", "string-width": "^2.1.0", "strip-ansi": "^4.0.0", "through": "^2.3.6" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } } }, "invariant": { @@ -4078,6 +4134,12 @@ } } }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, "is-binary-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", @@ -4093,6 +4155,15 @@ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -4336,7 +4407,8 @@ "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true + "dev": true, + "optional": true }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -4523,6 +4595,18 @@ "type-check": "~0.3.2" } }, + "load-json-file": { + "version": "2.0.0", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, "loader-runner": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.1.tgz", @@ -5004,6 +5088,12 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, "node-libs-browser": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", @@ -5044,6 +5134,18 @@ "semver": "^5.3.0" } }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, "normalize-path": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", @@ -5282,6 +5384,15 @@ "pbkdf2": "^3.0.3" } }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, "parseqs": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", @@ -5342,12 +5453,27 @@ "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", "dev": true }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, "pbkdf2": { "version": "3.0.17", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", @@ -5469,9 +5595,9 @@ "dev": true }, "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.1.tgz", + "integrity": "sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg==", "dev": true }, "promise-inflight": { @@ -5600,6 +5726,27 @@ "unpipe": "1.0.0" } }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + }, "readable-stream": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", @@ -5668,9 +5815,9 @@ } }, "regexpp": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz", - "integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, "regexpu-core": { @@ -5863,19 +6010,13 @@ "aproba": "^1.1.1" } }, - "rx-lite": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", - "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", - "dev": true - }, - "rx-lite-aggregates": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", - "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "rxjs": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", + "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", "dev": true, "requires": { - "rx-lite": "*" + "tslib": "^1.9.0" } }, "safe-buffer": { @@ -6270,6 +6411,38 @@ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, + "spdx-correct": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz", + "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", + "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", + "dev": true + }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -6415,23 +6588,6 @@ "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } } }, "string_decoder": { @@ -6444,14 +6600,20 @@ } }, "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "^3.0.0" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -6459,53 +6621,49 @@ "dev": true }, "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } }, "table": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", - "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/table/-/table-5.1.0.tgz", + "integrity": "sha512-e542in22ZLhD/fOIuXs/8yDZ9W61ltF8daM88rkRNtgTIct+vI2fTnAyu/Db2TCfEcI8i7mjZz6meLq0nW7TYg==", "dev": true, "requires": { - "ajv": "^5.2.3", - "ajv-keywords": "^2.1.0", - "chalk": "^2.1.0", - "lodash": "^4.17.4", + "ajv": "^6.5.3", + "lodash": "^4.17.10", "slice-ansi": "1.0.0", "string-width": "^2.1.1" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true } } }, @@ -6530,7 +6688,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -6978,6 +7136,16 @@ "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", "dev": true }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", diff --git a/package.json b/package.json index bf431445..d80433fe 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/preset-env": "^7.1.0", - "eslint": "^4.19.1", + "eslint": "^5.8.0", + "eslint-config-metarhia": "^6.0.0", + "eslint-plugin-import": "^2.14.0", "metaschema": "^0.0.21", "metasync": "^0.3.29", "metatests": "^0.2.1" diff --git a/test/array.js b/test/array.js index 46333548..b8c3440c 100644 --- a/test/array.js +++ b/test/array.js @@ -34,9 +34,9 @@ metatests.case('Common / array', { common }, { [[40, [-3]], 6, [40, 41, 42]], ], 'common.shuffle': [ - [[1, 2, 3], (result) => (JSON.stringify(result.sort()) === '[1,2,3]') ], - [['a', 'b'], (result) => (JSON.stringify(result.sort()) === '["a","b"]')], - [[1, 'a', 3], (result) => (JSON.stringify(result.sort()) === '[1,3,"a"]')], - [[], (result) => (JSON.stringify(result.sort()) === '[]') ], + [[1, 2, 3], result => JSON.stringify(result.sort()) === '[1,2,3]' ], + [['a', 'b'], result => JSON.stringify(result.sort()) === '["a","b"]'], + [[1, 'a', 3], result => JSON.stringify(result.sort()) === '[1,3,"a"]'], + [[], result => JSON.stringify(result.sort()) === '[]' ], ], }); diff --git a/test/auth.js b/test/auth.js index ccc6f8e1..f100bef6 100644 --- a/test/auth.js +++ b/test/auth.js @@ -3,13 +3,13 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('test checkPassword / MIN_LENGTH', (test) => { +metatests.test('test checkPassword / MIN_LENGTH', test => { const password = 'password'; const passedResult = common.checkPassword(password, [ - { name: 'MIN_LENGTH', minLength: password.length } + { name: 'MIN_LENGTH', minLength: password.length }, ]); const failedResult = common.checkPassword(password, [ - { name: 'MIN_LENGTH', minLength: password.length + 1 } + { name: 'MIN_LENGTH', minLength: password.length + 1 }, ]); test.strictSame(passedResult.valid, true); @@ -17,13 +17,13 @@ metatests.test('test checkPassword / MIN_LENGTH', (test) => { test.end(); }); -metatests.test('test checkPassword / MAX_LENGTH', (test) => { +metatests.test('test checkPassword / MAX_LENGTH', test => { const password = 'password'; const passedResult = common.checkPassword(password, [ - { name: 'MAX_LENGTH', maxLength: password.length } + { name: 'MAX_LENGTH', maxLength: password.length }, ]); const failedResult = common.checkPassword(password, [ - { name: 'MAX_LENGTH', maxLength: password.length - 1 } + { name: 'MAX_LENGTH', maxLength: password.length - 1 }, ]); test.strictSame(passedResult.valid, true); @@ -31,13 +31,13 @@ metatests.test('test checkPassword / MAX_LENGTH', (test) => { test.end(); }); -metatests.test('test checkPassword / MIN_PASSPHRASE_LENGTH', (test) => { +metatests.test('test checkPassword / MIN_PASSPHRASE_LENGTH', test => { const password = 'password'; const passedResult = common.checkPassword(password, [ - { name: 'MIN_PASSPHRASE_LENGTH', minLength: password.length } + { name: 'MIN_PASSPHRASE_LENGTH', minLength: password.length }, ]); const failedResult = common.checkPassword(password, [ - { name: 'MIN_PASSPHRASE_LENGTH', minLength: password.length + 1 } + { name: 'MIN_PASSPHRASE_LENGTH', minLength: password.length + 1 }, ]); test.strictSame(passedResult.valid, true); @@ -45,19 +45,19 @@ metatests.test('test checkPassword / MIN_PASSPHRASE_LENGTH', (test) => { test.end(); }); -metatests.test('test checkPassword / MAX_REPEATED_CHARS', (test) => { +metatests.test('test checkPassword / MAX_REPEATED_CHARS', test => { const password = 'password'; const passedResult = common.checkPassword(password, [ { name: 'MAX_REPEATED_CHARS', - number: 2 - } + number: 2, + }, ]); const failedResult = common.checkPassword(password, [ { name: 'MAX_REPEATED_CHARS', - number: 1 - } + number: 1, + }, ]); test.strictSame(passedResult.valid, true); @@ -65,19 +65,19 @@ metatests.test('test checkPassword / MAX_REPEATED_CHARS', (test) => { test.end(); }); -metatests.test('test checkPassword / MIN_LOWERCASE_CHARS', (test) => { +metatests.test('test checkPassword / MIN_LOWERCASE_CHARS', test => { const password = 'PASSword𞥃'; const passedResult = common.checkPassword(password, [ { name: 'MIN_LOWERCASE_CHARS', - number: 5 - } + number: 5, + }, ]); const failedResult = common.checkPassword(password, [ { name: 'MIN_LOWERCASE_CHARS', - number: 6 - } + number: 6, + }, ]); test.strictSame(passedResult.valid, true); @@ -85,19 +85,19 @@ metatests.test('test checkPassword / MIN_LOWERCASE_CHARS', (test) => { test.end(); }); -metatests.test('test checkPassword / MIN_UPPERCASE_CHARS', (test) => { +metatests.test('test checkPassword / MIN_UPPERCASE_CHARS', test => { const password = 'PASSword𞤡'; const passedResult = common.checkPassword(password, [ { name: 'MIN_UPPERCASE_CHARS', - number: 5 - } + number: 5, + }, ]); const failedResult = common.checkPassword(password, [ { name: 'MIN_UPPERCASE_CHARS', - number: 6 - } + number: 6, + }, ]); test.strictSame(passedResult.valid, true); @@ -105,19 +105,19 @@ metatests.test('test checkPassword / MIN_UPPERCASE_CHARS', (test) => { test.end(); }); -metatests.test('test checkPassword / MIN_NUMBERS', (test) => { +metatests.test('test checkPassword / MIN_NUMBERS', test => { const password = 'pa123ss45'; const passedResult = common.checkPassword(password, [ { name: 'MIN_NUMBERS', - number: 5 - } + number: 5, + }, ]); const failedResult = common.checkPassword(password, [ { name: 'MIN_NUMBERS', - number: 6 - } + number: 6, + }, ]); test.strictSame(passedResult.valid, true); @@ -125,19 +125,19 @@ metatests.test('test checkPassword / MIN_NUMBERS', (test) => { test.end(); }); -metatests.test('test checkPassword / MIN_SPECIAL_CHARS', (test) => { +metatests.test('test checkPassword / MIN_SPECIAL_CHARS', test => { const password = 'pa!#ss&*'; const passedResult = common.checkPassword(password, [ { name: 'MIN_SPECIAL_CHARS', - number: 4 - } + number: 4, + }, ]); const failedResult = common.checkPassword(password, [ { name: 'MIN_SPECIAL_CHARS', - number: 5 - } + number: 5, + }, ]); test.strictSame(passedResult.valid, true); @@ -145,13 +145,13 @@ metatests.test('test checkPassword / MIN_SPECIAL_CHARS', (test) => { test.end(); }); -metatests.test('test checkLogin / MIN_LENGTH', (test) => { +metatests.test('test checkLogin / MIN_LENGTH', test => { const login = 'login'; const passedResult = common.checkLogin(login, [ - { name: 'MIN_LENGTH', minLength: login.length } + { name: 'MIN_LENGTH', minLength: login.length }, ]); const failedResult = common.checkLogin(login, [ - { name: 'MIN_LENGTH', minLength: login.length + 1 } + { name: 'MIN_LENGTH', minLength: login.length + 1 }, ]); test.strictSame(passedResult.valid, true); @@ -159,13 +159,13 @@ metatests.test('test checkLogin / MIN_LENGTH', (test) => { test.end(); }); -metatests.test('test checkLogin / MAX_LENGTH', (test) => { +metatests.test('test checkLogin / MAX_LENGTH', test => { const login = 'login'; const passedResult = common.checkLogin(login, [ - { name: 'MAX_LENGTH', maxLength: login.length } + { name: 'MAX_LENGTH', maxLength: login.length }, ]); const failedResult = common.checkLogin(login, [ - { name: 'MAX_LENGTH', maxLength: login.length - 1 } + { name: 'MAX_LENGTH', maxLength: login.length - 1 }, ]); test.strictSame(passedResult.valid, true); @@ -173,10 +173,10 @@ metatests.test('test checkLogin / MAX_LENGTH', (test) => { test.end(); }); -metatests.test('test checkLogin / IS_EMAIL', (test) => { +metatests.test('test checkLogin / IS_EMAIL', test => { const emails = [ 'local-part@domain', - 'l@dom' + 'l@dom', ]; emails.forEach(email => { const passedResult = common.checkLogin(email, ['IS_EMAIL']); @@ -189,7 +189,7 @@ metatests.test('test checkLogin / IS_EMAIL', (test) => { 'local-part@do', '@domain', 'l'.repeat(65) + '@domain', - 'local-part@' + 'd'.repeat(256) + 'local-part@' + 'd'.repeat(256), ]; invalidEmails.forEach(invalidEmail => { const failedResult = common.checkLogin(invalidEmail, ['IS_EMAIL']); @@ -198,12 +198,12 @@ metatests.test('test checkLogin / IS_EMAIL', (test) => { test.end(); }); -metatests.test('test checkLoginPassword / LOGIN_INCLUDES_PASSWORD', (test) => { +metatests.test('test checkLoginPassword / LOGIN_INCLUDES_PASSWORD', test => { const passedResult = common.checkLoginPassword('login', 'password', [ - 'LOGIN_INCLUDES_PASSWORD' + 'LOGIN_INCLUDES_PASSWORD', ]); const failedResult = common.checkLoginPassword('loginpassword', 'password', [ - 'LOGIN_INCLUDES_PASSWORD' + 'LOGIN_INCLUDES_PASSWORD', ]); test.strictSame(passedResult.valid, true); @@ -211,12 +211,12 @@ metatests.test('test checkLoginPassword / LOGIN_INCLUDES_PASSWORD', (test) => { test.end(); }); -metatests.test('test checkLoginPassword / PASSWORD_INCLUDES_LOGIN', (test) => { +metatests.test('test checkLoginPassword / PASSWORD_INCLUDES_LOGIN', test => { const passedResult = common.checkLoginPassword('login', 'password', [ - 'PASSWORD_INCLUDES_LOGIN' + 'PASSWORD_INCLUDES_LOGIN', ]); const failedResult = common.checkLoginPassword('login', 'loginpassword', [ - 'PASSWORD_INCLUDES_LOGIN' + 'PASSWORD_INCLUDES_LOGIN', ]); test.strictSame(passedResult.valid, true); @@ -224,14 +224,14 @@ metatests.test('test checkLoginPassword / PASSWORD_INCLUDES_LOGIN', (test) => { test.end(); }); -metatests.test('test AuthenticationStrength / strength', (test) => { +metatests.test('test AuthenticationStrength / strength', test => { let password = 'pass'; const required = [{ name: 'MIN_LENGTH', minLength: 5 }]; const optional = [ { name: 'MAX_REPEATED_CHARS', number: 2 }, { name: 'MIN_SPECIAL_CHARS', number: 1 }, { name: 'MIN_UPPERCASE_CHARS', number: 1 }, - { name: 'MIN_NUMBERS', number: 1 } + { name: 'MIN_NUMBERS', number: 1 }, ]; let result = common.checkPassword(password, required, optional); diff --git a/test/cache.js b/test/cache.js index b5072ced..fadc1b81 100644 --- a/test/cache.js +++ b/test/cache.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('cache create add get', (test) => { +metatests.test('cache create add get', test => { const cache = common.cache(); cache.add('key1', 'value1'); @@ -15,7 +15,7 @@ metatests.test('cache create add get', (test) => { test.end(); }); -metatests.test('cache del key', (test) => { +metatests.test('cache del key', test => { const cache = common.cache(); cache.add('key1', 'value1'); @@ -27,7 +27,7 @@ metatests.test('cache del key', (test) => { test.end(); }); -metatests.test('cache clr', (test) => { +metatests.test('cache clr', test => { const cache = common.cache({ }); cache.add('key1', 'value1'); @@ -39,7 +39,7 @@ metatests.test('cache clr', (test) => { test.end(); }); -metatests.test('cache calcSize', (test) => { +metatests.test('cache calcSize', test => { const cache = common.cache({ calcSize: true }); cache.add('key1', { length: 10, str: '0123456789' }); diff --git a/test/callback.js b/test/callback.js index 871ebb44..6702ddbb 100644 --- a/test/callback.js +++ b/test/callback.js @@ -9,7 +9,7 @@ metatests.case('Common / callbacks', { common }, { 'common.emptyness': [[[], undefined]], }); -metatests.test('unsafeCallback', (test) => { +metatests.test('unsafeCallback', test => { const callback = (...args) => { test.strictSame(args, [1, 2, 3]); test.end(); @@ -20,7 +20,7 @@ metatests.test('unsafeCallback', (test) => { cb(...args); }); -metatests.test('unsafeCallback without callback', (test) => { +metatests.test('unsafeCallback without callback', test => { const args = ['a', 'b', 'c']; const cb = common.unsafeCallback(args); test.strictSame(args, ['a', 'b', 'c']); @@ -28,7 +28,7 @@ metatests.test('unsafeCallback without callback', (test) => { test.end(); }); -metatests.test('safeCallback', (test) => { +metatests.test('safeCallback', test => { const callback = (...args) => { test.strictSame(args, [10, 20, 30, 40, 50]); test.end(); @@ -39,7 +39,7 @@ metatests.test('safeCallback', (test) => { wrappedCb(...args); }); -metatests.test('safeCallback without callback', (test) => { +metatests.test('safeCallback without callback', test => { const args = [11, 22, 33]; const wrappedCb = common.safeCallback(args); test.strictSame(args, [11, 22, 33]); @@ -47,7 +47,7 @@ metatests.test('safeCallback without callback', (test) => { test.end(); }); -metatests.test('safeCallback return emptiness', (test) => { +metatests.test('safeCallback return emptiness', test => { const args = [3, 2, 1]; const wrappedCb = common.safeCallback(args); test.strictSame(wrappedCb, common.emptiness); @@ -55,7 +55,7 @@ metatests.test('safeCallback return emptiness', (test) => { test.end(); }); -metatests.test('onceCallback prevent callback twice', (test) => { +metatests.test('onceCallback prevent callback twice', test => { const callback = (...args) => { test.strictSame(args, ['A', 'B', 'C']); test.end(); @@ -67,7 +67,7 @@ metatests.test('onceCallback prevent callback twice', (test) => { wrappedCb(...args); }); -metatests.test('requiredCallback', (test) => { +metatests.test('requiredCallback', test => { const callback = (...args) => { test.strictSame(args, [100, 200, 300]); test.end(); @@ -78,7 +78,7 @@ metatests.test('requiredCallback', (test) => { wrappedCb(...args); }); -metatests.test('requiredCallback raise', (test) => { +metatests.test('requiredCallback raise', test => { const args = [-1, -2, -3]; try { const wrappedCb = common.requiredCallback(args); @@ -89,7 +89,7 @@ metatests.test('requiredCallback raise', (test) => { } }); -metatests.test('once', (test) => { +metatests.test('once', test => { const fn = () => { test.end(); }; @@ -98,7 +98,7 @@ metatests.test('once', (test) => { wrapped(); }); -metatests.test('once without function', (test) => { +metatests.test('once without function', test => { const wrapped = common.once(null); test.strictSame(wrapped, common.emptiness); wrapped(); diff --git a/test/curry.js b/test/curry.js index 77851a9c..c0755949 100644 --- a/test/curry.js +++ b/test/curry.js @@ -3,49 +3,49 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('curry(f)(1)(2)(3)', (test) => { - const sum = (x, y, z) => (x + y + z); +metatests.test('curry(f)(1)(2)(3)', test => { + const sum = (x, y, z) => x + y + z; const res = common.curry(sum)(1)(2)(3); test.strictSame(res, 6); test.end(); }); -metatests.test('curry(f, 1)(2)(3)', (test) => { - const sum = (x, y, z) => (x + y + z); +metatests.test('curry(f, 1)(2)(3)', test => { + const sum = (x, y, z) => x + y + z; const res = common.curry(sum, 1)(2)(3); test.strictSame(res, 6); test.end(); }); -metatests.test('curry(f, 1, 2)(3)', (test) => { - const sum = (x, y, z) => (x + y + z); +metatests.test('curry(f, 1, 2)(3)', test => { + const sum = (x, y, z) => x + y + z; const res = common.curry(sum, 1, 2)(3); test.strictSame(res, 6); test.end(); }); -metatests.test('curry(f, 1, 2, 3)', (test) => { - const sum = (x, y, z) => (x + y + z); +metatests.test('curry(f, 1, 2, 3)', test => { + const sum = (x, y, z) => x + y + z; const res = common.curry(sum, 1, 2, 3); test.strictSame(res, 6); test.end(); }); -metatests.test('curry(f, 1)(2, 3)', (test) => { - const sum = (x, y, z) => (x + y + z); +metatests.test('curry(f, 1)(2, 3)', test => { + const sum = (x, y, z) => x + y + z; const res = common.curry(sum, 1)(2, 3); test.strictSame(res, 6); test.end(); }); -metatests.test('curry(f)(1, 2, 3)', (test) => { - const sum = (x, y, z) => (x + y + z); +metatests.test('curry(f)(1, 2, 3)', test => { + const sum = (x, y, z) => x + y + z; const res = common.curry(sum)(1, 2, 3); test.strictSame(res, 6); test.end(); }); -metatests.testSync('multiple curry of sum(x, y)', (test) => { +metatests.testSync('multiple curry of sum(x, y)', test => { const sum = (x, y) => x + y; const sumCurry = common.curry(sum); const addOne = sumCurry(1); @@ -56,7 +56,7 @@ metatests.testSync('multiple curry of sum(x, y)', (test) => { test.strictSame(addTwo(20), 22); }); -metatests.testSync('multiple curry of sum(x, y, z)', (test) => { +metatests.testSync('multiple curry of sum(x, y, z)', test => { const sum = (x, y, z) => x + y + z; const sumCurry = common.curry(sum); const addOneTwo = sumCurry(1, 2); @@ -67,7 +67,7 @@ metatests.testSync('multiple curry of sum(x, y, z)', (test) => { test.strictSame(addTwoThree(20), 25); }); -metatests.testSync('curry of identity', (test) => { +metatests.testSync('curry of identity', test => { const id = x => x; const idCurry = common.curry(id); test.strictSame(idCurry(10), 10); @@ -76,13 +76,13 @@ metatests.testSync('curry of identity', (test) => { test.strictSame(common.curry(id, 10), 10); }); -metatests.testSync('curry of unit', (test) => { +metatests.testSync('curry of unit', test => { const unit = () => 42; const unitCurry = common.curry(unit); test.strictSame(unitCurry(), 42); }); -metatests.testSync('redundant args must be ignored', (test) => { +metatests.testSync('redundant args must be ignored', test => { const add = (x, y) => x + y; const addCurry = common.curry(add); test.strictSame(addCurry(1, 2, 4), 3); diff --git a/test/curryN.js b/test/curryN.js index 0ca8f439..6fcf5785 100644 --- a/test/curryN.js +++ b/test/curryN.js @@ -3,8 +3,8 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('curryN', (test) => { - const sum = (x, y, z) => (x + y + z); +metatests.test('curryN', test => { + const sum = (x, y, z) => x + y + z; const sumC = common.curryN(sum, 2, 1); const sumC2 = sumC(2); const res = sumC2(3); diff --git a/test/data.js b/test/data.js index 4aadfa1d..d2790679 100644 --- a/test/data.js +++ b/test/data.js @@ -82,45 +82,45 @@ metatests.case('Common / data types', { common }, { ], }); -metatests.test('setByPath', (test) => { +metatests.test('setByPath', test => { const obj = { a: {} }; test.assert(common.setByPath(obj, 'a.b.c', 42)); test.strictSame(obj.a.b.c, 42); test.end(); }); -metatests.test('setByPath non-object', (test) => { +metatests.test('setByPath non-object', test => { const obj = { a: 10 }; test.assertNot(common.setByPath(obj, 'a.b.c', 42)); test.end(); }); -metatests.test('setByPath non-object first', (test) => { +metatests.test('setByPath non-object first', test => { const nonobj = 10; test.assertNot(common.setByPath(nonobj, 'a.b.c', 42)); test.end(); }); -metatests.test('setByPath non-object last', (test) => { +metatests.test('setByPath non-object last', test => { const obj = { a: { b: 10 } }; test.assertNot(common.setByPath(obj, 'a.b.c', 42)); test.end(); }); -metatests.test('deleteByPath', (test) => { +metatests.test('deleteByPath', test => { const obj = { a: { b: { c: 42 } } }; test.assert(common.deleteByPath(obj, 'a.b.c')); test.assertNot(obj.a.b.c); test.end(); }); -metatests.test('deleteByPath non-existent', (test) => { +metatests.test('deleteByPath non-existent', test => { const obj = { a: {} }; test.assertNot(common.deleteByPath(obj, 'a.b.c')); test.end(); }); -metatests.test('deleteByPath non-existent last', (test) => { +metatests.test('deleteByPath non-existent last', test => { const obj = { a: { b: {} } }; test.assertNot(common.deleteByPath(obj, 'a.b.c')); test.end(); diff --git a/test/either.js b/test/either.js index 105edeb7..a391cee4 100644 --- a/test/either.js +++ b/test/either.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('either', (test) => { +metatests.test('either', test => { const fnEither = common.either(x => x * 2); const res = fnEither(1, 2); @@ -12,9 +12,9 @@ metatests.test('either', (test) => { test.end(); }); -metatests.test('either with one error and one success', (test) => { +metatests.test('either with one error and one success', test => { const fnError = new Error('either with error'); - const fn = (x) => { + const fn = x => { if (x === 1) { throw fnError; } else { @@ -29,10 +29,10 @@ metatests.test('either with one error and one success', (test) => { test.end(); }); -metatests.test('either with all errors', (test) => { +metatests.test('either with all errors', test => { const fnError1 = new Error('either with error 1'); const fnError2 = new Error('either with error 2'); - const fn = (x) => { + const fn = x => { if (x === 1) { throw fnError1; } else { diff --git a/test/enum.js b/test/enum.js index 899d537d..3a56700d 100644 --- a/test/enum.js +++ b/test/enum.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const { Enum } = require('..'); -metatests.test('Enum with key/value', (test) => { +metatests.test('Enum with key/value', test => { const Month = Enum.from({ Jan: 'January', Feb: 'February', @@ -16,7 +16,7 @@ metatests.test('Enum with key/value', (test) => { Sep: 'September', Oct: 'October', Nov: 'November', - Dec: 'December' + Dec: 'December', }); test.strictSame(typeof Month, 'function'); @@ -38,7 +38,7 @@ metatests.test('Enum with key/value', (test) => { test.end(); }); -metatests.test('Enum string month keys', (test) => { +metatests.test('Enum string month keys', test => { const Month = Enum.from( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' @@ -64,7 +64,7 @@ metatests.test('Enum string month keys', (test) => { test.end(); }); -metatests.test('Enum string month typed keys', (test) => { +metatests.test('Enum string month typed keys', test => { const Month = Enum.from({ 1: 'January', 2: 'February', @@ -77,7 +77,7 @@ metatests.test('Enum string month typed keys', (test) => { 9: 'September', 10: 'October', 11: 'November', - 12: 'December' + 12: 'December', }); test.strictSame(typeof Month, 'function'); @@ -99,7 +99,7 @@ metatests.test('Enum string month typed keys', (test) => { test.end(); }); -metatests.test('Enum hundreds keys', (test) => { +metatests.test('Enum hundreds keys', test => { const Hundreds = Enum.from(100, 200, 300, 400, 500); const h100 = Hundreds.from(100); @@ -134,7 +134,7 @@ metatests.test('Enum hundreds keys', (test) => { test.end(); }); -metatests.test('Enum hundreds keys array', (test) => { +metatests.test('Enum hundreds keys array', test => { const Hundreds = Enum.from([100, 200, 300, 400, 500]); test.strictSame(Hundreds.from(0), Enum.NaE); @@ -147,7 +147,7 @@ metatests.test('Enum hundreds keys array', (test) => { test.end(); }); -metatests.test('Enum.NaE property', (test) => { +metatests.test('Enum.NaE property', test => { test.strictSame(Object.getOwnPropertyDescriptor(Enum, 'NaE'), { writable: false, enumerable: false, diff --git a/test/events.js b/test/events.js index f6e229eb..6c37ca11 100644 --- a/test/events.js +++ b/test/events.js @@ -4,7 +4,7 @@ const metatests = require('metatests'); const events = require('events'); const common = require('..'); -metatests.test('emitter', (test) => { +metatests.test('emitter', test => { const ee = common.emitter(); ee.on('name', () => { test.end(); @@ -12,7 +12,7 @@ metatests.test('emitter', (test) => { ee.emit('name'); }); -metatests.test('forward all events', (test) => { +metatests.test('forward all events', test => { test.plan(3); const sourceEmitter = common.emitter(); @@ -37,7 +37,7 @@ metatests.test('forward all events', (test) => { sourceEmitter.emit('testEvent3'); }); -metatests.test('forward all events by method', (test) => { +metatests.test('forward all events by method', test => { test.plan(3); const sourceEmitter = common.emitter(); @@ -62,7 +62,7 @@ metatests.test('forward all events by method', (test) => { sourceEmitter.emit('testEvent3'); }); -metatests.test('forward a single event', (test) => { +metatests.test('forward a single event', test => { test.plan(1); const sourceEventEmitter = new events.EventEmitter(); @@ -77,7 +77,7 @@ metatests.test('forward a single event', (test) => { sourceEventEmitter.emit('testEvent'); }); -metatests.test('forward a single event under a new name', (test) => { +metatests.test('forward a single event under a new name', test => { test.plan(1); const sourceEventEmitter = new events.EventEmitter(); @@ -94,7 +94,7 @@ metatests.test('forward a single event under a new name', (test) => { sourceEventEmitter.emit('testEvent'); }); -metatests.test('forward multiple events', (test) => { +metatests.test('forward multiple events', test => { test.plan(2); const sourceEventEmitter = new events.EventEmitter(); diff --git a/test/id.js b/test/id.js index e72ef870..e150fe9c 100644 --- a/test/id.js +++ b/test/id.js @@ -8,7 +8,7 @@ const common = require('..'); const config = { characters: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', secret: 'secret', - length: 64 + length: 64, }; metatests.case('Common / id', { common }, { @@ -20,7 +20,7 @@ metatests.case('Common / id', { common }, { [config, '', false], ], 'common.generateSID': [ - [config, (result) => (result.length === 64)], + [config, result => result.length === 64], ], 'common.crcSID': [ [ @@ -29,8 +29,8 @@ metatests.case('Common / id', { common }, { config.length - 4, config.characters ), - (result) => (result.length === 4) - ] + result => result.length === 4, + ], ], 'common.idToChunks': [ [0, ['0000', '0000']], @@ -38,7 +38,7 @@ metatests.case('Common / id', { common }, { [30, ['001e', '0000']], [123456789, ['cd15', '075b']], [123456789123, ['1a83', 'be99', '001c']], - [9007199254740991, ['ffff', 'ffff', 'ffff', '001f']] + [9007199254740991, ['ffff', 'ffff', 'ffff', '001f']], ], 'common.idToPath': [ [0, '0000/0000'], @@ -46,7 +46,7 @@ metatests.case('Common / id', { common }, { [30, '001e/0000'], [123456789, 'cd15/075b'], [123456789123, '1a83/be99/001c'], - [9007199254740991, 'ffff/ffff/ffff/001f'] + [9007199254740991, 'ffff/ffff/ffff/001f'], ], 'common.pathToId': [ ['0000/0000', 0], @@ -64,11 +64,11 @@ metatests.case('Common / id', { common }, { ['1a83/be99/001c', 123456789123], ['0000/0000/1000', 17592186044416], ['0000/0000/ffff', 281470681743360], - ['ffff/ffff/ffff/001f', 9007199254740991] - ] + ['ffff/ffff/ffff/001f', 9007199254740991], + ], }); -metatests.test('generateStorageKey', (test) => { +metatests.test('generateStorageKey', test => { const key = common.generateStorageKey(); test.strictSame(Array.isArray(key), true); test.strictSame(key.length, 3); diff --git a/test/math.js b/test/math.js index 0d5646dc..3fa3c3dd 100644 --- a/test/math.js +++ b/test/math.js @@ -5,15 +5,15 @@ const common = require('..'); metatests.case('Common / math', { common }, { 'common.random': [ - [ 0, 10, (result) => (result >= 0 && result <= 10)], - [ 1, 10, (result) => (result >= 1 && result <= 10)], - [-1, 10, (result) => (result >= -1 && result <= 10)], - [10, 20, (result) => (result >= 10 && result <= 20)], - [10, 0, (result) => (result >= 0 && result <= 10)], - [20, (result) => (result >= 0 && result <= 20)], + [ 0, 10, result => result >= 0 && result <= 10], + [ 1, 10, result => result >= 1 && result <= 10], + [-1, 10, result => result >= -1 && result <= 10], + [10, 20, result => result >= 10 && result <= 20], + [10, 0, result => result >= 0 && result <= 10], + [20, result => result >= 0 && result <= 20], [10, 10, 10], ], 'common.cryptoRandom': [ - [(result) => (result >= 0 && result <= 1)], + [result => result >= 0 && result <= 1], ], }); diff --git a/test/mixin.js b/test/mixin.js index 7ef4622c..26b8b017 100644 --- a/test/mixin.js +++ b/test/mixin.js @@ -36,7 +36,7 @@ class Child extends Parent { common.mixin(Child.prototype, Lazy.prototype); -metatests.test('multiple inheritance with mixin', (test) => { +metatests.test('multiple inheritance with mixin', test => { const obj = new Child(); obj.method1(); obj.method2(); diff --git a/test/mp.js b/test/mp.js index 8c264881..8470e0db 100644 --- a/test/mp.js +++ b/test/mp.js @@ -12,20 +12,20 @@ const iface = { prop2: 1000, prop3: false, prop4: undefined, - prop5: null + prop5: null, }; iface.fn3 = function(x) { return x * 3; }; -metatests.test('methods', (test) => { +metatests.test('methods', test => { const result = common.methods(iface); test.strictSame(result, ['fn1', 'fn2', 'fn3']); test.end(); }); -metatests.test('properties', (test) => { +metatests.test('properties', test => { const result = common.properties(iface); test.strictSame(result, ['prop1', 'prop2', 'prop3', 'prop4', 'prop5']); test.end(); diff --git a/test/network.js b/test/network.js index b70ceb86..08cd4259 100644 --- a/test/network.js +++ b/test/network.js @@ -23,6 +23,6 @@ metatests.case('Common / network', { common }, { ['localhost:8080', 'localhost'], ], 'common.localIPs': [ - [[], (value) => Array.isArray(value)], + [[], value => Array.isArray(value)], ], }); diff --git a/test/omap.js b/test/omap.js index 4b129975..205096f2 100644 --- a/test/omap.js +++ b/test/omap.js @@ -3,10 +3,10 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('omap', (test) => { +metatests.test('omap', test => { const persons = { vlad: { age: 20, side: 'good' }, - dziuba: { age: 20, side: 'evil' } + dziuba: { age: 20, side: 'evil' }, }; const expected = { vlad: 'good', dziuba: 'evil' }; const result = common.omap(p => p.side, persons); diff --git a/test/partial.js b/test/partial.js index 9a1f5f6b..7f86849d 100644 --- a/test/partial.js +++ b/test/partial.js @@ -3,8 +3,8 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('partial ', (test) => { - const func = (a, b, c, d) => (a + b + c + d); +metatests.test('partial ', test => { + const func = (a, b, c, d) => a + b + c + d; const fn1 = common.partial(func); const fn2 = common.partial(func, 10); const fn3 = common.partial(func, 10, 20); diff --git a/test/replicate.js b/test/replicate.js index a69f0d61..42420900 100644 --- a/test/replicate.js +++ b/test/replicate.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('replicate', (test) => { +metatests.test('replicate', test => { const expected = [true, true, true, true, true]; const result = common.replicate(5, true); test.strictSame(result, expected); diff --git a/test/restLeft.js b/test/restLeft.js index 64848789..75bb4a5a 100644 --- a/test/restLeft.js +++ b/test/restLeft.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('restLeft', (test) => { +metatests.test('restLeft', test => { const expectedArgs = [3, 4, 5]; const expectedArg1 = 1; const expectedArg2 = 2; diff --git a/test/safe.js b/test/safe.js index 0d82a542..79e74bed 100644 --- a/test/safe.js +++ b/test/safe.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('safe require success', (test) => { +metatests.test('safe require success', test => { const safeRequire = common.safe(require); const result = safeRequire('./mp'); test.strictSame(!!result[0], false); @@ -11,7 +11,7 @@ metatests.test('safe require success', (test) => { test.end(); }); -metatests.test('safe require fail', (test) => { +metatests.test('safe require fail', test => { const safeRequire = common.safe(require); const result = safeRequire('./name'); test.strictSame(!!result[0], true); @@ -19,7 +19,7 @@ metatests.test('safe require fail', (test) => { test.end(); }); -metatests.test('safe parser success', (test) => { +metatests.test('safe parser success', test => { const parser = common.safe(JSON.parse); const result = parser('{"a":5}'); test.strictSame(!!result[0], false); @@ -27,7 +27,7 @@ metatests.test('safe parser success', (test) => { test.end(); }); -metatests.test('safe parser fail', (test) => { +metatests.test('safe parser fail', test => { const parser = common.safe(JSON.parse); const result = parser('{a:}'); test.strictSame(!!result[0], true); diff --git a/test/sort.js b/test/sort.js index f03d3cd6..81578f04 100644 --- a/test/sort.js +++ b/test/sort.js @@ -18,7 +18,7 @@ const CONFIG_FILES_PRIORITY = [ 'filestorage.js', 'mail.js', 'hosts.js', - 'routes.js' + 'routes.js', ]; metatests.case('Common / sort', { common }, { @@ -54,13 +54,13 @@ metatests.case('Common / sort', { common }, { ], }); -metatests.test('sortCompareDirectories', (test) => { +metatests.test('sortCompareDirectories', test => { const array = [ { name: 'file0.txt' }, { name: '/dir' }, { name: 'file1.txt' }, { name: 'file0.txt' }, - { name: '/foo' } + { name: '/foo' }, ]; const sorted = [ { name: '/dir' }, @@ -73,7 +73,7 @@ metatests.test('sortCompareDirectories', (test) => { test.end(); }); -metatests.test('sortCompareByName', (test) => { +metatests.test('sortCompareByName', test => { const array = [{ name: 'c' }, { name: 'a' }, { name: 'a' }, { name: 'b' }]; const sorted = [{ name: 'a' }, { name: 'a' }, { name: 'b' }, { name: 'c' }]; test.strictSame(array.sort(common.sortCompareByName), sorted); diff --git a/test/uint64.js b/test/uint64.js index d9ec3782..dff43155 100644 --- a/test/uint64.js +++ b/test/uint64.js @@ -90,7 +90,7 @@ metatests.test('Uint64 binary operators', test => { { values: [ '0b0000000000000000000000000000000000000000000000000000000000000010', - '0b0100000000000000000000000000000000000000000000000000000000000000' + '0b0100000000000000000000000000000000000000000000000000000000000000', ], operations: { add: '4000000000000002', @@ -104,7 +104,7 @@ metatests.test('Uint64 binary operators', test => { { values: [ '0b0000000000000000000000000000000000000000000000000000000000000001', - '0b1000000000000000000000000000000000000000000000000000000000000000' + '0b1000000000000000000000000000000000000000000000000000000000000000', ], operations: { add: '8000000000000001', diff --git a/test/utilities.js b/test/utilities.js index 73d7ab1d..24a4a2fd 100644 --- a/test/utilities.js +++ b/test/utilities.js @@ -3,13 +3,13 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('Check called filename/filepath', (test) => { +metatests.test('Check called filename/filepath', test => { test.ok(common.callerFilepath().endsWith('test/utilities.js')); test.strictSame(common.callerFilename(), 'utilities.js'); test.end(); }); -metatests.test('Check called filename/filepath parent', (test) => { +metatests.test('Check called filename/filepath parent', test => { child(test, 1); test.end(); }); diff --git a/test/zip.js b/test/zip.js index 31a962b8..f77dd3aa 100644 --- a/test/zip.js +++ b/test/zip.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('zip', (test) => { +metatests.test('zip', test => { const data = [ [1, 2, 3], ['one', 'two', 'three'], @@ -19,7 +19,7 @@ metatests.test('zip', (test) => { test.end(); }); -metatests.test('zip with no elements', (test) => { +metatests.test('zip with no elements', test => { const res = common.zip(); test.strictSame(res, []); test.end(); diff --git a/test/zipWith.js b/test/zipWith.js index be73f511..8c11db41 100644 --- a/test/zipWith.js +++ b/test/zipWith.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('zipWith', (test) => { +metatests.test('zipWith', test => { const data = [ [1, 2, 3], ['one', 'two', 'three'], diff --git a/tools/unicode-category-parser.js b/tools/unicode-category-parser.js index a2eb790e..153e5dbd 100644 --- a/tools/unicode-category-parser.js +++ b/tools/unicode-category-parser.js @@ -34,6 +34,7 @@ const UCD_LINK = 'http://www.unicode.org/Public/' + UNICODE_VERSION + const OUTPUT_PATH = path.join(__dirname, '../lib/unicode-categories.js'); +/* eslint-disable implicit-arrow-linebreak */ const getFileHeader = () => `// Copyright (c) 2017-2018 Metarhia contributors. Use of this source code is // governed by the MIT license that can be found in the LICENSE file. @@ -83,6 +84,7 @@ const getFileHeader = () => // Do not edit this file manually! /* eslint-disable */ module.exports = `; +/* eslint-enable implicit-arrow-linebreak */ const resultObject = {}; resultObject.addRange = range => { @@ -97,11 +99,11 @@ UNICODE_CATEGORIES.forEach(category => { resultObject[category] = []; }); -http.get(UCD_LINK, (res) => { +http.get(UCD_LINK, res => { const linereader = readline.createInterface({ input: res, historySize: 0 }); let prevCategory; let range = {}; - linereader.on('line', (line) => { + linereader.on('line', line => { const [code,, category] = line.split(';'); if (UNICODE_CATEGORIES.includes(category)) { const decimalCode = parseInt(code, 16);