A set of prettify eslint configs with prettier and Airbnb rules include. Support for React/TypeScript/ES2019/Node.
This repo container 4 npm packages.
eslint-config-prettify-basefor ES2019 or Node projecteslint-config-prettify-reactfor React JavaScript projecteslint-config-prettify-ts-basefor vanilla TypeScript projecteslint-config-prettify-ts-reactfor React TypeScript project
Chose proper config 👆, and install dependencies. For example, eslint-config-prettify-base:
# Just those two dependencies, no need for extra parser, plugins or configs
yarn add --dev eslint eslint-config-prettify-base prettier
# Or using npm if you prefer
npm install --save-dev eslint eslint-config-prettify-base prettierUpgrade your ESLint config
// .eslintrc
{
  "root": true,
  "extends": ["eslint-config-prettify-base"]
}eslint-config-prettify-ts-react and eslint-config-prettify-ts-base using command executing directory to detect tsconfig.json(for TypeScript path alias), try below configuration if you meet Unable to resolve path to module ‘xxx’ error.
{
  "extends": ["eslint-config-prettify-base"],
  "settings": {
    "import/parsers": {
      "@typescript-eslint/parser": [".ts", ".tsx"]
    },
    "import/resolver": {
      // use <root>/tsconfig.json
      "typescript": {
        // always try to resolve types under `<root/>@types` directory even it doesn't contain any source code, like `@types/unist`
        "alwaysTryTypes": true,
        // use <root>/path/to/folder/tsconfig.json
        "directory": "./path/to/folder"
      },
      // Multiple tsconfigs (Useful for monorepos)
      // use a glob pattern
      "typescript": {
        "directory": "./packages/*/tsconfig.json"
      },
      // use an array
      "typescript": {
        "directory": [
          "./packages/module-a/tsconfig.json",
          "./packages/module-b/tsconfig.json"
        ]
      },
  }
}This monorepo managed by lerna with yarn workspace.
# Trigger 'lerna bootstrap'
yarnUnit tests write with jest
yarn testCommit message lint by commitlint with config @commitlint/config-conventional, scope must be package's names.For example, fix(base): import module unsolved.
# Create package CHANGELOG.md, increase package.json version and git commit and tag
yarn run release
# Publish release version
yarn run publish