Skip to content

Commit 1ace67d

Browse files
authored
chore: update example to use defineConfig (#20111)
* chore: update example to use `defineConfig` * wip
1 parent 4821963 commit 1ace67d

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

docs/_examples/custom-rule-tutorial-code/eslint.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
*/
55
"use strict";
66

7+
// Import the `defineConfig` helper function
8+
const { defineConfig } = require("eslint/config");
79
// Import the ESLint plugin
810
const eslintPluginExample = require("./eslint-plugin-example");
911

10-
module.exports = [
12+
module.exports = defineConfig([
1113
{
1214
files: ["**/*.js"],
1315
languageOptions: {
@@ -20,4 +22,4 @@ module.exports = [
2022
"example/enforce-foo-bar": "error",
2123
},
2224
},
23-
];
25+
]);

docs/_examples/custom-rule-tutorial-code/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
"author": "",
1919
"license": "ISC",
2020
"devDependencies": {
21-
"eslint": "^9.1.1"
21+
"eslint": "^9.35.0"
2222
}
2323
}

docs/_examples/integration-tutorial-code/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"author": "",
1212
"license": "ISC",
1313
"dependencies": {
14-
"eslint": "^9.1.1"
14+
"eslint": "^9.35.0"
1515
}
1616
}

docs/src/extend/custom-rule-tutorial.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,12 @@ Then, add the following code to `eslint.config.js`:
312312
// eslint.config.js
313313
"use strict";
314314

315+
// Import the `defineConfig` helper function
316+
const { defineConfig } = require("eslint/config");
315317
// Import the ESLint plugin locally
316318
const eslintPluginExample = require("./eslint-plugin-example");
317319

318-
module.exports = [
320+
module.exports = defineConfig([
319321
{
320322
files: ["**/*.js"],
321323
languageOptions: {
@@ -328,7 +330,7 @@ module.exports = [
328330
"example/enforce-foo-bar": "error",
329331
},
330332
},
331-
];
333+
]);
332334
```
333335

334336
Before you can test the rule, you must create a file to test the rule on.

0 commit comments

Comments
 (0)