Skip to content

Commit 2508066

Browse files
committed
[eslint] enable and manually fix array-callback-return
1 parent 28914aa commit 2508066

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"no-void": 1,
4040
"no-continue": 1,
4141
"global-require": 1,
42-
"array-callback-return": 1,
4342
"no-restricted-syntax": 1,
4443
"implicit-arrow-linebreak": 1,
4544
"valid-jsdoc": 1,

lib/rules/jsx-sort-props.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,10 @@ function validateReservedFirstConfig(context, reservedFirst) {
167167
if (reservedFirst) {
168168
if (Array.isArray(reservedFirst)) {
169169
// Only allow a subset of reserved words in customized lists
170-
// eslint-disable-next-line consistent-return
171-
const nonReservedWords = reservedFirst.filter((word) => {
172-
if (!isReservedPropName(word, RESERVED_PROPS_LIST)) {
173-
return true;
174-
}
175-
});
170+
const nonReservedWords = reservedFirst.filter(word => !isReservedPropName(
171+
word,
172+
RESERVED_PROPS_LIST
173+
));
176174

177175
if (reservedFirst.length === 0) {
178176
return function (decl) {

lib/rules/no-access-state-in-setstate.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = {
4848
CallExpression(node) {
4949
// Appends all the methods that are calling another
5050
// method containing this.state to the methods array
51-
methods.map((method) => {
51+
methods.forEach((method) => {
5252
if (node.callee.name === method.methodName) {
5353
let current = node.parent;
5454
while (current.type !== 'Program') {
@@ -70,7 +70,7 @@ module.exports = {
7070
while (current.type !== 'Program') {
7171
if (isFirstArgumentInSetStateCall(current, node)) {
7272
const methodName = node.callee.name;
73-
methods.map((method) => {
73+
methods.forEach((method) => {
7474
if (method.methodName === methodName) {
7575
context.report(
7676
method.node,
@@ -145,10 +145,12 @@ module.exports = {
145145
if (isFirstArgumentInSetStateCall(current, node)) {
146146
vars
147147
.filter(v => v.scope === context.getScope() && v.variableName === node.name)
148-
.map(v => context.report(
149-
v.node,
150-
'Use callback in setState when referencing the previous state.'
151-
));
148+
.forEach((v) => {
149+
context.report(
150+
v.node,
151+
'Use callback in setState when referencing the previous state.'
152+
);
153+
});
152154
}
153155
current = current.parent;
154156
}

0 commit comments

Comments
 (0)