A set of eslint rules for performant JS
Works with [email protected]
Use like so:
// .eslintrc
{
"extends": "perf-standard",
"rules": {
"max-len": [0]
}
}
Also configure your package.json like so:
{
"scripts": {
"lint": "eslint $(git ls-files | grep '.js$')"
}
}
There are a lot of rules in this project; I will explain a few of them here for the ones that are non-trivial
There are a few modules that are banned and there are alternatives available.
lodash
,underscore
. These modules come with a few downsides. Namely that they are not performant and that they add many stacks to your stacktrace and flamegraphs. Favor plain loops, do not usemap()
and friends.async
. Async is a kitchen sink and not performant. Favor a library that discourages allocation of closures like https://github.com/Raynos/fanout-task
npm install eslint-config-perf-standard
npm test
- Raynos