0.0.30 • Published 5 months ago

@sequencemedia/eslint-merge v0.0.30

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

@sequencemedia/eslint-merge

Merge Flat Config for ESLint v9

Install

npm i -D @sequencemedia/eslint-merge

Use

The merge function combines two objects and returns the result

import merge from '@sequencemedia/eslint-merge'

The first argument should be a config, and the second argument an object which contains your changes

const result = merge(sharedConfig, changes)

You can easily achieve this with the spread operator in your eslint.config.*

/**
 *  You probably will use `import` to get this as a module!
 */
const sharedConfig = {
  name: 'shared config',
  files: [
    '**/*.{js,mjs,cjs}'
  ]
}

export default [
  {
    ...sharedConfig,
    files: [
      'src/**/*.{mjs,cjs}'
    ]
  }
]

But! Sometimes you need to make lots of changes, and many spreads is hard to manage, and hard to read

@sequencemedia/eslint-merge enables you to merge just your changes

/**
 *  Again, you will probably `import` this
 */
const sharedConfig = {
  name: 'shared config',
  files: [
    '**/*.{js,mjs,cjs}'
  ]
}

export default [
  merge(sharedConfig, {
    files: [
      'src/**/*.{mjs,cjs}'
    ]
  })
]

It's simpler to use spread for small projects, but for large or complex configurations (or for producing your own shared configs) use merge

0.0.30

5 months ago

0.0.29

6 months ago

0.0.28

6 months ago

0.0.27

6 months ago

0.0.26

6 months ago

0.0.25

6 months ago

0.0.24

6 months ago

0.0.23

6 months ago

0.0.22

6 months ago

0.0.21

6 months ago

0.0.20

7 months ago

0.0.19

8 months ago

0.0.18

8 months ago

0.0.17

8 months ago

0.0.16

8 months ago

0.0.15

8 months ago

0.0.14

8 months ago

0.0.12

8 months ago

0.0.13

8 months ago

0.0.11

8 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago

0.0.0

11 months ago