Skip to content

devrsi0n/eslint-config-prettify

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

eslint-config-prettify

version MIT License code style: prettier lerna

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-base for ES2019 or Node project
  • eslint-config-prettify-react for React JavaScript project
  • eslint-config-prettify-ts-base for vanilla TypeScript project
  • eslint-config-prettify-ts-react for React TypeScript project

Quick start

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 prettier

Upgrade your ESLint config

// .eslintrc
{
  "root": true,
  "extends": ["eslint-config-prettify-base"]
}

Configuration

tsconfig path

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"
        ]
      },
  }
}

Development

This monorepo managed by lerna with yarn workspace.

Install dependencies

# Trigger 'lerna bootstrap'
yarn

Test

Unit tests write with jest

yarn test

Commit

Commit message lint by commitlint with config @commitlint/config-conventional, scope must be package's names.For example, fix(base): import module unsolved.

Publish

# Create package CHANGELOG.md, increase package.json version and git commit and tag
yarn run release
# Publish release version
yarn run publish

About

A set of pretty eslint configs with prettier include. Support for React/TypeScript/ES2019.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published