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

@metamask/eslint-config

Package Overview
Dependencies
Maintainers
5
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/eslint-config

Shareable MetaMask ESLint config

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.8K
decreased by-16.51%
Maintainers
5
Weekly downloads
 
Created
Source

@metamask/eslint-config

This package provides MetaMask's ESLint configuration as an extensible shared config.

Usage

We export four ESLint configurations.

Base config

Our default export contains a base set of ESLint rules for ES6+:

yarn add --dev eslint @metamask/eslint-config eslint-plugin-import

List @metamask/eslint-config to your ESLint config via extends:

module.exports = {
  extends: [
    '@metamask/eslint-config',
  ],
}

Node.js

An additional config that supports Node.js-specific environments:

module.exports = {
  extends: [
    '@metamask/eslint-config',
    '@metamask/eslint-config/config/nodejs',
  ],
}

To lint the .eslintrc.js file itself, you will need to add this config in addition to the base config.

Jest

An additional config that adds support for Jest:

yarn add --dev eslint @metamask/eslint-config eslint-plugin-{import,jest}
module.exports = {
  root: true,
  extends: [
    '@metamask/eslint-config',
    '@metamask/eslint-config/config/jest',
  ],
}

Mocha

An additional config that adds support for Mocha:

yarn add --dev eslint @metamask/eslint-config eslint-plugin-{import,mocha}
module.exports = {
  root: true,
  extends: [
    '@metamask/eslint-config',
    '@metamask/eslint-config/config/mocha',
  ],
}

If your project has prefer-arrow-callback you will need to disable that and replace it with mocha/prefer-arrow-callback.

TypeScript

An additional config that adds support for TypeScript:

yarn add --dev \
  eslint \
  @metamask/eslint-config \
  eslint-plugin-import \
  @typescript-eslint/eslint-plugin \
  @typescript-eslint/parser
module.exports = {
  root: true,
  extends: [
    '@metamask/eslint-config',
    '@metamask/eslint-config/config/typescript',
  ],
  // If you have JS files for config, etc. you'll need to set their sourceType
  // explicitly as the default sourceType for TS projects is 'module'
  overrides: [{
    files: [
      '.eslintrc.js',
    ],
    parserOptions: {
      sourceType: 'script',
    },
  }],
};

Release & Publishing

The project follows the same release process as the other libraries in the MetaMask organization:

  1. Create a release branch
    • For a typical release, this would be based on master
    • To update an older maintained major version, base the release branch on the major version branch (e.g. 1.x)
  2. Update the changelog
  3. Update version in package.json file (e.g. yarn version --minor --no-git-tag-version)
  4. Create a pull request targeting the base branch (e.g. master or 1.x)
  5. Code review and QA
  6. Once approved, the PR is squashed & merged
  7. The commit on the base branch is tagged
  8. The tag can be published as needed

FAQs

Package last updated on 18 Apr 2020

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