-
Notifications
You must be signed in to change notification settings - Fork 198
import-name
6.2.0 ignoreExternalModules non-external modules that aren't TS or JS crash
#883
Comments
@dosentmatter thanks for the report. Do you have declare module "*.svg" {
// declaration for processed SVG type
} While Webpack (I assume you use it) can resolve correctly various extension TS doesn't process anything except TS/JS/JSON so this is probably root cause of difference. Anyway this shouldn't be runtime error. UPD. Removed incorrect mention of Webpack's |
Hey @IllusionMH, no problem. I didn't add a types.d.ts to my minimal example, but I just did and it doesn't change anything. In the original project I was working on, it had a types.d.ts, but still had the error. Yeah, I am using webpack svg loaders for storybook, rollup svg plugins for bundling, and jest svg ignore transforms for tests. Adding types.d.ts for my minimal example: declare module "*.svg" {
const a: string;
export default a;
} Here is the type showing in editor:
|
💀 It's time! 💀TSLint is deprecated and no longer accepting pull requests other than security fixes. See #876. ☠️ 👋 It was a pleasure open sourcing with you! |
Bug Report
tslint-microsoft-contrib
version: 6.2.0TypeScript code being linted
All the local files imported can just be empty.
with
tslint.json
configuration:tsconfig.json. It needs to be passed to
tslint -p
, but an empty one is fine.Actual behavior
I get this error
Expected behavior
It should not crash. It should just have a lint error on
blahSVG
->blahSvg
.In a debugger, you can see that the
resolvedModules
values areundefined
for non TS or JS files. It fails when accessing.value.isExternalLibraryImport
sincevalue
isundefined
.source lines
TS source says that
ResolvedModule
only picks up TS and JS filesI'm not sure why
import fooSvg from './foo.svg';
doesn't crash though.checkIgnoreExternalModule()
doesn't seem to be called on names that are named correctly. I haven't read all of your source code, but maybe you guys are doing a basic check for things already named in camelCase.Another thing is that the crash doesn't count as a lint error so lint still passes.
The text was updated successfully, but these errors were encountered: