-
Notifications
You must be signed in to change notification settings - Fork 198
The 'import-name' rule threw an error. Cannot read property 'importClause' of undefined #667
Comments
Hi @joseSantacruz , could you please provide provide reduced test case from I've tried to reproduce it, but got another exception: import 'some-module'; leads to
|
I'm seeing the
and
|
@jvanoostveen first one causes your exceptions, because there are no |
For this import, we disable the linting rule: 'no-import-side-effect'. No other issues with crashing rules. But not all Microsoft contrib rules are enabled, so not all are tested. |
I'm waiting for some code that triggers initial exception and then will work on fix. |
Hi @IllusionMH , this is the code of the SejiValidationHandler.ts /**
* Seji Validation Handler
*/
import {
BUILDER_API_GATEWAY_MIDDLEWARE,
ContentTypeEnum,
ERROR_API_MIDDLEWARE,
IDENTIFIERS as ID,
IHandler,
INPUT_OUTPUT_LOGS,
IRollbar,
SETUP_MIDDLEWARE,
SSM_MIDDLEWARE,
StatusCodeEnum,
VALIDATION_MIDDLEWARE,
} from "@kushki/core";
import { IDENTIFIERS } from "constant/Identifiers";
import { CONTAINER } from "infrastructure/Container";
import * as middy from "middy";
import "reflect-metadata";
import { ISejiService } from "repository/ISejiService";
import * as Rollbar from "rollbar";
import "source-map-support/register";
const CORE: IHandler = CONTAINER.get<IHandler>(ID.IHandler);
const ROLLBAR: Rollbar = CONTAINER.get<IRollbar>(ID.IRollbar).init();
const HANDLER: middy.IMiddy = middy(
ROLLBAR.lambdaHandler(
CORE.run<
ISejiService, // Service Definition
object
>( // Service observable resolve type
IDENTIFIERS.SejiService, // Service instance
"validate", // Service Method,
CONTAINER,
ROLLBAR
)
)
)
.use(SETUP_MIDDLEWARE(ROLLBAR))
.use(INPUT_OUTPUT_LOGS(ROLLBAR))
.use(ERROR_API_MIDDLEWARE(ROLLBAR))
.use(SSM_MIDDLEWARE(ROLLBAR))
.use(
BUILDER_API_GATEWAY_MIDDLEWARE(
ROLLBAR,
ContentTypeEnum.JSON,
StatusCodeEnum.OK,
ContentTypeEnum.JSON,
true
)
)
.use(
VALIDATION_MIDDLEWARE(ROLLBAR, {
path: "seji_validate_pathparameters",
})
);
export { HANDLER }; And in case is usefull this is my current tsconfig {
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": false,
"target": "es2016",
"lib": ["es2017", "dom"],
"sourceMap": true,
"alwaysStrict": true,
"baseUrl": ".",
"types": ["mocha", "node", "reflect-metadata"],
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"noStrictGenericChecks": true,
"paths": {
"handler/*": ["src/handler/*"],
"constant/*": ["src/constant/*"],
"gateway/*": ["src/gateway/*"],
"infrastructure/*": ["src/infrastructure/*"],
"model/*": ["src/model/*"],
"repository/*": ["src/repository/*"],
"service/*": ["src/service/*"],
"typings": ["typings.d.ts"],
"utils/*": ["src/utils/*"],
"error/*": ["src/error/*"],
"types/*": ["types/*"]
}
},
"exclude": ["node_modules"]
}
|
@joseSantacruz thanks for your code. Could you please comment lines import "reflect-metadata"; and import "source-map-support/register"; and try lint again. And what node.js version do you use? Maybe something changed in exceptions reports. |
@IllusionMH after removing the imports the error disappears, my node version is 8.10.0. So I think the error should be the same |
Really strange.
But still I can't get The other strange thing is stack trace. Where traces are identical except only line numbers of last string:
And in my case (for 6.0.0) I have
and I'm out of ideas at this moment. @joseSantacruz could you please show what params do you pass in UPD. No luck with Linux. Tried it Docker container - still same error as on Windows. Will proceed with fix for |
Hi @IllusionMH this is the command that I'm running |
I just came across this too. It was because my I guess I'll wait for this to be merged into the next release. |
I'm also finding I have the same error since updating package.
It's imports like these I've tried disabling the rule for that line, but it must try and parse it anyway. |
I receive this error when I try to import |
💀 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.0.0TypeScript code being linted
// code snippet
with
tslint.json
configuration:Actual behavior
Expected behavior
Rule should not crash and no linting issue should be found.
The text was updated successfully, but these errors were encountered: