Skip to content

Commit

Permalink
docs: add flat config setup (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuunen authored Jun 23, 2024
1 parent d125afe commit f14308b
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Next, install `eslint-plugin-userscripts`:
npm install eslint-plugin-userscripts --save-dev
```

## Usage
## Usage in legacy config

Add `userscripts` to the plugins section of your `.eslintrc` configuration file:

Expand All @@ -26,6 +26,34 @@ Add `userscripts` to the plugins section of your `.eslintrc` configuration file:
}
```

## Usage in recent flat config

Add an element to the config array in your `eslint.config.*` file :

```js
const userscripts = require('eslint-plugin-userscripts')

module.exports = [
// other configs
{
files: ['*.user.js'],
plugins: {
'userscripts': {
rules: userscripts.rules,
},
},
rules: {
...userscripts.configs.recommended.rules,
},
settings: {
userscriptVersions: {
violentmonkey: '*',
},
},
},
]
```

## Supported Rules

| Rule | Description | Recommended |
Expand Down

0 comments on commit f14308b

Please sign in to comment.