Skip to content

haydenull's collection of configuration files containing prettier, eslint

License

Notifications You must be signed in to change notification settings

haydenull/fabric

Repository files navigation

@haydenull/fabric

A collection of configuration files containing prettier, eslint, tsconfig and more

Usage

Install the package

pnpm add @haydenull/fabric -D

ESLint eslint-config

in .eslintrc.cjs

module.exports = {
  extends: [require.resolve('@haydenull/fabric/eslint/react')],
}

Prettier prettier

in prettier.config.cjs

module.exports = {
  ...require("@haydenull/fabric/prettier"),
  // docs: https://github.com/tailwindlabs/prettier-plugin-tailwindcss#sorting-classes-in-function-calls
  tailwindConfig: '.your-path/tailwind.config.js',
  tailwindFunctions: [], // ['cn', 'clsx']
}

Git verify commit

  1. install husky
  2. add commit-msg hook
npx husky add .husky/commit-msg 'npx haydenull-fabric verify-commit'

TypeScript tsconfig

in tsconfig.json

{
  "extends": "@haydenull/fabric/tsconfig/tsconfig.json",
}
  1. global install
npm install -g czg

2.in cz.config.js

/** @type {import('czg').CommitizenGitOptions} */
module.exports = {
  ...require('@haydenull/fabric/cz'),
  scopes: [/** your scopes */],
}

Recommended

Use lint-staged

  1. Install
pnpm add -D lint-staged
  1. in package.json
{
  "lint-staged": {
    "**/*.{js,jsx,ts,tsx}": [
      "npx prettier --write",
      "npx eslint --fix"
    ]
  }
}
  1. add git hooks
npx husky add .husky/pre-commit 'npx lint-staged'

type check before commit

  1. in package.json
{
  "scripts": {
    "typecheck": "tsc --noEmit"
  }
}
  1. add git hooks
npx husky add .husky/pre-commit 'npm run typecheck'

spell check

Install Code Spell Checker Plugin for VSCode.

About

haydenull's collection of configuration files containing prettier, eslint

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published