@y0hami/eslint-config
v0.6.4
Published
Shared ESLint flat configs.
Readme
@y0hami/eslint-config
Shared ESLint flat configs.
All presets include eslint-config-prettier to disable rules that conflict with
Prettier. Run Prettier separately to format files.
JavaScript and TypeScript filenames and their source directories must use kebab-case. Common generated output directories are ignored.
All presets include the recommended security rules. The TypeScript preset uses
typed linting and requires source files to be included by a tsconfig.json.
Base
import { defineConfig } from 'eslint/config'
import base from '@y0hami/eslint-config/base'
export default defineConfig(base)React
import { defineConfig } from 'eslint/config'
import react from '@y0hami/eslint-config/react'
export default defineConfig(react)TypeScript
Three entry points are published: ./typescript6 for projects on the
classic (TS6-compatible) compiler, ./typescript7 for projects building
with TypeScript 7, and ./typescript, an alias for whichever of the two is
current (./typescript7 today). Prefer ./typescript6 or ./typescript7
explicitly if you don't want the alias's target to change out from under
you in a future release.
The rulesets are identical — typescript-eslint's type-aware rules require
TypeScript's programmatic API, which TS7 doesn't ship until 7.1, so linting
still runs against a TS6-compatible typescript package either way. This
isn't specific to typescript-eslint: ts-jest, ts-morph, and framework
compilers (Vue, Angular, Svelte) all have the same peer dependency on the
classic API, so the fix has to work for all of them at once, not just
ESLint.
If your project builds with TypeScript 7, keep the typescript package
name aliased to Microsoft's TS6 compatibility package, and install TS7
itself under a separate name for the actual build step:
npm install -D typescript@npm:@typescript/typescript6 @typescript/native@npm:typescript@^7Every tool that does require('typescript') — ESLint included — keeps
working unchanged, while your build/typecheck scripts invoke TS7 explicitly
through @typescript/native's binary instead of the ambient typescript
one.
import { defineConfig } from 'eslint/config'
import typescript from '@y0hami/eslint-config/typescript'
export default defineConfig(typescript)For React with TypeScript, compose both configs:
import { defineConfig } from 'eslint/config'
import react from '@y0hami/eslint-config/react'
import typescript from '@y0hami/eslint-config/typescript6'
export default defineConfig(typescript, react)