@cl3tus/config
@cl3tus/config
Shared configuration files for ESLint, Prettier, TypeScript, and Commitlint for Node.js, Next.js, and React projects.
Installation
npm install --save-dev @cl3tus/config
Peer Dependencies
This package requires the following peer dependencies:
npm install --save-dev eslint prettier typescript @commitlint/cli @trivago/prettier-plugin-sort-imports prettier-plugin-tailwindcss prettier-plugin-classnames
Usage
ESLint
Two configurations are available depending on your project type.
For Node.js / Vite projects
Create an eslint.config.js file in your project root:
import eslintConfig from "@cl3tus/config/eslint/node";
export default eslintConfig;
Features:
- TypeScript support with typescript-eslint
- Unused imports detection and removal
- Consistent type imports (inline
import type) - Smart unused variables detection with
_prefix ignore pattern - Enforce
typeoverinterface(consistent-type-definitions) - Require braces on all control statements (
curly) - Blank lines around
ifblocks (@stylistic/padding-line-between-statements)
For Next.js projects
Create an eslint.config.js file in your project root:
import eslintConfig from "@cl3tus/config/eslint/nextjs";
export default eslintConfig;
Features:
- All Node.js features above
- Next.js core-web-vitals and TypeScript configs
- React-specific rules
Extending the config
You can extend either config with your own rules:
import eslintConfig from "@cl3tus/config/eslint/node"; // or /nextjs
export default [
...eslintConfig,
{
rules: {
// Your custom rules
},
},
];
Prettier
Create a prettier.config.mjs file in your project root:
export { default } from '@cl3tus/config/prettier';
Or extend the config:
import baseConfig from '@cl3tus/config/prettier';
export default {
...baseConfig,
// Your custom options
};
Features:
- Tailwind CSS class sorting
- Import statement sorting (React/Next first, then third-party, then local)
- Classnames plugin support
- 2-space indentation, 100 character line width
Biome
An all-in-one alternative to ESLint + Prettier. Create a biome.json file in your project root:
{
"extends": ["@cl3tus/config/biome"]
}
Or override specific options:
{
"extends": ["@cl3tus/config/biome"],
"files": {
"includes": ["**", "!**/generated/**"]
}
}
Features:
- Formatter: 2-space indentation, 100 character line width, single quotes, trailing commas, semicolons
- Same conventions as the ESLint config:
typeoverinterface, braces on all control statements, inlineimport type, noconsole.log(onlywarn/error/info) - Unused variable/import detection (respects
_prefix) - Tailwind CSS class sorting (
cn,cva,clsx,tw) and CSS Modules / Tailwind directives parsing - Import organization with grouped ordering (node/bun, packages, aliases, relative paths)
- Relaxed a11y rules under
components/**
Note: the blank-line-around-
ifconvention has no Biome equivalent and is only enforced by the ESLint config.
TypeScript
Extend the configuration in your tsconfig.json:
{
"extends": "@cl3tus/config/tsconfig",
"compilerOptions": {
// Your custom options
}
}
Features:
- Optimized for Next.js projects
- Path aliases support (
@/*) - Strict mode enabled
- Modern ES2017 target
Commitlint
Create a commitlint.config.js file in your project root:
module.exports = {
extends: ["@cl3tus/config/commitlint"],
};
Features:
- Conventional commits format
- Extended body max line length (400 characters)
Complete Setup Examples
For a Node.js / Vite project
# Install the config package and peer dependencies
npm install --save-dev @cl3tus/config eslint prettier typescript @commitlint/cli @trivago/prettier-plugin-sort-imports prettier-plugin-tailwindcss prettier-plugin-classnames husky
# Initialize husky (optional, for git hooks)
npx husky init
eslint.config.js:
import eslintConfig from "@cl3tus/config/eslint/node";
export default eslintConfig;
prettier.config.mjs:
export { default } from '@cl3tus/config/prettier';
tsconfig.json:
{
"extends": "@cl3tus/config/tsconfig"
}
commitlint.config.js:
module.exports = {
extends: ["@cl3tus/config/commitlint"],
};
For a Next.js project
# Install the config package and peer dependencies
npm install --save-dev @cl3tus/config eslint prettier typescript @commitlint/cli @trivago/prettier-plugin-sort-imports prettier-plugin-tailwindcss prettier-plugin-classnames husky
# Initialize husky (optional, for git hooks)
npx husky init
eslint.config.js:
import eslintConfig from "@cl3tus/config/eslint/nextjs";
export default eslintConfig;
prettier.config.mjs:
export { default } from '@cl3tus/config/prettier';
tsconfig.json:
{
"extends": "@cl3tus/config/tsconfig"
}
commitlint.config.js:
module.exports = {
extends: ["@cl3tus/config/commitlint"],
};
package.json scripts:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write .",
"format:check": "prettier --check ."
}
}
What's Included
ESLint Plugins & Configs
Node.js config:
@eslint/js(recommended rules)typescript-eslint(TypeScript support)eslint-plugin-unused-imports@stylistic/eslint-plugin(stylistic rules)
Next.js config:
- All Node.js plugins above
eslint-config-next(core-web-vitals + TypeScript)@eslint/eslintrc(for compatibility)
Prettier Plugins
@trivago/prettier-plugin-sort-importsprettier-plugin-tailwindcssprettier-plugin-classnames
Biome Config
@biomejs/biome(optional peer dependency — only needed if you use the Biome config instead of ESLint + Prettier)
Commitlint Config
@commitlint/config-conventional
Development & Deployment
Automatic Release (Forgejo Actions)
Releases are fully automated with semantic-release.
On every push to main, the workflow analyzes the commit messages, bumps the
version, updates CHANGELOG.md, publishes to npm, pushes the release commit
and tag back to the repository, and sends a Discord notification.
Setup
Create an npm access token:
- Go to https://www.npmjs.com/settings/YOUR_USERNAME/tokens
- Create a new "Automation" token
Add secrets to Forgejo:
- Go to Settings > Actions > Secrets in your Forgejo repository
- Add
NPM_TOKENwith your npm token - Add
CI_TOKENwith a Forgejo access token (repository write permissions) - Add
DISCORD_WEBHOOKwith a Discord channel webhook URL (release notifications)
Push to main branch:
git push origin mainThe
releaseworkflow runs automatically — no manual trigger needed.
Commit Message Convention
The version bump is determined automatically from your conventional commits:
# Patch (1.0.0 -> 1.0.1)
git commit -m "fix: correct typo in README"
# Minor (1.0.0 -> 1.1.0)
git commit -m "feat: add new eslint rule"
# Major (1.0.0 -> 2.0.0)
git commit -m "feat: redesign config structure
BREAKING CHANGE: config imports have changed"
License
MIT