Skip to content

Commit

Permalink
FIxed recommended config for legacy eslintrc config format (#36)
Browse files Browse the repository at this point in the history
* Added v8 compatibility test

* Added a legacy config

* Clean up scripts

* updated readme

* Keep things the same for eslintrc

* Imporved the naming
  • Loading branch information
ihordiachenko authored Jun 3, 2024
1 parent 3ab221e commit 7d1d73e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ESLint 9 flat config format:
const pluginChaiFriendly = require("eslint-plugin-chai-friendly");

module.exports = [
pluginChaiFriendly.configs.recommended,
pluginChaiFriendly.configs.recommendedFlat,
// other configurations
]
```
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const pluginChaiFriendly = require("./lib");

module.exports = [
pluginChaiFriendly.configs.recommended,
pluginChaiFriendly.configs.recommendedFlat,
{
ignores: ["node_modules", "!.eslintrc.js", "examples"],
}
Expand Down
14 changes: 13 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,26 @@ const plugin = {

// assign configs here so we can reference `plugin`
Object.assign(plugin.configs, {
recommended: {
// Compatible with ESLint v9 flat configs
recommendedFlat: {
plugins: {
'chai-friendly': plugin
},
rules: {
'chai-friendly/no-unused-expressions': 'error',
'no-unused-expressions': 'off'
}
},

// Compatible with ESLint <9 eslintrc configs
recommended: {
plugins: [
'chai-friendly'
],
rules: {
'no-unused-expressions': 0, // disable original rule
'chai-friendly/no-unused-expressions': 2
}
}
},)

Expand Down

0 comments on commit 7d1d73e

Please sign in to comment.