Shareable ESLint (2.0.0+) configuration package for Konnektid code style guides.
Working with Babel (ES7) and/or React (JSX) requires you to install a couple of extra dependencies:
npm install --save-dev babel-eslint eslint-plugin-babel eslint-plugin-react
In your .eslintrc
file, add
{ "extends": "konnektid" }
to load the basic configuration. For frontend code, use:
{ "extends": "konnektid/frontend" }
This enables the use of JSX and switches to the browser environment.
We offer a couple of variations on the basic configuration that you can extend from:
Preset | Description | ECMA Features | Environment |
---|---|---|---|
konnektid |
Basic configuration for Node 5.0.0 projects. | ES6 | Node |
konnektid/tool |
Relaxes some rules for development scripts/tooling. | ES6 | Node |
konnektid/babel |
Use for code that transpiles with Babel (stage 2). | Babel | Node |
konnektid/module 2, 5 |
Use for ES6 Modules (export/import syntax). | Babel + Modules | Node |
konnektid/react 1, 2 |
Use for React components with JSX syntax. | Babel + JSX | Node |
konnektid/frontend 1, 2 |
Use for frontend code with React components. | Babel + JSX | Browser (Webpack3) |
konnektid/universal 2, 4 |
Use for code shared between Node and browser. | Babel | Universal (Webpack3) |
konnektid/test 5 |
Add to the unit tests folder. | ES6 | Mocha |
- [1] Note that both the
react
andfrontend
configuration requireeslint-plugin-react
to be installed. - [2] Working with ES7 (Babel) code requires
babel-eslint
andeslint-plugin-babel
to be installed. - [3] This allows the use of RequireJS style modules.
- [4] The
universal
preset only allows code that works in both NodeJS and the browser. When including environment-specific (conditional) code, make sure to explicitly define the environment of that code as eithernode
orbrowser
. - [5] The
test
andmodule
preset should be combined with the basekonnektid
orfrontend
preset.
Happy coding!