cognitedata / eslint-config-cognite

[MOVED to the "applications" repository] Cognite eslint config e.g JS/ES styleguide
1 stars 1 forks source link

Eslint config

This provides styleguide for JS/ES through eslint rules and prettier formatter.

Setup

Install lint config:

yarn add --dev @cognite/eslint-config

Install peer dependencies:

yarn add --dev babel-eslint eslint eslint-config-airbnb eslint-config-prettier eslint-plugin-import eslint-plugin-jest eslint-plugin-jsx-a11y eslint-plugin-prettier eslint-plugin-react prettier

Create a .eslintrc.json file in the root of your project:

{
  "extends": ["@cognite"]
}

Rules:

We use Airbnb as a base for our styleguide, and we use prettier as a formatter. This means that we extend the prettier config and eslint --fix will use prettier to format your code.

We also extend the recommended rules for Jest tests.

Exceptions to the standard prettier config is singlequotes and dangling commas.

Babel parser is used to eslint to parse experimental ES syntax.