Skip to content

Failed to patch ESLint because the calling module was not recognized.Β #160

@alexaka1

Description

@alexaka1

The following results in an error:

pnpm dlx @oxlint/migrate eslint.config.mjs --type-aware
eslint.config.mjs
// @ts-check

import js from '@eslint/js';
import ts from 'typescript-eslint';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import oxlint from 'eslint-plugin-oxlint';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
  baseDirectory: __dirname,
});

const eslintConfig = ts.config(
  js.configs.recommended,
  ...compat.extends(
    'next/core-web-vitals' /*, 'next/typescript'*/ /*added by ts below*/,
  ),
  ...ts.configs.strictTypeChecked,
  ...ts.configs.stylisticTypeChecked,
  eslintConfigPrettier,
  {
    languageOptions: {
      parserOptions: {
        projectService: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
  // pluginQuery.configs['flat/recommended'],
  {
    rules: {
      '@typescript-eslint/array-type': 'off',
      '@typescript-eslint/consistent-type-definitions': 'off',
      '@typescript-eslint/consistent-type-imports': [
        'warn',
        {
          prefer: 'type-imports',
          fixStyle: 'inline-type-imports',
        },
      ],
      '@typescript-eslint/no-unused-vars': [
        'warn',
        {
          argsIgnorePattern: '^_',
        },
      ],
      // "@typescript-eslint/require-await": "off",
      '@typescript-eslint/no-misused-promises': [
        'error',
        {
          checksVoidReturn: {
            attributes: false,
          },
        },
      ],
    },
  },
  ...oxlint.configs['flat/recommended'], // oxlint should be the last one
);

export default eslintConfig;
/Users/alexaka1/git/personal/adev-nextjs-blog/node_modules/.pnpm/@[email protected]/node_modules/@rushstack/eslint-patch/lib/_patch-base.js:167
            throw new Error('Failed to patch ESLint because the calling module was not recognized.\n' +
                  ^

Error: Cannot read config file: /Users/alexaka1/git/personal/adev-nextjs-blog/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/eslint-config-next/index.js
Error: Failed to patch ESLint because the calling module was not recognized.
If you are using a newer ESLint version that may be unsupported, please create a GitHub issue:
https://github.com/microsoft/rushstack/issues
Referenced from: /Users/alexaka1/git/personal/adev-nextjs-blog/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/eslint-config-next/core-web-vitals.js
    at Object.<anonymous> (/Users/alexaka1/git/personal/adev-nextjs-blog/node_modules/.pnpm/@[email protected]/node_modules/@rushstack/eslint-patch/lib/_patch-base.js:167:19)
    at Module._compile (node:internal/modules/cjs/loader:1688:14)
    at Object..js (node:internal/modules/cjs/loader:1820:10)
    at Module.load (node:internal/modules/cjs/loader:1423:32)
    at Function._load (node:internal/modules/cjs/loader:1246:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1445:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/Users/alexaka1/git/personal/adev-nextjs-blog/node_modules/.pnpm/@[email protected]/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:11:23)

Node.js v22.18.0

The repo in question, if needed: https://github.com/alexaka1/adev-nextjs-blog/blob/36f06bdb46ca3cfb636c718134a75af4cd74ce6f/eslint.config.mjs
Version:

oxlint --version
Version: 1.11.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions