Skip to content

Inline imports marked as invalid, though supported #706

@tedbarth

Description

@tedbarth

Version: 32.3.0

The following code will be marked as invalid due to broken support for inline imports for types.
We get ESLint: Syntax error in type: import("@amcharts/amcharts4/charts").SeriesDataItem(jsdoc/valid-types) for both inline imports, while they work fine for code inference in VSCode and Intellij Webstorm/Ultimate.

test.js

/**
 * Returns a series.
 *
 * @param {import("@amcharts/amcharts4/charts").SeriesDataItem} dataSeries - A series
 * @return {int} The item height
 */
function foo (dataSeries) {
  return dataSeries.itemHeight;
}

/**
 * @param {import('./foo').Foo} foo
 */
function qux(foo) {
}

foo.js

/**
 * @typedef Foo
 * @property {string} bar
 */

.eslintrc.js

module.exports = {
  plugins: [
    'jsdoc',
  ],

  rules: {
    'jsdoc/valid-types': 'error',
  },
};

package.json

{
  "dependencies": {
    "@amcharts/amcharts4": "4.10.17"
  },
  "devDependencies": {
    "eslint": "7.22.0",
    "eslint-plugin-jsdoc": "32.3.0"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions