Skip to content

Commit

Permalink
review eslint core rules: require assignment operator shorthand whe…
Browse files Browse the repository at this point in the history
…re possible
  • Loading branch information
zloirock committed Aug 21, 2023
1 parent cf22aac commit 6a92722
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/core-js/internals/ieee754.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var pack = function (number, mantissaLength, bytes) {
exponent = eMax;
} else if (exponent + eBias >= 1) {
mantissa = roundToEven((number * c - 1) * pow(2, mantissaLength));
exponent = exponent + eBias;
exponent += eBias;
} else {
mantissa = roundToEven(number * pow(2, eBias - 1) * pow(2, mantissaLength));
exponent = 0;
Expand Down Expand Up @@ -103,8 +103,8 @@ var unpack = function (buffer, mantissaLength) {
} else if (exponent === eMax) {
return mantissa ? NaN : s ? -Infinity : Infinity;
} else {
mantissa = mantissa + pow(2, mantissaLength);
exponent = exponent - eBias;
mantissa += pow(2, mantissaLength);
exponent -= eBias;
} return (s ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/es.regexp.constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var handleNCG = function (string) {
for (; index <= length; index++) {
chr = charAt(string, index);
if (chr === '\\') {
chr = chr + charAt(string, ++index);
chr += charAt(string, ++index);
} else if (chr === ']') {
brackets = false;
} else if (!brackets) switch (true) {
Expand Down
2 changes: 2 additions & 0 deletions tests/eslint/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ const base = {
'object-shorthand': ERROR,
// require newlines around variable declarations with initializations
'one-var-declaration-per-line': [ERROR, 'initializations'],
// require assignment operator shorthand where possible
'operator-assignment': [ERROR, 'always'],
// require using arrow functions for callbacks
'prefer-arrow-callback': ERROR,
// require const declarations for variables that are never reassigned after declared
Expand Down

0 comments on commit 6a92722

Please sign in to comment.