6.0.0 • Published 7 months ago

eslint-plugin-backpack v6.0.0

Weekly downloads
347
License
Apache-2.0
Repository
github
Last release
7 months ago

eslint-plugin-backpack

Build Status

Eslint plugin to prevent magic arbitrary values and promote the use of Backpack tokens

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-backpack:

$ npm install eslint-plugin-backpack --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-backpack globally.

Usage

Add backpack to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["backpack"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "backpack/rule-name": 2
  }
}

Supported Rules

use-tokens

Available for colours and length values. Will prevent the use of a hardcoded colour if a Backpack token is available for the given value.

Configuration

NameTypeRequired
autoImportbooleanfalse
platformstringfalse
tokensPackageshape({ web: string, native: string })false
typeofbooleanfalse
{
  "rules": {
    "backpack/use-tokens": [2, {
      "autoImport": true,
      "platform": "web",
      "tokensPackage": {
        "web": "@skyscanner/bpk-foundations-web/tokens/base.es6",
      },
    }]
  }
}

use-components

Will prevent the usage of built-in components when a Backpack option is available.

Configuration

NameTypeRequired
autoImportbooleanfalse
platformstringfalse
{
  "rules": {
    "backpack/use-components": [2, {
      "autoImport": true,
      "platform": "web"
    }]
  }
}
6.0.0

7 months ago

5.0.0

10 months ago

4.0.1

1 year ago

4.0.0

2 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.4-beta.0

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0-alpha.1

4 years ago

2.0.0-alpha.2

4 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.2.3

5 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago