Recipe
ESLint Config
Ship a shareable ESLint configuration that enforces Meridian's code style across every project in your org.
Overview
This recipe walks through scaffolding a standalone npm package that exports a flat ESLint config. It layers TypeScript-ESLint, import sorting, and a curated rule set tuned for Next.js and Node.js backends. The result is a single @your-org/eslint-config dependency.
Package Structure
eslint-config/ ├── index.js ├── package.json └── README.md
Core Config
The entry point merges three presets into a single flat config array. Consumers just reference the package name in their own eslint.config.js.
import tseslint from 'typescript-eslint'
import imports from 'eslint-plugin-import-x'
export default tseslint.config(
tseslint.configs.recommended,
{
plugins: { import: imports },
rules: {
'import/order': ['error', {
'newlines-between': 'always',
alphabetize: { order: 'asc' }
}],
'@typescript-eslint/no-unused-vars': 'error',
'no-console': 'warn'
}
}
)Next Steps
- Publish the package to your private npm registry.
- Add a
.eslintrc.jsonpreset for legacy projects. - Wire a pre-commit hook that runs
eslint --fix.