haydenull / fabric

haydenull's collection of configuration files containing prettier, eslint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@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
# on Linux or Mac
echo "npx haydenull-fabric verify-commit" >> .husky/commit-msg

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
# on Linux or Mac
echo "npx lint-staged" >> .husky/pre-commit

type check before commit

  1. in package.json
{
  "scripts": {
    "typecheck": "tsc --noEmit"
  }
}
  1. add git hooks
# on Linux or Mac
echo "npm run typecheck" >> .husky/pre-commit

spell check

Install Code Spell Checker Plugin for VSCode.

About

haydenull's collection of configuration files containing prettier, eslint

License:MIT License


Languages

Language:JavaScript 100.0%