A shareable ESLint 9 flat config for TypeScript projects with opinionated rules for code quality and consistency.
- ✨ ESLint 9 flat config format
- 🔧 TypeScript support with typescript-eslint
- 📦 Import/export linting with eslint-plugin-import
- 🤝 Promise best practices with eslint-plugin-promise
- 💅 Prettier integration for code formatting
- 📋 Organized import ordering rules
npm install --save-dev @linkurious/eslint-config-ogma eslint typescriptCreate an eslint.config.js file in your project root:
import ogmaConfig from "@linkurious/eslint-config-ogma";
export default ogmaConfig;import ogmaConfig from "@linkurious/eslint-config-ogma";
export default [
...ogmaConfig,
{
// Your custom rules
rules: {
"no-console": "warn", // Override the default 'error'
// Add your project-specific rules here
},
},
];import ogmaConfig from "@linkurious/eslint-config-ogma";
export default [
...ogmaConfig,
{
files: ["**/*.test.ts", "**/*.spec.ts"],
rules: {
"no-console": "off", // Allow console in tests
},
},
];import ogmaConfig from "@linkurious/eslint-config-ogma";
export default [
...ogmaConfig,
{
ignores: ["dist/**", "build/**", "node_modules/**", "**/*.d.ts"],
},
];Add these scripts to your package.json:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}This config includes:
- Base configs: ESLint recommended + TypeScript recommended
- Import linting: Organized imports with alphabetical sorting
- Promise linting: Best practices for Promise usage
- TypeScript support: Full TypeScript parsing and linting
- Prettier integration: Automatic formatting conflict resolution
no-console: Error (use proper logging instead)@typescript-eslint/ban-ts-comment: Warning@typescript-eslint/no-non-null-assertion: Off (allows!assertions)import/order: Enforces organized import grouping and alphabetical sorting
- ESLint 9.x
- TypeScript 4.x or 5.x
- Node.js 16+ (required by ESLint 9)
If you're upgrading from v1.x (ESLint 8), you'll need to:
- Update to ESLint 9:
npm install --save-dev eslint@^9.0.0 - Convert your
.eslintrc.*toeslint.config.js(flat config format) - Update your config import as shown in the usage examples above
Apache-2.0 © Linkurious SAS