Encountered a javascript exception while trying to save the following LWC component via SFDX.
import * as lwc from 'lwc';
export default class extends lwc.LightningElement {
condition = true;
}
force-app/main/default/lwc/myComponent/myComponent.js
bad result: TypeError: Cannot read property 'name' of undefinedOccurred while linting <text>:3Rule: "@lwc/lwc/no-deprecated" at /home/sfdc/tools/lwc/240.1.2-2.20.5/node_modules/@lwc/eslint-plugin-lwc/lib/util/component.js:30:40 at Array.find (<anonymous>) at isComponent (/home/sfdc/tools/lwc/240.1.2-2.20.5/node_modules/@lwc/eslint-plugin-lwc/lib/util/component.js:29:62) at ClassDeclaration (/home/sfdc/tools/lwc/240.1.2-2.20.5/node_modules/@lwc/eslint-plugin-lwc/lib/rules/no-deprecated.js:64:22) at ruleErrorHandler (/home/sfdc/tools/lwc/240.1.2-2.20.5/node_modules/eslint/lib/linter/linter.js:1114:28) at /home/sfdc/tools/lwc/240.1.2-2.20.5/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach (<anonymous>)
Although namespaces imports are not allowed from 'lwc' module, I wasn't expecting to get this exception. Instead, I expected the no-disallowed-lwc-imports.js to validate and block the save.
Encountered a javascript exception while trying to save the following LWC component via SFDX.
Although namespaces imports are not allowed from 'lwc' module, I wasn't expecting to get this exception. Instead, I expected the
no-disallowed-lwc-imports.js
to validate and block the save.It is due to a bug in the implementation of
isComponent
util here https://github.com/salesforce/eslint-plugin-lwc/blob/master/lib/util/component.js#L29-L31