@posaune0423/eslint-config
v1.3.0
Published
ESLint config for @posaune0423
Readme
@posaune0423/eslint-config
Install
bun add -D @posaune0423/eslint-configUsage
Create eslint.config.ts (recommended) or eslint.config.js in your project:
import posaune0423 from "@posaune0423/eslint-config";
export default posaune0423();React Project
import posaune0423 from "@posaune0423/eslint-config";
export default posaune0423({ react: true });Node.js Project
import posaune0423 from "@posaune0423/eslint-config";
export default posaune0423({ node: true });With Custom Overrides
import posaune0423 from "@posaune0423/eslint-config";
export default posaune0423(
{
react: true,
},
// Enable typed linting for your project (recommended when using TypeScript)
// See "Type-aware linting" section below.
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
ignores: ["dist", "node_modules"],
},
{
rules: {
"security/detect-object-injection": "off",
},
},
{
files: ["**/*.test.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
},
},
);Configuration Options
| Option | Type | Default | Description |
| ------------ | --------- | ------- | ------------------------------------------------ |
| typescript | boolean | true | Enable TypeScript rules (strictTypeChecked) |
| react | boolean | false | Enable React rules (@eslint-react + react-hooks) |
| node | boolean | false | Enable Node.js rules (eslint-plugin-n) |
What this config includes
This package exports a factory (default export) that returns an ESLint flat config array.
- Always enabled:
- ESLint core:
@eslint/jsrecommended - Imports:
eslint-plugin-import+ TypeScript-aware resolver (eslint-import-resolver-typescript) - Security:
eslint-plugin-securityrecommended - Unicorn: selected
eslint-plugin-unicornrules
- ESLint core:
- Optional:
- TypeScript:
typescript-eslintstrictTypeChecked+ a few opinionated rules (default: on) - React:
@eslint-react/eslint-plugin+react-hooks+react-you-might-not-need-an-effect - Node.js:
eslint-plugin-nflat recommended
- TypeScript:
Note: build output under dist/** is ignored by default.
Type-aware linting (TypeScript)
This config enables type-aware TypeScript rules (via typescript-eslint strict type-checked rules).
In most projects you should add a small override to turn on typed linting:
import posaune0423 from "@posaune0423/eslint-config";
export default posaune0423(
{},
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
);If you do not enable typed linting, rules that require type information (e.g. @typescript-eslint/no-deprecated) may error.
Rules overview
This config intentionally stays simple:
- Baseline: mostly "recommended" presets from ESLint / TypeScript ESLint / React / Security / Import
- Customizations: only the rules explicitly requested in this repo
- No splitting by
testFilesor by "typechecked vs non-typechecked"- Note:
@typescript-eslint/no-deprecatedrequires type information, so TypeScript linting is type-aware.
- Note:
Presets (recommended configs)
| Area | Preset / Config | What it does | Link |
| -------- | -------------------------------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| general | @eslint/js recommended | ESLint core recommended rules | @eslint/js |
| import | eslint-plugin-import (selected rules) | Import/order and module correctness | eslint-plugin-import |
| security | eslint-plugin-security recommended | Security best practices (always enabled) | eslint-plugin-security |
| ts | typescript-eslint strict type-checked | TypeScript rules that use type information | TypeScript ESLint |
| react | @eslint-react/eslint-plugin recommended | Modern React best-practice rules | @eslint-react/eslint-plugin |
| react | eslint-plugin-react-hooks recommended | Enforces the Rules of Hooks | eslint-plugin-react-hooks |
| react | eslint-plugin-react-you-might-not-need-an-effect recommended | Warns on common unnecessary useEffect patterns | eslint-plugin-react-you-might-not-need-an-effect |
| node | eslint-plugin-n recommended | Node.js best practices | eslint-plugin-n |
| misc | eslint-plugin-unicorn (selected rules) | Small correctness / readability improvements | eslint-plugin-unicorn |
Explicit customizations
| Area | Rule / Setting | Level | What it does |
| ----- | --------------------------------------------- | ----- | --------------------------------------------------------------------- |
| ts | @typescript-eslint/no-deprecated | warn | Disallow using code marked as @deprecated |
| ts | @typescript-eslint/no-explicit-any | error | Disallow the any type |
| ts | @typescript-eslint/no-unnecessary-condition | error | Disallow unnecessary conditions (includes unnecessary optional chain) |
| ts | @typescript-eslint/consistent-type-imports | error | Enforce import type { Foo } from "..." |
| react | unicorn/filename-case (kebabCase) | error | Enforce kebab-case filenames |
| react | no-restricted-syntax (React.* types) | error | Disallow React.Foo namespace types |
Project Structure
src/
index.ts # Public API (default export: posaune0423)
factory.ts # Factory function implementation
types.ts # TypeScript types
configs/ # Configuration objects
eslint.ts
typescript.ts
security.ts
react.ts
node.tsDevelopment
Tests
bun testPublish (npm)
Push a tag like v1.2.3 or publish a GitHub Release to trigger npm publish via GitHub Actions.
