# eslint-plugin-smile

> Smile ESLint rules for js, ts, react, vue, angular, next...

Latest version **0.5.0** (published 2024-04-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-smile
pnpm add eslint-plugin-smile
yarn add eslint-plugin-smile
bun add eslint-plugin-smile
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2024-04-10 |
| First published | 2023-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 6 |
| Unpacked size | 87.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Tony Cabaye |
| Maintainers | tonai |
| Keywords | eslint, typescript, react, vue, angular, next |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-smile
- Repository: https://github.com/Smile-SA/eslint-plugin-smile
- Issues: https://github.com/Smile-SA/eslint-plugin-smile/issues
- npm.io page: https://npm.io/package/eslint-plugin-smile

## Dependencies (6)

- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^2.28.1
- [eslint-plugin-cypress](https://npm.io/package/eslint-plugin-cypress.md) ^2.14.0
- [eslint-config-prettier](https://npm.io/package/eslint-config-prettier.md) ^9.0.0
- [eslint-plugin-prettier](https://npm.io/package/eslint-plugin-prettier.md) ^5.0.0
- [eslint-plugin-storybook](https://npm.io/package/eslint-plugin-storybook.md) ^0.6.13
- [eslint-plugin-testing-library](https://npm.io/package/eslint-plugin-testing-library.md) ^6.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.5.0 (latest) — 2024-04-10
- 0.4.0 — 2023-11-23
- 0.3.3 — 2023-11-22
- 0.3.2 — 2023-09-12
- 0.3.1 — 2023-09-12
- 0.3.0 — 2023-09-12
- 0.2.2 — 2023-06-07
- 0.2.1 — 2023-05-12
- 0.2.0 — 2023-02-06
- 0.1.0 — 2023-02-06
- 0.0.2 — 2023-02-06
- 0.0.1 — 2023-02-06

## README

# `eslint-plugin-smile`

This ESLint configuration enforces some rules for eslint.

## Installation

Assuming you already have ESLint installed, run:

```sh
# npm
npm install eslint-plugin-smile --save-dev

# yarn
yarn add eslint-plugin-smile --dev
```

## Framework configuration

### JavaScript project

Update `.eslintrc.json` with:

```json
{
  "extends": ["plugin:smile/js"]
}
```

For TypeScript support see [TypeScript configuration](#typescript).

### React project

Install peerDependency:

```bash
npm i -D eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-refresh
```

And update `.eslintrc.json` with:

```json
{
  "extends": ["plugin:smile/react"]
}
```

For TypeScript support see [TypeScript configuration](#typescript).

### Vue project

Install peerDependency:

```bash
npm i -D eslint-plugin-vue
```

And update `.eslintrc.json` with:

```json
{
  "extends": ["plugin:smile/vue"]
}
```

For TypeScript also install following dependency:

```bash
npm i -D @vue/eslint-config-prettier @vue/eslint-config-typescript @rushstack/eslint-patch
```

And update `.eslintrc.json` with:

```js
require('@rushstack/eslint-patch/modern-module-resolution');

module.exports = {
  extends: ['plugin:smile/vue-ts'],
};
```

And see [TypeScript configuration](#typescript).

### Angular project

You can eslint to your project with `npm run ng add @angular-eslint/schematics`.

Then update `.eslintrc.json` with:

```json
{
  "extends": ["plugin:smile/angular"]
}
```

And see [TypeScript configuration](#typescript).

Also see [Prettier configuration](#prettier-configuration)

### Next project

Install peerDependency:

```bash
npm i -D eslint-config-next
```

And update `.eslintrc.json` with:

```json
{
  "extends": ["plugin:smile/next"]
}
```

For TypeScript support see [TypeScript configuration](#typescript).

### Nuxt project

Install peerDependency:

```bash
npm i -D @nuxt/eslint-config eslint-plugin-nuxt
```

And update `.eslintrc.json` with:

```json
{
  "extends": ["plugin:smile/nuxt"]
}
```

For TypeScript support see [TypeScript configuration](#typescript).

## Tools configurations

### Jest project

If you use Jest in your project you can add the `plugin:smile/jest` configuration:

Install peerDependency:

```bash
npm i -D eslint-plugin-jest eslint-plugin-testing-library
```

And update `.eslintrc.json` with:

```json
{
  "extends": ["plugin:smile/jest"]
}
```

### Cypress

Cypress files will be automatically checked with any framework configuration.

### Storybook

Storybook files will be automatically checked with any framework configuration.

## TypeScript configuration

Install additional peerDependency:

```bash
npm i -D eslint-import-resolver-typescript @typescript-eslint/eslint-plugin @typescript-eslint/parser
```

TypeScript is already supported in following configurations:

- `plugin:smile/js`
- `plugin:smile/react`
- `plugin:smile/angular`
- `plugin:smile/next`
- `plugin:smile/nuxt`

For Vue use `plugin:smile/vue-ts` instead.

If you want to use additional rules that require type checking (see https://typescript-eslint.io/linting/typed-linting/) you can add install additional peerDependency:

```bash
npm i -D @typescript-eslint/eslint-plugin @typescript-eslint/parser
```

And add the following configuration `plugin:smile/ts` (in addition to your framework configuration) and add the `parserOptions.project` option (see https://typescript-eslint.io/packages/parser/#project).

Example:

```json
{
  "extends": ["plugin:smile/next", "plugin:smile/ts"],
  "parserOptions": {
    "project": ["./tsconfig.json"]
  }
}
```

## Prettier configuration

This package use `eslint-plugin-prettier` to format the code with `prettier` through `eslint`.

We recommend using a `.prettierrc` file a the root of your project and apply the following configuration:

```json
{
  "singleQuote": true
}
```

Also create a `.editorconfig` file with:

```ini
[*]
charset = utf-8
insert_final_newline = true
end_of_line = lf
indent_style = space
indent_size = 2
max_line_length = 80
trim_trailing_whitespace = true
```

For angular add the following configuration into the `.prettierrc` file:

```json
{
  "overrides": [
    {
      "files": "*.html",
      "options": {
        "parser": "angular"
      }
    }
  ]
}
```

## Custom Configuration

You can override some rules in the rule section:

```js
{
  "extends": ["plugin:smile/js"],
  "rules": {
    "no-underscore-dangle": ["error", { allow: ["__schema"] }],
    // ...
  }
}
```

---
_Source: https://npm.io/package/eslint-plugin-smile · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
