-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use eslint-config-metarhia and fix linting issues #204
Conversation
lib/array.js
Outdated
// Shuffle an array | ||
// arr - array | ||
// Returns: array | ||
const shuffle = arr => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better remove ()
in such cases
const shuffle = arr => ( | |
const shuffle = arr => arr.sort(() => Math.random() - 0.5); |
lib/callbacks.js
Outdated
) => { | ||
// Empty asynchronous callback-last single-argument function | ||
// callback - function, callback to be called with (null) | ||
const nop = callback => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case can't be optimized to single-line
lib/array.js
Outdated
// Get last element of array | ||
// arr - array | ||
// Returns: element | ||
const last = arr => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I mean in all case like this, Nick knows
lib/strings.js
Outdated
// s - string | ||
// Returns: string | ||
// Example: escapeRegExp('/path/to/res?search=this.that') | ||
const escapeRegExp = s => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto here and below.
08788af
to
a70115e
Compare
lib/auth.js
Outdated
test: (password, option) => ( | ||
stringIncludesChars(password, unicodeCategories.Ll, option.number) | ||
), | ||
test: (password, option) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer:
test: (password, option) => stringIncludesChars(
password, unicodeCategories.Ll, option.number
),
lib/auth.js
Outdated
test: (password, options) => ( | ||
stringIncludesChars(password, unicodeCategories.Lu, options.number) | ||
), | ||
test: (password, options) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
lib/strings.js
Outdated
content.replace(HTML_ESCAPE_REGEXP, char => HTML_ESCAPE_CHARS[char]) | ||
); | ||
const htmlEscape = content => | ||
content.replace(HTML_ESCAPE_REGEXP, char => HTML_ESCAPE_CHARS[char]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const htmlEscape = content => content.replace(
HTML_ESCAPE_REGEXP,
char => HTML_ESCAPE_CHARS[char]
);
lib/strings.js
Outdated
path.extname(fileName).replace('.', '').toLowerCase() | ||
); | ||
const fileExt = fileName => | ||
path.extname(fileName).replace('.', '').toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const fileExt = fileName => path.extname(fileName)
.replace('.', '').toLowerCase();
lib/strings.js
Outdated
const capitalize = s => ( | ||
s.replace(CAPITALIZE_REGEXP, word => ( | ||
const capitalize = s => | ||
s.replace(CAPITALIZE_REGEXP, word => | ||
word.charAt(0).toUpperCase() + word.substr(1).toLowerCase() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const capitalize = s => s.replace(
CAPITALIZE_REGEXP,
word => word.charAt(0).toUpperCase() + word.substr(1).toLowerCase()
);
553e5fc
to
e12346a
Compare
@belochub please land this |
097dc0f
to
eb16cf5
Compare
eb16cf5
to
304c34e
Compare
Landed in 5ae54f2. |
Refs: metarhia/Metarhia#22