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-reactIn 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/module2, 5 |
Use for ES6 Modules (export/import syntax). | Babel + Modules | Node |
konnektid/react1, 2 |
Use for React components with JSX syntax. | Babel + JSX | Node |
konnektid/frontend1, 2 |
Use for frontend code with React components. | Babel + JSX | Browser (Webpack3) |
konnektid/universal2, 4 |
Use for code shared between Node and browser. | Babel | Universal (Webpack3) |
konnektid/test5 |
Add to the unit tests folder. | ES6 | Mocha |
- [1] Note that both the
reactandfrontendconfiguration requireeslint-plugin-reactto be installed. - [2] Working with ES7 (Babel) code requires
babel-eslintandeslint-plugin-babelto be installed. - [3] This allows the use of RequireJS style modules.
- [4] The
universalpreset 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 eithernodeorbrowser. - [5] The
testandmodulepreset should be combined with the basekonnektidorfrontendpreset.
Happy coding!