https://github.com/skyscanner/eslint-plugin-rules
Eslint plugin respotirory containing all the public custom rules developed at Skyscanner
https://github.com/skyscanner/eslint-plugin-rules
Last synced: about 2 months ago
JSON representation
Eslint plugin respotirory containing all the public custom rules developed at Skyscanner
- Host: GitHub
- URL: https://github.com/skyscanner/eslint-plugin-rules
- Owner: Skyscanner
- License: apache-2.0
- Created: 2024-01-19T16:14:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-07T08:38:05.000Z (3 months ago)
- Last Synced: 2025-07-07T09:40:25.918Z (3 months ago)
- Language: JavaScript
- Size: 365 KB
- Stars: 0
- Watchers: 111
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# @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": ""
}
}
```Where `` 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": ""
}
}
```### 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"
}
```