1.0.6 โ€ข Published 6 months ago

@billoneta/config v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

๐Ÿ“ฆ @billoneta/config

๐Ÿ’พ Installation

# Using npm
npm install -D @billoneta/config
# Using yarn
yarn add -D @billoneta/config
# Using pnpm
pnpm add -D @billoneta/config

๐Ÿ›  How to use?


๐Ÿ“… changelog-config

!NOTE A brief explanation of its use and the most recommended one.

You need to create a changelog file first, changelog.config.ts or .changelogrc.js

!WARNING These are the only files supported at the moment

1. Default config

// changelog.config.js or .changelogrc.js

// @ts-check
import defineConfig from '@billoneta/config/changelog-config';

/** @type {import("@billoneta/config/changelog-config").Config} */
export default defineConfig();

2. Custom config

!IMPORTANT ๐Ÿ”ฉ If you have no idea of the config

KeyType
customCommitTypeMapobject
customScopeMapobject
displayCommitTypesarray
displayScopesarray
showAuthorboolean
showAuthorAvatarboolean
showSummaryboolean
withEmojiboolean
reduceHeadingLevelboolean
newlineTimestampboolean
addBackToTopboolean
// changelog.config.js or .changelogrc.js

// @ts-check
import defineConfig from '@billoneta/config/changelog-config';

/** @type {import("@billoneta/config/changelog-config").Config} */
export default defineConfig({
 showAuthor: true,
 showAuthorAvatar: true,
 showSummary: true,
 withEmoji: true,
 reduceHeadingLevel: true,
 newlineTimestamp: true,
 addBackToTop: true,
});

๐Ÿ“จ commitlint-config

!NOTE A brief explanation of its use and the most recommended one.

You need to create a commitlint file first, files config

!IMPORTANT For best preference, I recommend using commitlint.config.js or .commitlint.js

// commitlint.config.js or .commitlint.js

// @ts-check
import commitlintConfig from '@billoneta/config/commitlint-config';

/** @type {import('@commitlint/types').UserConfig} */
export default commitlintConfig;

๐Ÿ”ฎ eslint-config

!NOTE A brief explanation of its use and the most recommended one.

You need to create a eslint file first, files config

!IMPORTANT For best preference, I recommend using eslint.config.ts or eslint.config.js

๐Ÿงฑ Base setup

Kick things off with a solid foundation: essential ESLint rules + Prettier support baked in.

// eslint.config.ts

import eslintConfig from '@billoneta/config/eslint-config';
import { defineConfig } from 'eslint/config';

export default defineConfig([eslintConfig.base]);

โšก Using it with Next.js

Tailored for Next.js projects โ€” includes all the recommended rules so you don't have to guess.

// eslint.config.ts

import eslintConfig from '@billoneta/config/eslint-config';
import { defineConfig } from 'eslint/config';

export default defineConfig([eslintConfig.next]);

๐Ÿ–ฅ๏ธ For Node.js

Config designed to keep your Node.js code clean and consistent.

// eslint.config.ts

import eslintConfig from '@billoneta/config/eslint-config';
import { defineConfig } from 'eslint/config';

export default defineConfig([eslintConfig.node]);

๐Ÿงน Prettier integration

Make sure your formatting rules play nice with your linter.

โš  Make sure to place this configuration last in your setup to avoid conflicts or unexpected behavior.

// eslint.config.ts

import eslintConfig from '@billoneta/config/eslint-config';
import { defineConfig } from 'eslint/config';

export default defineConfig([
 // ...Other config
 eslintConfig.prettier,
]);

โš›๏ธ For React

Set up linting rules specifically for React apps and components.

// eslint.config.ts

import eslintConfig from '@billoneta/config/eslint-config';
import { defineConfig } from 'eslint/config';

export default defineConfig([eslintConfig.react]);

๐Ÿš€ Turbo + Monorepos

Optimized setup for monorepo structures using Turbo โ€“ includes parser and smart rules.

// eslint.config.ts

