Skip to content

False positive of Unable to resolve path to module 'typescript-eslint' import/no-unresolved #3187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jimmykane opened this issue May 16, 2025 · 2 comments

Comments

@jimmykane
Copy link

Hi there,

just setted up a new project and new eslint .

Here is the lint config.

import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';
import json from '@eslint/json';
import markdown from '@eslint/markdown';
import css from '@eslint/css';
import { defineConfig } from 'eslint/config';
import react from 'eslint-plugin-react-x';
import reactDom from 'eslint-plugin-react-dom';
import importPlugin from 'eslint-plugin-import';

export default defineConfig([
    { ignores: ['dist', 'node_modules', 'package-lock.json'] }, 
    {
        files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
        languageOptions: {
            ecmaVersion: 'latest',
            globals: globals.browser
        },
        plugins: {
            'react-hooks': reactHooks,
            'react-refresh': reactRefresh
        },
        rules: {
            'react-refresh/only-export-components': [
                'warn',
                { allowConstantExport: true }
            ],
            'react-x/no-class-component': 'error',
            'react-x/no-unstable-context-value': 'error',
            'import/order': [
                'error',
                {
                    groups: ['builtin', 'external', 'internal'],
                    pathGroups: [
                        {
                            pattern: '{react,react-dom/**}',
                            group: 'external',
                            position: 'before'
                        }
                    ],
                    pathGroupsExcludedImportTypes: ['react']
                }
            ]
        },
        extends: [
            js.configs.recommended,
            tseslint.configs.recommended,
            react.configs.recommended,
            reactDom.configs.recommended,
            importPlugin.flatConfigs.recommended,
            importPlugin.flatConfigs.typescript
        ]
    },
    {
        files: ['**/*.{ts}'],
        extends: [
            tseslint.configs.strictTypeChecked]
    },
    {
        files: ['**/*.json'],
        ignores: ['dist', 'tsconfig*.*.json'],
        plugins: { json },
        language: 'json/json',
        extends: ['json/recommended']
    },
    {
        files: ['**/*.jsonc', 'tsconfig*.*.json'],
        plugins: { json },
        language: 'json/jsonc',
        extends: ['json/recommended']
    },
    { files: ['**/*.json5'], plugins: { json }, language: 'json/json5', extends: ['json/recommended'] },
    { files: ['**/*.md'], plugins: { markdown }, language: 'markdown/commonmark', extends: ['markdown/recommended'] },
    { files: ['**/*.css'], plugins: { css }, language: 'css/css', extends: ['css/recommended'] }
]);

However what this produces is :

  5:22  error  Unable to resolve path to module 'typescript-eslint'  import/no-unresolved
  9:30  error  Unable to resolve path to module 'eslint/config'      import/no-unresolved

Strange as these modules are enabled and followed the readme correctly

Any tips?

@JounQin JounQin closed this as completed May 16, 2025
@jimmykane
Copy link
Author

@JounQin sorry but what more is needed? Run the above and the error comes from the same config file

eslint.config.mjs errors -> 

  5:22  error  Unable to resolve path to module 'typescript-eslint'  import/no-unresolved
  9:30  error  Unable to resolve path to module 'eslint/config'      import/no-unresolved

@JounQin

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants