File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed
packages/eslint-config-airbnb-base/rules Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ // eslint.config.js
2
+ const markdown = require ( 'eslint-plugin-markdown' ) ;
3
+
4
+ module . exports = [
5
+ {
6
+ plugins : {
7
+ markdown,
8
+ } ,
9
+ } ,
10
+ {
11
+ files : [ '**/*.md' ] ,
12
+ processor : 'markdown/markdown' ,
13
+ } ,
14
+ {
15
+ files : [ '**/*.md/*.js' ] ,
16
+ languageOptions : {
17
+ ecmaVersion : 2021 ,
18
+ sourceType : 'module' ,
19
+ } ,
20
+ rules : {
21
+ semi : [ 'error' , 'always' ] ,
22
+ 'no-unused-vars' : 'warn' ,
23
+ 'no-undef' : 'error' ,
24
+ } ,
25
+ } ,
26
+ ] ;
Original file line number Diff line number Diff line change 40
40
},
41
41
"homepage" : " https://github.com/airbnb/javascript" ,
42
42
"devDependencies" : {
43
+ "eslint" : " ^9.31.0" ,
44
+ "eslint-plugin-markdown" : " ^5.1.0" ,
43
45
"markdownlint" : " ^0.29.0" ,
44
46
"markdownlint-cli" : " ^0.35.0"
45
47
}
Original file line number Diff line number Diff line change @@ -280,4 +280,23 @@ module.exports = {
280
280
// TODO, semver-minor: enable
281
281
'import/no-empty-named-blocks' : 'off' ,
282
282
} ,
283
+ plugins : [ "markdown" ] ,
284
+ overrides : [
285
+ {
286
+ // Step 2a: Extract code blocks from markdown
287
+ files : [ "**/*.md" ] ,
288
+ processor : "markdown/markdown"
289
+ } ,
290
+ {
291
+ // Step 2b: Apply JS rules to those code blocks
292
+ files : [ "**/*.md/*.js" ] ,
293
+ rules : {
294
+ // Allow console logs in docs
295
+ "no-console" : "off" ,
296
+ // Don't bother with unresolved imports in examples
297
+ "import/no-unresolved" : "off"
298
+ }
299
+ }
300
+ // ...other overrides or rules
301
+ ] ,
283
302
} ;
You can’t perform that action at this time.
0 commit comments