open-index/open-npm huggingface dataset:
npm package: @skyscanner/eslint-config-skyscanner
Description: Skyscanner's ESLint config.
Author: Backpack Design System
Latest version: 22.11.0

# eslint-config-skyscanner

This package includes the shareable ESLint configuration used by Skyscanner.

## Installation

```bash
npm install --save-dev @skyscanner/eslint-config-skyscanner
```

Add `"extends": "@skyscanner/eslint-config-skyscanner"` to your `.eslintrc`.

"@skyscanner/eslint-config-skyscanner" currently uses the Jest configuration by default. If your project uses Vitest, you can use the `@skyscanner/eslint-config-skyscanner/vitest` to override test files configuration. For example:

```json
// .eslintrc
{
  "extends": ["@skyscanner/eslint-config-skyscanner"],
  "overrides": [
    {
      "files": ["**/*.test.ts?(x)"],
      "extends": ["@skyscanner/eslint-config-skyscanner/vitest"]
    }
  ]
}
```

You can apply it directly at the root if your entire repository uses Vitest, or per project if only some projects, or parts of a project, use Vitest.

## React

`@skyscanner/eslint-config-skyscanner` will try to detect automatically the version of React installed.

If your project doesn't use it, or it is not installed in the same `package.json` as `@skyscanner/eslint-config-skyscanner`, it must be manually set in `.eslintrc`:

```
"settings": {
  "react": {
    "version": "16.4"
  }
}
```

## Browser compatibility

This eslint configuration includes the [compat plugin](https://github.com/amilajack/eslint-plugin-compat) to ensure browser compatibility based on your defined browserslist. In case of no browserslist defined, default values are taken into account, which may not be the exact ones you would expect. If your repository experiences issues regarding browser compatibility which are not relevant to your project, solve them by applying one of these two solutions:
- If the repository only contains **server side code** and browser compatibility doesn't apply, disable the plugin entirely:
```json
// .eslintrc
{
  extends: ['@skyscanner/eslint-config-skyscanner'],
  ...
  rules: {
    ...
    'compat/compat': 'off'
  }
}
```
- If the repository contains client side code, define a **browserslist** in your `package.json` by extending `browserslist-config-skyscanner`, which defines the current browser support required by Skyscanner:
```json
// package.json
{
  ...
  "browserslist": [
    "extends browserslist-config-skyscanner"
  ],
  ...
  "devDependencies": {
    ...
    "browserslist-config-skyscanner": "^5.0.0"
  }
}
```
npm package: @skyscanner/eslint-plugin-rules
Description: ESLint plugin containing rules used at Skyscanner
Author: Backpack Design System
Latest version: 1.4.0

# @skyscanner/eslint-plugin-rules

Eslint plugin containing custom rules used at Skyscanner.

You'll first need to install [ESLint](http://eslint.org):

```
$ 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:

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

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

```json
{
  "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.

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

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

### no-enum

A fork of the unmaintained [eslint-plugin-typescript-enum](https://github.com/shian15810/eslint-plugin-typescript-enum).

Detects code using a TypeScript `enum`.

Alternatives such as `as const` are a preferred option over non-native language features.

```json
{
  "rules": {
    "@skyscanner/rules/no-enum": "<severity>"
  }
}
```

### forbid-component-props

A fork of [forbid-component-props](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md). For details on why this is used in Skyscanner repositories, see: [why](src/rules/forbid-component-props/README.md#why-classname-usage-can-cause-specificity-problems).

For alternatives to using `className`, see [guidance](src/rules/forbid-component-props/README.md#guidance).

#### 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](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md).

##### `forbid.allowedForRegex`

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

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