npm package: @rainstormy/presets-eslint-preact
Description: A predefined, opinionated ESLint configuration suitable for any web project with Preact components.
Author: Steffen Diswal
Latest version: 1.0.0-rc.0

# Preact Preset for ESLint

This package provides a predefined, opinionated [ESLint](https://eslint.org) configuration suitable for any [TypeScript](https://www.typescriptlang.org)-based web project with [Preact](https://preactjs.com) components.

This preset configures a subset of rules from the following plugins, which are installed along with the preset package:

* [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y#supported-rules) (with rule names prefixed by `jsx-a11y/`)
* [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules) (with rule names prefixed by `react/`)
* [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks#custom-configuration) (with rule names prefixed by `react-hooks/`)

Additionally, it includes the following presets:

* [@rainstormy/presets-eslint-jsx](https://github.com/rainstormy/presets-web/tree/main/packages/presets-eslint-jsx)
* [@rainstormy/presets-eslint-react](https://github.com/rainstormy/presets-web/tree/main/packages/presets-eslint-react)

## Installation
Install the `@rainstormy/presets-eslint-preact` package and its peer dependencies:

```shell
npm install --save-dev @rainstormy/presets-eslint-preact @rainstormy/presets-eslint eslint typescript
```

```shell
pnpm install --save-dev @rainstormy/presets-eslint-preact @rainstormy/presets-eslint eslint typescript
```

```shell
yarn add --dev @rainstormy/presets-eslint-preact @rainstormy/presets-eslint eslint typescript
```

## Usage
Create or extend a [flat ESLint configuration file](https://eslint.org/docs/latest/use/configure/configuration-files-new) (`eslint.config.js`) and apply the `eslintPresetPreact` preset.

For example (with the default options in comments):

```javascript
import { eslintPresets } from "@rainstormy/presets-eslint"
import { eslintPresetPreact } from "@rainstormy/presets-eslint-preact"

export default eslintPresets({
	additionalPresets: [
		// ...other presets...
		eslintPresetPreact({
			// targetFilePatterns: ["**/*.@(jsx|tsx)"],
		}),
	],
})
```

### In Combination with Storybook, Tailwind CSS, and Testing Library
For example (with the default options applied):

```javascript
import {
	eslintPresetAmbientTypeScriptModules,
	eslintPresetTestData,
	eslintPresets,
} from "@rainstormy/presets-eslint"
import { eslintPresetPreact } from "@rainstormy/presets-eslint-preact"
import { eslintPresetStorybook } from "@rainstormy/presets-eslint-storybook"
import { eslintPresetTailwind } from "@rainstormy/presets-eslint-tailwind"
import { eslintPresetTestingLibrary } from "@rainstormy/presets-eslint-testing-library"
import { eslintPresetVitest } from "@rainstormy/presets-eslint-vitest"

export default eslintPresets({
	additionalPresets: [
		eslintPresetAmbientTypeScriptModules(),
		eslintPresetPreact(),
		eslintPresetStorybook(),
		eslintPresetTailwind(),
		eslintPresetTestData(),
		eslintPresetTestingLibrary(),
		eslintPresetVitest(),
	],
})
```