Skip to content

Config inspector fails to load with eslint-plugin-mdx #201

@Simek

Description

@Simek

Description

Attempting to run npx eslint --inspect-config in project using eslint-plugin-mdx results in the following error:

Failed to load eslint.config.js
Error: Could not find ESLint Linter in require cache
    at file:///W:/GitHub/react-native-website/node_modules/eslint-plugin-mdx/lib/processors/options.js:5:11
    at ModuleJob.run (node:internal/modules/esm/module_job:377:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:671:26)
    at async extractResult (file:///C:/Users/Simek/AppData/Local/npm-cache/_npx/fadb285f08a830ab/node_modules/bundle-require/dist/index.js:169:15)
    at async run (file:///C:/Users/Simek/AppData/Local/npm-cache/_npx/fadb285f08a830ab/node_modules/bundle-require/dist/index.js:211:17)

The check for require cache in the plugin seems to be a problem:

The failure since to be OS agnostic (not related to paths), since it happens on macOS and Windows.

Reproduction steps

  1. Check out https://github.com/facebook/react-native-website.
  2. Run npx eslint --inspect-config at thge root to see the failure.
  3. Comment out eslint-plugin-mdx import and its usages in eslint.config.js:
    import * as eslintPluginMdx from 'eslint-plugin-mdx';
    
    [...]
    
    ...eslintPluginMdx.flat,
    processor: eslintPluginMdx.createRemarkProcessor({
      lintCodeBlocks: false,
      remarkConfigPath: 'website/.remarkrc.mjs',
    }),
  4. Re-run npx eslint --inspect-config, it should work now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions