Socket
Socket
Sign inDemoInstall

@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.


Version published
Maintainers
2
Created
Source

Eslint config designed to work well for Adeira projects. It's especially powerful in combination with Flow and hermes-eslint.

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

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, however, 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.

It's recommended using hermes-eslint parser with this config (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: 'hermes-eslint',
  parserOptions: {
    sourceType: 'module',
  },

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

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 20 Sep 2023

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