Skip to content

Commit

Permalink
ESLint: Enforce array destructuring
Browse files Browse the repository at this point in the history
This is a follow-up to #237
  • Loading branch information
josephfrazier authored and slevithan committed Apr 23, 2018
1 parent cc11a5d commit 956747f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ module.exports = {
"prefer-destructuring": [
"error",
{
"array": false,
"array": true,
"object": true
}
],
Expand Down
4 changes: 2 additions & 2 deletions src/xregexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ function XRegExp(pattern, flags) {
pos += (result.matchLength || 1);
} else {
// Get the native token at the current position
const token = XRegExp.exec(appliedPattern, nativeTokens[scope], pos, 'sticky')[0];
const [token] = XRegExp.exec(appliedPattern, nativeTokens[scope], pos, 'sticky');
output += token;
pos += token.length;
if (token === '[' && scope === defaultScope) {
Expand Down Expand Up @@ -1525,7 +1525,7 @@ fixed.replace = function(search, replacement) {
// Change the `args[0]` string primitive to a `String` object that can store
// properties. This really does need to use `String` as a constructor
args[0] = new String(args[0]);
groupsObject = args[0];
[groupsObject] = args;
}

// Store named backreferences
Expand Down
4 changes: 2 additions & 2 deletions tools/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ const createBmpRange = (r, {addBrackets} = {addBrackets: true}) => {
if (r.length === 0) {return '';}

const buf = [];
let start = r[0];
let end = r[0];
let [start] = r;
let [end] = r;
let predict = start + 1;
r = r.slice(1);

Expand Down

0 comments on commit 956747f

Please sign in to comment.