salesforce / eslint-config-lwc

Opinionated ESLint configurations for LWC projects
MIT License
114 stars 36 forks source link

Add eslint rules to check if components can be available offline. #5

Closed offlineforce closed 4 years ago

offlineforce commented 5 years ago

LWC priming will only work properly for components whose dependencies can be successfully identified. The DependencyAnalyzer code on the server performs the dependency analysis for wires and nested components.

We need to:

Here are a list of rules identified so far ,

  1. Reject if the wire adapter is not among the list of supported wire adapters imported from the following list force/lds, lightning/navigation, force/recordEditStateService, one/layoutContainerLib

  2. Reject if a wire config parameter is not a public property , or not a wire property or not imported from @salesforce scoped modules

  3. Reject if the component makes server calls using fetch api or XMLHttpRequest

  4. Reject if resource urls specified in loadScript and loadStyle calls are not imported from @salesforce scoped modules

reference doc: https://salesforce.quip.com/aFUuAVlygW1M reference code : https://git.soma.salesforce.com/lwc/eslint-plugin-lwc/compare/master...preeti-dave:offlinecomponentrules?expand=1

cc: @trevor-bliss @kevinv11n @jbenallen

pmdartus commented 5 years ago

Today the LWC eslint rules are defined in the package eslint-plugin-lwc. However this package is reserved for LWC OSS relevant rules.

In order to add those rules, we will probably need to create a new package and reference it in the config.