Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/infinum/js-linters

Infinum's JS team linter rules
https://github.com/infinum/js-linters

eslint javascript lint linter open-source react rules tslint

Last synced: 10 days ago
JSON representation

Infinum's JS team linter rules

Awesome Lists containing this project

README

        

# @infinum/eslint-plugin

This package provides Infinum's ESLint [plugin](https://eslint.org/docs/latest/extend/plugins).

## Installation

```bash
npm install --save-dev @infinum/eslint-plugin
```

## Usage

The basic usage of this plugin is to extend the `plugin:@infinum/core` config in your ESLint configuration file.

```json
{
"extends": ["plugin:@infinum/core"]
}
```

However, we can also extend `.eslintrc` with additional configs. The idea is to have modular configs and that you can choose what rules you want to have on the project. E.g., there is no need to have `TypeScript` rules on a `JavaScript` project. The entire list of configs can be found in [`src/configs/index.ts`](src/configs/index.ts).

> NOTE: some configs require additional plugins to be installed. E.g., `@infinum/react` requires `eslint-plugin-react` and `eslint-plugin-react-hooks` to be installed.

### Angular Preset

Install the following packages:

```bash
npm install --save-dev eslint-plugin-rxjs eslint-plugin-jasmine @infinum/eslint-plugin
```

Add this to you `eslint` config:

```json
{
"extends": ["plugin:@infinum/core", "plugin:@infinum/typescript", "plugin:@infinum/angular"],
"parserOptions": {
"project": ["./tsconfig.json"]
}
}
```

### Infinum React Stack Preset

Install the following packages:

```bash
npm install -D -E \
@infinum/eslint-plugin@2 \
eslint-plugin-react@7 \
eslint-plugin-react-hooks@4 \
eslint-plugin-jsx-a11y@6 \
@typescript-eslint/eslint-plugin@7 \
@typescript-eslint/parser@7 \
@next/eslint-plugin-next@14 \
eslint-plugin-typescript-enum@2 \
[email protected]
```

Add this to you `eslint` config:

```json
{
"extends": [
"plugin:@infinum/core",
"plugin:@infinum/typescript",
"plugin:@infinum/react",
"plugin:@infinum/next-js",
"plugin:@infinum/chakra-ui"
],
"parserOptions": {
"project": ["./tsconfig.json"]
}
}
```

## License

The [MIT License](./LICENSE)

## Credits

`js-linters` is maintained and sponsored by
[Infinum](https://www.infinum.com).