File tree Expand file tree Collapse file tree 3 files changed +29
-15
lines changed
eslint-plugin-mdx/src/rules Expand file tree Collapse file tree 3 files changed +29
-15
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " eslint-mdx " : patch
3
+ " eslint-plugin-mdx " : patch
4
+ ---
5
+
6
+ fix: pass through ` remarkConfigPath ` of ` parserOptions `
Original file line number Diff line number Diff line change @@ -5,12 +5,15 @@ import type { JSXElement } from 'estree-jsx'
5
5
import type { Root } from 'mdast'
6
6
import type { VFileMessage } from 'vfile-message'
7
7
8
- export interface ParserOptions extends Linter . ParserOptions {
8
+ export interface CommonOptions {
9
+ ignoreRemarkConfig ?: boolean
10
+ remarkConfigPath ?: string
11
+ }
12
+
13
+ export interface ParserOptions extends Linter . ParserOptions , CommonOptions {
9
14
extensions ?: string [ ] | string
10
15
markdownExtensions ?: string [ ] | string
11
16
filePath ?: string
12
- ignoreRemarkConfig ?: boolean
13
- remarkConfigPath ?: string
14
17
}
15
18
16
19
export interface NormalPosition {
@@ -23,10 +26,8 @@ export interface NormalPosition {
23
26
range : [ number , number ]
24
27
}
25
28
26
- export interface SyncOptions {
29
+ export interface SyncOptions extends CommonOptions {
27
30
cwd ?: string
28
- ignoreRemarkConfig ?: boolean
29
- remarkConfigPath ?: string
30
31
}
31
32
32
33
export interface WorkerOptions extends SyncOptions {
Original file line number Diff line number Diff line change @@ -27,25 +27,31 @@ export const remark: Rule.RuleModule = {
27
27
const extname = path . extname ( filename )
28
28
// eslint-disable-next-line sonarjs/deprecation -- FIXME: ESLint 8.40+ required
29
29
const sourceCode = context . getSourceCode ( )
30
- // eslint-disable-next-line sonarjs/deprecation -- FIXME: ESLint 8.40+ required
31
- const options = context . parserOptions as ParserOptions
32
- const isMdx = [
33
- ...DEFAULT_EXTENSIONS ,
34
- ...( options . extensions || [ ] ) ,
35
- ] . includes ( extname )
30
+
31
+ const {
32
+ extensions,
33
+ markdownExtensions,
34
+ ignoreRemarkConfig,
35
+ remarkConfigPath,
36
+ } =
37
+ // eslint-disable-next-line sonarjs/deprecation -- FIXME: ESLint 8.40+ required
38
+ context . parserOptions as ParserOptions
39
+
40
+ const isMdx = [ ...DEFAULT_EXTENSIONS , ...( extensions || [ ] ) ] . includes (
41
+ extname ,
42
+ )
36
43
const isMarkdown = [
37
44
...MARKDOWN_EXTENSIONS ,
38
- ...( options . markdownExtensions || [ ] ) ,
45
+ ...( markdownExtensions || [ ] ) ,
39
46
] . includes ( extname )
47
+
40
48
return {
41
49
Program ( node ) {
42
50
/* istanbul ignore if */
43
51
if ( ! isMdx && ! isMarkdown ) {
44
52
return
45
53
}
46
54
47
- const ignoreRemarkConfig = Boolean ( options . ignoreRemarkConfig )
48
-
49
55
const sourceText = sourceCode . getText ( node )
50
56
51
57
const { messages, content : fixedText } = performSyncWork ( {
@@ -56,6 +62,7 @@ export const remark: Rule.RuleModule = {
56
62
isMdx,
57
63
process : true ,
58
64
ignoreRemarkConfig,
65
+ remarkConfigPath,
59
66
} )
60
67
61
68
let fixed = 0
You can’t perform that action at this time.
0 commit comments