Skip to content

ESLint: Enforce array destructuring #238

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

Merged
merged 1 commit into from
Apr 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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