0.0.41 • Published 2 years ago

@gmjs/eslint-config v0.0.41

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ESLint Config

This package contains a function used to create an ESLint config object.

Installation

npm install --save-dev @gmjs/eslint-config

Usage

Create an ESLint config file, one of:

  • eslint.config.js
  • eslint.config.cjs
  • eslint.config.mjs

Then use something like the following code (if using esm module syntax):

import { getEsLintConfigs } from '@gmjs/eslint-config';

export default [
  ...getEsLintConfigs({ projectType: 'node' })
];

Or equivalent commonjs syntax:

const { getEsLintConfigs } = require('@gmjs/eslint-config');

module.exports = [
  ...getEsLintConfigs({ projectType: 'node' })
];

API

getEsLintConfigs

Accepts a single parameter, options of type EslintConfigOptions.

Return a list of EsLint configurations, to be used in your project.

You can specify different project types:

  • 'shared' - For projects to be used from either Node or Browser.
  • 'node' - For Node.js projects.
  • 'browser' - For browser projects.
  • 'react' - For React projects.
import { getEsLintConfigs } from '@gmjs/eslint-config';

export default [...getEsLintConfigs({ projectType: 'node' })];

Types

EslintConfigOptions

type ProjectType = 'shared' | 'node' | 'browser' | 'react';

interface EslintConfigOptionsBase {
  readonly projectType: ProjectType;
}

interface EslintConfigOptionsReact extends EslintConfigOptionsBase {
  readonly projectType: 'react';
  readonly storybook: boolean;
}

interface EslintConfigOptionsBrowser extends EslintConfigOptionsBase {
  readonly projectType: 'browser';
}

interface EslintConfigOptionsNode extends EslintConfigOptionsBase {
  readonly projectType: 'node';
}

interface EslintConfigOptionsShared extends EslintConfigOptionsBase {
  readonly projectType: 'shared';
}

type EslintConfigOptions =
  | EslintConfigOptionsReact
  | EslintConfigOptionsBrowser
  | EslintConfigOptionsNode
  | EslintConfigOptionsShared;
0.0.40

2 years ago

0.0.41

2 years ago

0.0.37

2 years ago

0.0.38

2 years ago

0.0.39

2 years ago

0.0.33

2 years ago

0.0.34

2 years ago

0.0.35

2 years ago

0.0.36

2 years ago

0.0.30

2 years ago

0.0.31

2 years ago

0.0.32

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.14

3 years ago

0.0.26

2 years ago

0.0.27

2 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago