Skip to content
This repository was archived by the owner on Mar 7, 2019. It is now read-only.

Commit 135fc2b

Browse files
Refactor prefer-reflect
1 parent 3460095 commit 135fc2b

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

environments/nodejs/v6.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ module.exports = {
3030
2,
3131
// Experimental object/rest spread (not in ES 2015)
3232
'ExperimentalRestProperty'
33-
],
34-
35-
// Suggest using Reflect API where applicable
36-
'prefer-reflect': 1
33+
]
3734
}
3835
}

standard/best-practices.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,16 @@ module.exports = {
211211
// modified after the initial assignment. This helps v8 to better optimise code at runtime.
212212
'prefer-const': 1,
213213

214-
// Suggest using Reflect methods where applicable
215-
'prefer-reflect': 1,
214+
// Suggest using Reflect API where applicable
215+
// Note that it's better to use `delete`, `call()` and `.apply()` directly because they will
216+
// throw an exception if there's something wrong with them (especially in the case of `delete`)
217+
'prefer-reflect': [1, {
218+
exceptions: [
219+
'apply',
220+
'call',
221+
'delete'
222+
]
223+
}],
216224

217225
// Suggest using the spread operator instead of .apply()
218226
// This rule is aimed to flag usage of Function.prototype.apply() that can be replaced with the

0 commit comments

Comments
 (0)