Skip to content
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

imports-as-dependencies: package with exports instead of types #1114

Open
regseb opened this issue Jun 6, 2023 · 1 comment
Open

imports-as-dependencies: package with exports instead of types #1114

regseb opened this issue Jun 6, 2023 · 1 comment

Comments

@regseb
Copy link

regseb commented Jun 6, 2023

Expected behavior

imports-as-dependencies supports types defined in the exports property.

Actual behavior

imports-as-dependencies reports: import points to package which is not found in dependencies. Because the rule only looks at the types and typings properties. importsAsDependencies.js#L85

Files

package.json

{
  "name": "testcase",
  "dependencies": {
    "eslint": "8.42.0",
    "eslint-plugin-jsdoc": "46.2.4",
    "playwright": "1.34.3"
  },
  "eslintConfig": {
    "plugins": [
      "jsdoc"
    ],
    "rules": {
      "jsdoc/imports-as-dependencies": "error"
    }
  }
}

index.js

/**
 * @type {import("playwright")}
 */
var playwright;

Environment

  • Node version: 18.16.0
  • ESLint version 8.42.0
  • eslint-plugin-jsdoc version: 46.2.4

Additional info

There's a similar problem with ESLint rules checking imports, as they only look at the main property:

@brettz9
Copy link
Collaborator

brettz9 commented Jun 7, 2023

I've filed lukeed/resolve.exports#30 so we can hopefully reuse that package's mechanism for navigating exports (which is not trivial).

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

No branches or pull requests

2 participants