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

@adeira/eslint-config

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adeira/eslint-config

Eslint configuration describing rules for JS used at Adeira.

  • 7.5.0
  • npm
  • Socket score

Version published
Weekly downloads
81
increased by523.08%
Maintainers
2
Weekly downloads
 
Created
Source

Purpose of this package is to share common eslint configuration among other JS projects. It should not be annoying but rather helpful when you understand "why" of each rule (please give us feedback if you disagree with some rules).

Usage

Before you start you should remove all Eslint plugins and Prettier from your package.json files. This package takes care of all the plugins that are necessary. You should install additional plugins only when you need to add some extra rules. It's a good idea to contribute these rules back to this package so everyone can benefit from it.

Install this package (as well as Eslint):

yarn add eslint @adeira/eslint-config --dev [--ignore-workspace-root-check]

And use it in your .eslintrc.js:

module.exports = {
  root: true,
  extends: [
    '@adeira/eslint-config',

    // - OR -
    // '@adeira/eslint-config/strict',
  ],
};

Strict version of the config turns some warnings into errors. We use warnings as a migration strategy for the future breaking release but you can make the config more strict even today (so your CI will fail). Not all warnings are turned into errors - only the ones considered to be errors in the future version. Please be aware that strict mode is like living on the edge: minor upgrade can break your CI (while others will get only warnings). You will be ready for the future major version though.

You can also set your eslint as needed with @babel/eslint-parser parser for example (you need to install it separately):

const OFF = 0;
const WARN = 1;
const ERROR = 2;

module.exports = {
  root: true,

  extends: ['@adeira/eslint-config/strict'],

  parser: '@babel/eslint-parser',
  parserOptions: {
    sourceType: 'module',
    ecmaVersion: 2021,
    ecmaFeatures: {
      jsx: false,
    },
  },

  env: {
    es6: true,
    jest: true,
    node: true,
  },
};

It is important to report any issues with the eslint configuration back so we can improve it for everyone. These rules should be related only to how we write JS code so it's perfectly fine if you have some additional rules closely related to your project (no-restricted-imports for example).

Also please note that you should not ignore Eslint warnings! These warnings are helping you to migrate to the future major version. Some of them will turn into errors in the next major version bump.

Config subsets

The standard config contains a large number of rules, which may not always work for specific projects. There is no need to use the full package only, smaller configs are also available:

  • @adeira/eslint-config/base - only the basic and most important JavaScript rules
  • @adeira/eslint-config/fbt¹ - FBT related rules
  • @adeira/eslint-config/flowtype - Flow related rules
  • @adeira/eslint-config/jest - Jest related rules
  • @adeira/eslint-config/next¹ - Next.js related rules
  • @adeira/eslint-config/react - React related rules (React, RN, Hooks, accessibility)
  • @adeira/eslint-config/relay - Relay related rules
¹ subset not included in the default `@adeira/eslint-config` or `@adeira/eslint-config/strict`

Use them in your .eslintrc.js:

module.exports = {
  root: true,
  extends: [
    '@adeira/eslint-config/base',
    '@adeira/eslint-config/react',
    '@adeira/eslint-config/jest',
  ],
};

Alternatively, you can extend the default preset with additional optional rules:

module.exports = {
  extends: [
    '@adeira/eslint-config',
    '@adeira/eslint-config/next', // optional Next.js rules not included by default
  ],

  // The following settings might be needed in case you are trying to apply Next.js preset inside
  // monorepo subdirectory, see: https://nextjs.org/docs/basic-features/eslint#rootdir
  settings: {
    next: { rootDir: __dirname },
  },
};

Prior art

FAQs

Package last updated on 14 Apr 2022

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