Skip to content

Commit 4f07e51

Browse files
authored
docs: correct bun installation command and use defineConfig in README (#269)
1 parent ab10682 commit 4f07e51

2 files changed

Lines changed: 19 additions & 13 deletions

File tree

packages/compat/README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ If you are using a plugin in your `eslint.config.js` that is not yet compatible
7575

7676
```js
7777
// eslint.config.js - ESM example
78+
import { defineConfig } from "eslint/config";
7879
import { fixupPluginRules } from "@eslint/compat";
7980
import somePlugin from "eslint-plugin-some-plugin";
8081

81-
export default [
82+
export default defineConfig([
8283
{
8384
plugins: {
8485
// insert the fixed plugin instead of the original
@@ -88,17 +89,18 @@ export default [
8889
"somePlugin/rule-name": "error",
8990
},
9091
},
91-
];
92+
]);
9293
```
9394

9495
Or in CommonJS:
9596

9697
```js
9798
// eslint.config.js - CommonJS example
99+
const { defineConfig } = require("eslint/config");
98100
const { fixupPluginRules } = require("@eslint/compat");
99101
const somePlugin = require("eslint-plugin-some-plugin");
100102

101-
module.exports = [
103+
module.exports = defineConfig([
102104
{
103105
plugins: {
104106
// insert the fixed plugin instead of the original
@@ -108,7 +110,7 @@ module.exports = [
108110
"somePlugin/rule-name": "error",
109111
},
110112
},
111-
];
113+
]);
112114
```
113115

114116
### Fixing Configs
@@ -117,30 +119,32 @@ If you are importing other configs into your `eslint.config.js` that use plugins
117119

118120
```js
119121
// eslint.config.js - ESM example
122+
import { defineConfig } from "eslint/config";
120123
import { fixupConfigRules } from "@eslint/compat";
121124
import someConfig from "eslint-config-some-config";
122125

123-
export default [
126+
export default defineConfig([
124127
...fixupConfigRules(someConfig),
125128
{
126129
// your overrides
127130
},
128-
];
131+
]);
129132
```
130133

131134
Or in CommonJS:
132135

133136
```js
134137
// eslint.config.js - CommonJS example
138+
const { defineConfig } = require("eslint/config");
135139
const { fixupConfigRules } = require("@eslint/compat");
136140
const someConfig = require("eslint-config-some-config");
137141

138-
module.exports = [
142+
module.exports = defineConfig([
139143
...fixupConfigRules(someConfig),
140144
{
141145
// your overrides
142146
},
143-
];
147+
]);
144148
```
145149

146150
### Including Ignore Files
@@ -151,6 +155,7 @@ The `includeIgnoreFile()` function also accepts a second optional `name` paramet
151155

152156
```js
153157
// eslint.config.js - ESM example
158+
import { defineConfig } from "eslint/config";
154159
import { includeIgnoreFile } from "@eslint/compat";
155160
import path from "node:path";
156161
import { fileURLToPath } from "node:url";
@@ -159,28 +164,29 @@ const __filename = fileURLToPath(import.meta.url);
159164
const __dirname = path.dirname(__filename);
160165
const gitignorePath = path.resolve(__dirname, ".gitignore");
161166

162-
export default [
167+
export default defineConfig([
163168
includeIgnoreFile(gitignorePath, "Imported .gitignore patterns"), // second argument is optional.
164169
{
165170
// your overrides
166171
},
167-
];
172+
]);
168173
```
169174
170175
Or in CommonJS:
171176
172177
```js
173178
// eslint.config.js - CommonJS example
179+
const { defineConfig } = require("eslint/config");
174180
const { includeIgnoreFile } = require("@eslint/compat");
175181
const path = require("node:path");
176182
const gitignorePath = path.resolve(__dirname, ".gitignore");
177183

178-
module.exports = [
184+
module.exports = defineConfig([
179185
includeIgnoreFile(gitignorePath, "Imported .gitignore patterns"), // second argument is optional.
180186
{
181187
// your overrides
182188
},
183-
];
189+
]);
184190
```
185191
186192
**Limitation:** This works without modification when the ignore file is in the same directory as your config file. If the ignore file is in a different directory, you may need to modify the patterns manually.

templates/package/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ yarn add @eslint/<%= name %>
1515
# or
1616
pnpm install @eslint/<%= name %>
1717
# or
18-
bun install @eslint/<%= name %>
18+
bun add @eslint/<%= name %>
1919
```
2020

2121
For Deno:

0 commit comments

Comments
 (0)