0.0.30 • Published 1 month ago

@sequencemedia/eslint-merge v0.0.30

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month 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

1 month ago

0.0.29

2 months ago

0.0.28

2 months ago

0.0.27

2 months ago

0.0.26

2 months ago

0.0.25

2 months ago

0.0.24

2 months ago

0.0.23

2 months ago

0.0.22

3 months ago

0.0.21

3 months ago

0.0.20

4 months ago

0.0.19

4 months ago

0.0.18

4 months ago

0.0.17

5 months ago

0.0.16

5 months ago

0.0.15

5 months ago

0.0.14

5 months ago

0.0.12

5 months ago

0.0.13

5 months ago

0.0.11

5 months ago

0.0.10

5 months ago

0.0.9

5 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago

0.0.0

7 months ago