@coderize/config
ESLint and Prettier config shared by the CoderizeDEV repos. One dependency replaces the plugins each repo used to carry, and one place to change the rules replaces 44 hand-edited copies.
pnpm add -D @coderize/config eslint prettier
Prettier
.prettierrc.json is one line:
"@coderize/config/prettier"
Two-space indent, single quotes, no semicolons, no trailing commas, 120 columns, LF. The Astro and Tailwind plugins are included and resolved from this package, so the repo does not install them.
ESLint
eslint.config.js spreads the config that matches the package:
import { astro } from '@coderize/config/eslint'
export default [...astro]
| Export | For | Globals |
|---|---|---|
astro | Astro sites: .astro, .js, .mjs | browser; Node for config files, scripts/, tests |
react | Vite + React apps, React islands | browser and Node |
node | Fastify APIs, Lambdas, tooling | Node |
An Astro site with React islands uses both: export default [...astro, ...react].
Every config ignores dist, .astro, .turbo and infra/cloudfront* (CloudFront functions run in a
restricted runtime that house style does not apply to). Every config lets _-prefixed variables,
arguments and caught errors go unused.
Astro <script> blocks and TypeScript
astro lints frontmatter, markup and every <script> block. eslint-plugin-astro hands each script block to ESLint as a
virtual file: Page.astro/1_1.js, or Page.astro/1_1.ts once it can resolve @typescript-eslint/parser or
typescript-eslint from the directory ESLint runs in. Both are covered.
If a package's .astro files hold TypeScript (interface Props, el as HTMLElement), install the parser itself,
with TypeScript held below 6.1, the newest version typescript-eslint supports:
pnpm add -D @typescript-eslint/parser typescript@~6.0.3
Install @typescript-eslint/parser, not only typescript-eslint. eslint-plugin-astro also uses that package to read
define:vars. Without it, shorthand keys (define:vars={{ gtmId }}) are reported as no-undef; longhand keys
(define:vars={{ gtmId: gtmId }}) avoid that.
The parser is picked up when ESLint runs in the package directory, as pnpm lint and turbo do. For an editor or a
run from a monorepo root, wire it after the spread:
import tsParser from '@typescript-eslint/parser'
import { astro } from '@coderize/config/eslint'
export default [
...astro,
{
files: ['**/*.astro'],
processor: 'astro/client-side-ts',
languageOptions: { parserOptions: { parser: tsParser, extraFileExtensions: ['.astro'] } }
},
{ files: ['**/*.astro/*.ts'], languageOptions: { parser: tsParser } }
]
Repo-specific rules
Add them after the spread. Flat config applies later blocks last, so they win:
import { astro, globals } from '@coderize/config/eslint'
export default [
...astro,
// src/lib/site.js reads SITE_URL at build time
{ files: ['src/lib/site.js'], languageOptions: { globals: globals.node } }
]
Keep these for genuine one-offs. A rule that two repos want belongs in this package.
Versions
Semver from what a consuming repo feels: a patch changes nothing it can see, a minor relaxes a rule or adds an export, and a major can turn its CI red (a new error-level rule, a removed export). Renovate merges minors and patches by itself and holds majors for review.
Every release is staged on npm and goes live only once a maintainer approves it with 2FA, because Renovate carries it into every fleet repo.