Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

eslint-plugin-perf-standard

Raynos2.9k1.0.3

A set of eslint rules for performant JS

readme

eslint-plugin-perf-standard

A set of custom plugins to enforce high performance JS

Example

{
    "rules": {
        "perf-standard/no-instanceof-guard": 2,
        "perf-standard/no-self-in-constructor": 2,
        "perf-standard/check-function-inline": 1
    }
}

Currently the plugins we have are:

no-instanceof-gaurd

This disables the common anti-pattern of:

function Foo() {
  if (!(this instanceof Foo)) return new Foo()
}

no-self-in-constructor

This disables the ability to use var self = this in the body of a constructor function.

For performance reasons we should use this.foo = bar; in constructors.

Using var self = this in methods is fine.

check-function-inline

This lint rule checks to see if a function is between 600 and 660 characters and then warns that the function will not be inlined in V8.

Installation

npm install eslint-plugin-perf-standard

Tests

npm test

Contributors

  • Raynos

MIT Licensed