Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/new-pumpkins-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-mdx": patch
---

fix: set `processor` for flat config
5 changes: 5 additions & 0 deletions .changeset/purple-terms-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-mdx": patch
---

fix: prefer `context.languageOptions.parserOptions` over `context.parserOptions`
4 changes: 2 additions & 2 deletions packages/eslint-plugin-mdx/src/configs/flat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import type { Linter } from 'eslint'
import * as eslintMdx from 'eslint-mdx'

import * as mdx from '../index.js'
import { remark } from '../processors/remark.js'

import { codeBlocks } from './code-blocks.js'

// eslint-disable-next-line sonarjs/deprecation
export const flat: Linter.FlatConfig = {
files: ['**/*.{md,mdx}'],
languageOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
parser: eslintMdx,
globals: {
React: false,
Expand All @@ -19,6 +18,7 @@ export const flat: Linter.FlatConfig = {
plugins: {
mdx,
},
processor: remark,
rules: {
'mdx/remark': 'warn',
'no-unused-expressions': 'error',
Expand Down
7 changes: 5 additions & 2 deletions packages/eslint-plugin-mdx/src/rules/remark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@ export const remark: Rule.RuleModule = {
// eslint-disable-next-line sonarjs/deprecation -- FIXME: ESLint 8.40+ required
const sourceCode = context.getSourceCode()

/* istanbul ignore next */
const {
extensions,
markdownExtensions,
ignoreRemarkConfig,
remarkConfigPath,
} =
} = {
// eslint-disable-next-line sonarjs/deprecation -- FIXME: ESLint 8.40+ required
context.parserOptions as ParserOptions
...context.parserOptions,
...context.languageOptions?.parserOptions,
} as ParserOptions

const isMdx = [...DEFAULT_EXTENSIONS, ...(extensions || [])].includes(
extname,
Expand Down
Loading