Socket
Socket
Sign inDemoInstall

eslint-config-nrk

Package Overview
Dependencies
152
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-config-nrk

A shared ESLint configuration for and by JavaScript developers at NRK.


Version published
Maintainers
1
Install size
33.1 kB
Created

Readme

Source

eslint-config-nrk Build Status Coverage Status npm version

A shared ESLint configuration for and by JavaScript developers at NRK.

Installation

Get started by running this command in the root of your project:

npm install --save-dev eslint eslint-config-nrk

Then add an .eslintrc.json file to the root of your project (see Documentation below) before running the eslint command, with the following:

{
  "extends": [
    "nrk"
  ]
}

NOTE: eslint plugins are available for most modern text editors, like Atom, emacs, vim, Sublime Text, etc.

Documentation

Basic configuration

eslint is configured by adding an .eslintrc.json file to the root of a project where env and 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:

{
  "env": {
    "browser": true,
    "node": true
  },
  "extends": [
    "nrk"
  ]
}

React configuration

For supporting React projects, also add the nrk/rules/react extension:

{
  "env": {
    "browser": true,
    "node": true
  },
  "extends": [
    "nrk",
    "nrk/rules/react"
  ]
}

Then install eslint-plugin-react:

npm install --save-dev eslint-plugin-react
JSX

For supporting JSX, also add the nrk/rules/jsx extension:

{
  "env": {
    "browser": true,
    "node": true
  },
  "extends": [
    "nrk",
    "nrk/rules/react",
    "nrk/rules/jsx"
  ]
}

It is necessary to configure eslint to lint files matching the .jsx extension:

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 eslint-plugin-react documentation.

Legacy ES5 projects

This configuration is available as a way of migrating to a more modern codebase (recommended).

{
  "env": {
    "browser": true,
    "node": true
  },
  "extends": [
    "nrk/es5"
  ]
}

FAQs

Last updated on 02 Sep 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc