-
-
Notifications
You must be signed in to change notification settings - Fork 169
Description
I have the following jsdoc comment:
/** @type { import('@typescript-eslint/utils').TSESLint.FlatConfig.Config['rules'] } */
The new prefer-import-tag rule suggests replacing the import()
with an @import
comment. The autofix then generates the following:
/** @import * as @typescript-eslint/utils from '@typescript-eslint/utils'; */
/** @type {@typescript-eslint/utils.TSESLint.FlatConfig.Config['rules']} */
But @typescript-eslint/utils
is not a valid identifier. This triggers an escape-inline-tags
warning on the first line and a valid-types
warning on the second - but more importantly, it doesn't work.
I suggest either disabling the autofix if the package name isn't a valid identifier, or adding some sort of escaping logic.
For example, typescriptEslintUtils
would be valid - but that means stripping the @
and producing upper case letters after -
and /
. More generally you'd need to handle .
too for cases like https://www.npmjs.com/package/chart.js and there might be other exceptions, so I don't know if it's worth it (though import()
s can be very repetitive, so an autofix is definitely nice to have).