-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
The rule import/enforce-node-protocol-usage
is not working with code containing the export
keyword.
How to reproduce:
- Install
@jirimoravcik/eslint-plugin-import
with version2.32.0-beta.0
as the rule was merged after2.31.0
was released. - Do
'import/enforce-node-protocol-usage': ['error', 'always'],
in your eslint config - Create a TS file with the following content:
export class Thing {
constructor(public readonly name: string) {
// Do nothing.
}
public sayHello(): void {
console.log(`Hello, ${this.name}!`);
}
}
- Try to lint it
- You'll get an error:
TypeError: Cannot read properties of null (reading 'type')
Rule: "import-fixed/enforce-node-protocol-usage"
at checkAndReport (/Users/jirimoravcik/.../node_modules/@jirimoravcik/eslint-plugin-import/lib/rules/enforce-node-protocol-usage.js:47:11)
I fixed by doing an early return in jirimoravcik@272d471, but I'm not sure if that's the proper solution.
Thanks for looking into it.