Get started by running this command in the root of your project (
npm is also supported):
yarn add eslint eslint-config-nrk --dev
Then add an
.eslintrc.json file to the root of your project (see Documentation below) before running the
eslint command, with the following:
eslint plugins are available for most modern text editors, like Atom, emacs, vim, Sublime Text, etc.
eslint is configured by adding an
.eslintrc.json file to the root of a project where
extends are specified. Refer to the
eslint documentation for more configuration options.
The following example shows a typical setup for linting both browser and Node.js (CommonJS) code:
For supporting React projects, also add the
yarn add eslint-plugin-react --dev
For supporting JSX, also add the
It is necessary to configure
eslint to lint files matching the
eslint . --ext=.js,.jsx
Please note that the
nrk/rules/jsx configuration is always using the latest version of React. When using an older version, please refer to the
Legacy ES5 projects
This configuration is available as a way of migrating to a more modern codebase (recommended).