ESLint prefer-arrow-functions not flagging correctly

Viewed 38

Currently working on an .eslintrc file and I have implemented this so far

"prefer-arrow/prefer-arrow-functions": [
            "warn",
            {
                "disallowPrototype": false,
                "singleReturnOnly": true,
                "classPropertiesAllowed": false,
                "allowStandaloneDeclarations": true
            }
        ],
const a = activeABTests.reduce(function(accumulator: number, abtest: ABTestFunnelType): number {

I want this function above ^ to flag. It is not warning me in the Github check. It should flag and ask to be converted to an arrow function that looks like this:

const a = activeABTests.reduce((accumulator: number, abtest: ABTestFunnelType) => number {

I don't want to flag functions like this. I think the allowStandaloneDeclarations was the fix, but I am not sure.

image

I am getting two types of warnings:

Warning:   105:36  warning  Prefer using arrow functions over plain functions  prefer-arrow/prefer-arrow-functions

Warning:   31:5  warning  Use const or class constructors instead of named functions  prefer-arrow/prefer-arrow-functions

What can I do to make sure that the right functions are being flagged? I'm currently getting a ton of warnings but want to eliminate them/make sure they are the right ones.

0 Answers
Related