Skip to content

Commit cc11a5d

Browse files
josephfrazierslevithan
authored andcommitted
ESLint: Enforce object destructuring
This is a follow-up to slevithan#236 We could also do array destructuring, but it looked a little weird to me, so I left it out for now.
1 parent 7ee5818 commit cc11a5d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ module.exports = {
249249
"error",
250250
{
251251
"array": false,
252-
"object": false
252+
"object": true
253253
}
254254
],
255255
"prefer-numeric-literals": "error",

src/addons/matchrecursive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default (XRegExp) => {
7777
const sticky = flags.includes('y');
7878
// Flag `y` is controlled internally
7979
const basicFlags = flags.replace(/y/g, '');
80-
let escapeChar = options.escapeChar;
80+
let {escapeChar} = options;
8181
const vN = options.valueNames;
8282
const output = [];
8383
let openTokens = 0;

src/xregexp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const correctExecNpcg = nativ.exec.call(/()??/, '')[1] === undefined;
5555
// Check for ES6 `flags` prop support
5656
const hasFlagsProp = /x/.flags !== undefined;
5757
// Shortcut to `Object.prototype.toString`
58-
const toString = {}.toString;
58+
const {toString} = {};
5959

6060
function hasNativeFlag(flag) {
6161
// Can't check based on the presence of properties/getters since browsers might support such
@@ -1501,7 +1501,7 @@ fixed.replace = function(search, replacement) {
15011501

15021502
if (isRegex) {
15031503
if (search[REGEX_DATA]) {
1504-
captureNames = search[REGEX_DATA].captureNames;
1504+
({captureNames} = search[REGEX_DATA]);
15051505
}
15061506
// Only needed if `search` is nonglobal
15071507
origLastIndex = search.lastIndex;

0 commit comments

Comments
 (0)