8000 [@typescript-eslint/no-restricted-imports] Cannot convert undefined or null to object · Issue #3933 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
[@typescript-eslint/no-restricted-imports] Cannot convert undefined or null to object #3933
Closed
@EvgenyOrekhov

Description

@EvgenyOrekhov
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "@typescript-eslint/no-restricted-imports": "error"
  }
}

OR extend the plugin:@typescript-eslint/all config.

export default "test";

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx"
  },
  "include": ["src"]
}

Expected Result

No fatal errors.

Actual Result

Fatal error:

Oops! Something went wrong! :(

ESLint: 7.32.0

TypeError: Error while loading rule '@typescript-eslint/no-restricted-imports': Cannot convert undefined or null to object
Occurred while linting /src/test.tsx
    at hasOwnProperty (<anonymous>)
    at isObjectOfPaths (/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-restricted-imports.js:50:44)
    at isOptionsArrayOfStringOrObject (/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-restricted-imports.js:56:9)
    at getRestrictedPaths (/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-restricted-imports.js:65:9)
    at create (/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-restricted-imports.js:97:33)

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 4.32.0
@typescript-eslint/parser 4.32.0
TypeScript 4.4.3
ESLint 7.32.0
node 14.17.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0