You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/use/configure/configuration-files-new.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -529,6 +529,42 @@ export default [
529
529
];
530
530
```
531
531
532
+
ESLint only lints named code blocks when they are JavaScript files or if they match a `files` entry in a config object. Be sure to add a config object with a matching `files` entry if you want to lint non-JavaScript named code blocks. Also note that [global ignores](#globally-ignoring-files-with-ignores) apply to named code blocks as well.
533
+
534
+
```js
535
+
// eslint.config.js
536
+
importmarkdownfrom"eslint-plugin-markdown";
537
+
538
+
exportdefault [
539
+
540
+
// applies to Markdown files
541
+
{
542
+
files: ["**/*.md"],
543
+
plugins: {
544
+
markdown
545
+
},
546
+
processor:"markdown/markdown"
547
+
},
548
+
549
+
// applies to all .jsx files, including jsx blocks inside of Markdown files
550
+
{
551
+
files: ["**/*.jsx"],
552
+
languageOptions: {
553
+
parserOptions: {
554
+
ecmaFeatures: {
555
+
jsx:true
556
+
}
557
+
}
558
+
}
559
+
},
560
+
561
+
// ignore jsx blocks inside of test.md files
562
+
{
563
+
ignores: ["**/test.md/*.jsx"]
564
+
}
565
+
];
566
+
```
567
+
532
568
### Configuring rules
533
569
534
570
You can configure any number of rules in a configuration object by add a `rules` property containing an object with your rule configurations. The names in this object are the names of the rules and the values are the configurations for each of those rules. Here's an example:
0 commit comments