Coder Social home page Coder Social logo

devrsi0n / eslint-config-prettify Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 0.0 873 KB

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

License: MIT License

JavaScript 100.00%
eslint-configs eslint-config react typescript

eslint-config-prettify's Introduction

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

eslint-config-prettify's People

Contributors

dependabot[bot] avatar devrsi0n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.