import eslintConfig from '@billoneta/config/eslint-config';
import { defineConfig } from 'eslint/config';

export default defineConfig([eslintConfig.turbo]);

๐Ÿง  TypeScript

Config for TypeScript support, including parser and strict rules tailored for typed projects.

// eslint.config.ts

import eslintConfig from '@billoneta/config/eslint-config';
import { defineConfig } from 'eslint/config';

export default defineConfig([eslintConfig.typescript]);

๐Ÿ”— Combining multiple setups

Need to mix configurations? No problem. Just stack them:

// eslint.config.ts

import eslintConfig from '@billoneta/config/eslint-config';
import { defineConfig } from 'eslint/config';

export default defineConfig([eslintConfig.base, eslintConfig.typescript, eslintConfig.react]);

!NOTE This section of the module is a fork of IgorKowalczyk/eslint-config, with additional improvements and custom tweaks.

โœจ Full credit to him


๐Ÿˆน lefthook-config

!NOTE A brief explanation of its use and the most recommended one.

You need to create a lefthook file first, files config

!IMPORTANT For best preference, I recommend using lefthook.json or .lefthook.json

// lefthook.json

{
 "$schema": "https://json.schemastore.org/lefthook.json",
 "extends": ["node_modules/@billoneta/config/dist/lefthook-config/base.json"]
}

๐Ÿ…ฟ prettier-config

!NOTE A brief explanation of its use and the most recommended one.

You need to create a prettier file first, files config

!IMPORTANT For best preference, I recommend using prettier.config.js or .prettierrc.js

// prettier.config.js or .prettierrc.js

// @ts-check
import prettierConfig from '@billoneta/config/prettier-config';

/** @type {import("prettier").Options} */
export default prettierConfig;

๐Ÿ”„ release-config

!NOTE A brief explanation of its use and the most recommended one.

You need to create a semantic release file first, files config

!IMPORTANT For best preference, I recommend using release.config.js or .releaserc.js

1. Default config

// release.config.js or .releaserc.js

// @ts-check
import defineConfig from '@billoneta/config/release-config';

/** @type {import('@billoneta/config/release-config').ReleaseConfigOptions} */
export default defineConfig();

2. Custom config

Define your custom config following the Semantic Release Options

!IMPORTANT ๐Ÿ”ฉ How to configure default and customizable plugins

PluginTypeDoc
commitAnalyzerobjectView Commit Analyzer Docs
execobjectView Exec Docs
releaseNotesGeneratorobjectView Release Notes Generator Docs
changelogobjectView Changelog Docs
npmobjectView NPM Docs
gitobjectView GIT Docs
githubobjectView Github Docs

!NOTE If you want to add a custom plugin, you can do it by adding the key plugin inside the array you can add as many as you need.

// release.config.js or .releaserc.js

// @ts-check
import defineConfig from '@billoneta/config/release-config';

/** @type {import('@billoneta/config/release-config').ReleaseConfigOptions} */
export default defineConfig({
 branches: [
  'next',
  {
   name: 'next',
   channel: 'next',
   prerelease: true,
  },
 ],
 plugin: [],
 // Default and customizable plugins
 commitAnalyzer: {
  releaseRules: [
   { breaking: true, release: 'major' },
   { type: 'feat', release: 'minor' },
   { type: 'feat', scope: 'int-*', release: false },
   { type: 'fix', release: 'patch' },
  ],
 },
 npm: {
  npmPublish: true,
  tarballDir: './path/to/you/dir',
  pkgRoot: './path/to/you/root',
 },
});

โ™ป๏ธ renovate-config

!NOTE A brief explanation of its use and the most recommended one.

You need to create a renovate file first, files config

!IMPORTANT For best preference, I recommend using renovate.json or renovate.json5

// .github/renovate.json

{
 "$schema": "https://docs.renovatebot.com/renovate-schema.json",
 "extends": ["github>billoneta/kitsune//packages/config/src/renovate-config/base.json"]
}