@skyscanner/eslint-plugin-rules

1.1.1 • Public • Published

@skyscanner/eslint-plugin-rules

Eslint plugin containing custom rules used at Skyscanner.

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install @skyscanner/eslint-plugin-rules:

$ npm install @skyscanner/eslint-plugin-rules --save-dev

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

Usage

Add @skyscanner/eslint-plugin-rules to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- part:

{
  "plugins": ["@skyscanner/rules"]
}

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

{
  "rules": {
    "@skyscanner/rules/no-axios": "error",
    "@skyscanner/rules/forbid-component-props": "error"
  }
}

Supported Rules

no-axios

Detects code importing axios.

Axios it prone to sensitive information leaks due to inclusion of headers in errors it throws.

{
  "rules": {
    "@skyscanner/rules/no-axios": "<severity>"
  }
}

Where <severity> can be one of: error, warn off.

forbid-component-props

A fork of forbid-component-props.

Rule options

This rule extends the functionality of the upstream rule with a new property within the forbid config object, allowedForRegex.

Full api docs for upsteam see: forbid-component-props.

forbid.allowedForRegex

A string specifying a pattern of component names. Components that match this pattern are included in an allow list.

{
  "propName": "someProp",
  "allowedForRegex": "^Special",
  "message": "Avoid using someProp except on prefixed 'Special' components"
}

Package Sidebar

Install

npm i @skyscanner/eslint-plugin-rules

Weekly Downloads

63

Version

1.1.1

License

Apache-2.0

Unpacked Size

46.7 kB

Total Files

10

Last publish

Collaborators

  • skyscanner-koalasquad
  • frugoman
  • marianeumayer-skyscanner
  • ojcurt