Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sky-uk/eslint-config-sky

Package Overview
Dependencies
Maintainers
19
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sky-uk/eslint-config-sky

ESLint config for JavaScript projects at Sky

  • 22.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
decreased by-3.6%
Maintainers
19
Weekly downloads
 
Created
Source

eslint-config-sky

CodeGazer Ownership Circle CI

ESLint config for Sky JavaScript projects. Aside from linting rules, this also enforces the use of ES6 either via Node or transpilation (probably via Babel).

Purpose

  • Provide strict eslint configuration
  • Codification of consistency and best practices
  • Increased stylistic consistency in JavaScript projects at Sky
  • Less time spent debating stylistic issues in code reviews
  • Perform error checking prior to execution

Prettier

  • This eslint config now relies on Prettier for many stylistic rules. See https://prettier.io/ for more information. You do not have to run Prettier separately as we run it through eslint-plugin-prettier.

Contributing

For information on the process of contributing to this library, please read the contributing guide.

Getting started

1. Install:

To install eslint-config-sky and all required peerDependencies at the correct versions:

npm info "@sky-uk/eslint-config-sky" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-exact --save-dev "@sky-uk/eslint-config-sky"

You may not need all the peer dependencies - for example you don't need eslint-plugin-react if you are not using React - so you may need to then remove some of the peer dependencies that have been automatically installed from your package.json.

When installing or updating the version of eslint-config-sky you should also make sure the versions of the other libraries are at a minimum the versions specific in the peer dependencies of this package.

You should always point to a specific version of eslint-config-sky as referencing the latest will break your CI when new rules are introduced.

2. Create or extend your .eslintrc:

{
  "extends": ["@sky-uk/eslint-config-sky"],
  "env": {
    "browser": true/false,
    "node": true/false
  }
}

See here for more environment options.

3. NPM scripts

It is recommended to create npm scripts to run your linting through. To do so, add the following to the scripts object in your package.json.

{
  "scripts": {
    "lint": "eslint .",
    "format": "npm run lint -- --fix"
  }
}

4. Automatically fix problems

You can use npm run format to automatically fix most errors.

If, after running format you still find you have a lot of linting issues you can set those rules to warn for the time being until you have time to work through them. You can do this by adding a rules section to your .eslintrc.

{
  "rules": {
    "import/no-named-as-default": "warn"
  }
}

5. Check linting in your CI

You can add the npm run lint command to your CI to make sure that no linting problems are introduced.

Extensions

If you use a specific library, then you can install the extension for it in addition to the base Sky config.

If you do not use these, you will get peer dependency warnings on npm install but they can be ignored.

react

Install:

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

Extend your .eslintrc:

{
  "extends": [
      ...
      "@sky-uk/eslint-config-sky/react"
  ]
}

mocha

Install:

npm install --save-dev eslint-plugin-mocha

Extend your .eslintrc:

{
  "extends": [
      ...
      "@sky-uk/eslint-config-sky/mocha"
  ]
}

Examples:

FAQs

Package last updated on 06 Apr 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc