eslint-flat-config-utils
Utils for managing and manipulating ESLint flat config arrays
Documentation
Install
npm i eslint-flat-config-utils
Utils
Most of the descriptions are written in JSDoc, you can find more details in the documentation via JSR.
Here listing a few highlighted ones:
concat
Concatenate multiple ESLint flat configs into one, resolve the promises, and flatten the array.
import { concat } from 'eslint-flat-config-utils'
export default concat(
{
plugins: {},
rules: {},
},
[
{
plugins: {},
rules: {},
}
],
Promise.resolve({
files: ['*.ts'],
rules: {},
})
)
composer
Create a chainable composer that makes manipulating ESLint flat config easier.
It extends Promise, so that you can directly await or export it to eslint.config.mjs
import { composer } from 'eslint-flat-config-utils'
export default composer(
{
plugins: {},
rules: {},
}
)
.append(
)
.prepend(
)
.insertAfter(
'config-name',
)
.renamePlugins({
'old-name': 'new-name',
'n': 'node'
})
.override(
'config-name',
{
rules: {
'no-console': 'off'
},
}
)
extend
Extend another flat config from a different root, and rewrite the glob paths accordingly:
import { extend } from 'eslint-flat-config-utils'
export default [
...await extend(
import('./sub-package/eslint.config.mjs'),
'./sub-package/'
)
]
License
MIT License © 2023-PRESENT Anthony Fu