@cuzom/eslint-config
v1.2.0
Published
ESLint flat config: recommended JavaScript and TypeScript rules, light typing, formatting left to Prettier.
Maintainers
Readme
@cuzom/eslint-config
Cuzom Oy's ESLint flat config: the recommended JavaScript and TypeScript rules, light typing, and formatting left to Prettier.
pnpm add -D eslint typescript @cuzom/eslint-configeslint.config.js:
import cuzom from '@cuzom/eslint-config'
export default [
...cuzom,
// project rules and ignores
]Light typing. Inference over annotations, no enums (a union of string literals instead), any
warns, @ts-expect-error needs a reason, and type-only imports are marked. Everything Prettier
handles is turned off through eslint-config-prettier.
Vue and Nuxt. Use Nuxt's own config and add the light-typing rules and Prettier last:
// @ts-check
import { lightTypes } from '@cuzom/eslint-config'
import prettierConfig from 'eslint-config-prettier'
import withNuxt from './.nuxt/eslint.config.mjs'
// The light-typing rules need the TypeScript parser, so they apply to TypeScript and Vue files only.
export default withNuxt({ files: ['**/*.{ts,vue}'], ...lightTypes }, prettierConfig)Without the files line the type-aware rules also run on plain .js and .mjs files, including
this config file, and ESLint stops with "You have used a rule which requires type information".
.nuxt/eslint.config.mjs is generated by Nuxt, so give the app "postinstall": "nuxt prepare" in
its package.json: eslint then works right after an install, with no typecheck run first.
Also exported: ignores (build output and tool folders).
Needs ESLint 10 and TypeScript 6; typescript-eslint does not support TypeScript 7 yet.
© Cuzom Oy. Apache-2.0. Source: cuzom-dev/dev-config.
