Skip to content
Configs for linters and formatters used in DADI projects.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
eslint-config chore: update pkg version Jun 20, 2019
prettier-config remove jsxSingleQuotes from prettier config Jun 21, 2019
.editorconfig feat: update supporting files Jun 20, 2019
.eslintrc feat: add supporting files Jun 20, 2019
.gitignore chore: fix readme, add gitignore Jun 20, 2019
.prettierrc
README.md docs: fix readme Jun 27, 2019

README.md

DADI code standards

Configs for linters and formatters used in DADI projects.

Setting up

  1. Copy .editorconfig, .eslintrc and .prettierrc to the root of the repository

  2. Install the required dependencies

    npm i @dadi/eslint-config @dadi/prettier-config eslint husky lint-staged prettier --save-dev
    
  3. Add the following blocks to package.json:

    "husky": {
      "hooks": {
        "pre-commit": "lint-staged"
      }
    },
    "lint-staged": {
      "*.{js,jsx,md,html,css}": [
        "prettier --write",
        "git add"
      ]
    }
    
  4. Add the following to your test npm script:

    eslint --ext js,jsx . && prettier --check '**/*.{js,jsx,md,html,css}'
    
  5. If you want to reformat an existing repository, run:

    ./node_modules/.bin/eslint --fix --ext js,jsx . && ./node_modules/.bin/prettier --write '**/*.{js,jsx,md,html,css}'
    
You can’t perform that action at this time.