Skip to content

Commit

Permalink
fixupConfigRules to accept object
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed May 6, 2024
1 parent 0779ae4 commit a62f9f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/compat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports = [

### Fixing Configs

If you are importing other configs into your `eslint.config.js` that use plugins that are not yet compatible with ESLint 9.x, you can wrap the entire array using the `fixupConfigRules()` function:
If you are importing other configs into your `eslint.config.js` that use plugins that are not yet compatible with ESLint 9.x, you can wrap the entire array or a single object using the `fixupConfigRules()` function:

```js
// eslint.config.js - ESM example
Expand Down
6 changes: 4 additions & 2 deletions packages/compat/src/fixup-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,12 @@ export function fixupPluginRules(plugin) {
/**
* Takes the given configuration and creates a new configuration with all of the
* rules wrapped to provide the missing methods on the `context` object.
* @param {FixupConfigArray} configs The configuration to fix up.
* @param {FixupConfigArray|FixupConfig} config The configuration to fix up.
* @returns {FixupConfigArray} The fixed-up configuration.
*/
export function fixupConfigRules(configs) {
export function fixupConfigRules(config) {
const configs = Array.isArray(config) ? config : [config];

return configs.map(config => {
if (!config.plugins) {
return config;
Expand Down

0 comments on commit a62f9f1

Please sign in to comment.