muenzpraeger / eslint-plugin-inclusive-language

An ESLint plugin to raise awareness for using inclusive language not only in your codebase, but in life.
MIT License
56 stars 10 forks source link

Very slow #33

Closed bbgvalayev closed 3 years ago

bbgvalayev commented 3 years ago

The plugin was very easy to integrate and configuration is extremely flexible however linting time increases by a lot, can this be improved?

Rule                                   |  Time (ms) | Relative
:--------------------------------------|-----------:|--------:
inclusive-language/use-inclusive-words | 189296.426 |    83.0%
indent                                 |   4713.429 |     2.1%
import/no-extraneous-dependencies      |   3174.471 |     1.4%
react/void-dom-elements-no-children    |   2250.245 |     1.0%
react/no-direct-mutation-state         |   1991.292 |     0.9%
react/default-props-match-prop-types   |   1835.533 |     0.8%
react/no-deprecated                    |   1669.236 |     0.7%
react/display-name                     |   1013.334 |     0.4%
react/no-string-refs                   |    943.860 |     0.4%
react/prefer-stateless-function        |    926.294 |     0.4%
github-actions[bot] commented 3 years ago

Welcome! 👋

Thanks you for creating the issue. 🙌 I will come back to this as soon as possible.

muenzpraeger commented 3 years ago

@bbgvalayev Thanks for reporting. That was solved actually today. I just published 2.1.1, which should improve it a lot. Would love to see the stat changes here with the new version.

bbgvalayev commented 3 years ago

Oh nice, I will give it a try, one thing I realized is that performance was affected when I added additional words like:

"inclusive-language/use-inclusive-words": [
            "error",
            {
                "words": [
                    {
                        "word": "dummy",
                        "suggestions": ["mock", "placeholder", "sample value"],
                        "explanation": "The usage of the non-inclusive word '{{word}}' is discouraged, use '{{suggestion}}' instead."
                    },
                    {
                        "word": "handicap",
                        "suggestions": ["disable", "disability"],
                        "explanation": "The usage of the non-inclusive word '{{word}}' is discouraged, use '{{suggestion}}' instead."
                    }
                ],
                "autofix": false,
                "lintStrings": true
            }
        ]
muenzpraeger commented 3 years ago

Yup. That was one of the identified bottlenecks. And regex.

See the thread here how things evolved.

https://github.com/muenzpraeger/eslint-plugin-inclusive-language/pull/31

Closing this.

bbgvalayev commented 3 years ago

Ok, does much better, updated results:

Rule                                   | Time (ms) | Relative
:--------------------------------------|----------:|--------:
indent                                 |  3277.074 |    14.2%
import/no-extraneous-dependencies      |  2037.235 |     8.8%
react/void-dom-elements-no-children    |  1432.298 |     6.2%
react/no-direct-mutation-state         |  1047.166 |     4.5%
react/no-deprecated                    |   966.963 |     4.2%
react/default-props-match-prop-types   |   942.847 |     4.1%
react/display-name                     |   610.532 |     2.7%
react/prefer-stateless-function        |   594.925 |     2.6%
inclusive-language/use-inclusive-words |   592.754 |     2.6%
react/no-string-refs                   |   567.729 |     2.5%