Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

xpring-eng/eslint-config-mocha

Repository files navigation

@xpring-eng/eslint-config-mocha

npm version Downloads/month

A linting configuration for enforcing best practices using the Mocha test library (with Chai).

Installation

First, install the needed development dependencies:

# Ensure ESLint is installed
npm install --save-dev eslint
# Install plugins used by @xpring-eng/eslint-config-mocha
npm install --save-dev eslint-plugin-mocha @fintechstudios/eslint-plugin-chai-as-promised

# Install the Xpring ESLint Mocha config
npm install --save-dev @xpring-eng/eslint-config-mocha

Usage

Then, configure your ESLint to use the Xpring configuration. An example ESLint configuration is provided below:

module.exports = {
  root: true,

  // Make ESLint compatible with TypeScript
  parser: '@typescript-eslint/parser',
  parserOptions: {
    // Enable linting rules with type information from our tsconfig
    tsconfigRootDir: __dirname,
    project: ['./tsconfig.json'],

    // Allow the use of imports / ES modules
    sourceType: 'module',

    ecmaFeatures: {
      // Enable global strict mode
      impliedStrict: true,
    },
  },

  // Specify global variables that are predefined
  env: {
    node: true, // Enable node global variables & Node.js scoping
    es2020: true, // Add all ECMAScript 2020 globals and automatically set the ecmaVersion parser option to ES2020
  },

  plugins: [],
  // extends: ['@xpring-eng/eslint-config-mocha'],
  extends: ['@xpring-eng/eslint-config-mocha', '@xpring-eng/eslint-config-base'],
  rules: {},
  overrides: [],
}

About

An ESLint configuration for Mocha tests

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published