@openagenda/eslint-config

1.4.0 • Public • Published

@openagenda/eslint-config

ESLint

Add dependencies

yarn add -D eslint @openagenda/eslint-config

Create .eslintrc and .eslintignore

.eslintrc:

{
  "extends": "@openagenda",

  "parserOptions": {
    "sourceType": "script"
  },

  "rules": {
    "import/no-extraneous-dependencies": [
      "error",
      {
        "devDependencies": [
          "seeds/**/*.js",
          "test/**/*.js",
          "testconfig.sample.js",
          "testconfig.js"
        ]
      }
    ]
  }
}

.eslintignore:

!.*
node_modules/

dist/

The first line are useful for does not ignore the dotfiles (.storybook, .babelrc, ...)

Add lint script to package.json

{
  "scripts": {
    "lint": "eslint -c .eslintrc '**/*.js'"
  }
}

And run yarn lint.

Prettier

Add dependencies

yarn add -D prettier-eslint-cli

Add prettier script to package.json

{
  "scripts": {
    "prettier": "prettier-eslint --write '**/*.js'"
  }
}

And run yarn prettier.

Lint-staged

Add dependencies

yarn add -D lint-staged

Add lint-staged script and config to package.json

{
  "scripts": {
    "lint-staged": "lint-staged"
  },
  "lint-staged": {
    "**/*.js": [
      "prettier-eslint --write",
      "eslint -c .eslintrc",
      "git add"
    ]
  }
}

And run yarn lint-staged.

Readme

Keywords

none

Package Sidebar

Install

npm i @openagenda/eslint-config

Weekly Downloads

0

Version

1.4.0

License

MIT

Unpacked Size

12.8 kB

Total Files

6

Last publish

Collaborators

  • bertho-zero
  • gaetanlatouche