iljapostnovs/ui5plugin-linter

Unused class for custom controls/ missing autocomplete

Closed this issue · 4 comments

racflx commented

Hello, sorry to bother you again with the (almost) same problem as before, but I'm not sure if I missed something in the configuration or if it's a bug/ missing feature.

Describe the bug/ feature request
When custom controls are included via npm and used in XML views, the TagLinter reports that the corresponding class does not exist.

Also, the TagLinter no longer reports anything if the componentsToInclude property is added to the configuration as "componentsToInclude": [].

Also missing is autocomplete, which would be a nice feature for custom controls.

To Reproduce
Steps to reproduce the behavior:

  1. Install a custom control lib from npm
  2. Add it to a xml view
  3. Configure linter in package.json to remove TagLinter error

Additional context
Tested with custom controls developed in both TypeScript and JavaScript

Hi,

Please provide minimal project example, so I could take a look on the exact problem. Otherwise it's hard to comment anything.

racflx commented

Hi,

I have uploaded an example project here: https://github.com/racflx/ui5-plugin-cap-example.git

I did not add the componentsToInclude property to the package.json in the frontend folder, so you can see that the linter reports that the class does not exist. The custom control I used for the example is the following: https://github.com/ui5-community/ui5-cc-md

Thanks for the example!

  1. Yeah, well, long story short, extension doesn't parse node_modules. Moreover, even if I would figure out a way to add what exactly should be parsed from node_modules, it would not help, because the control there doesn't even have a manifest.json, which is crucial part for the plugin. Moreover, it uses another node module - marked, which will not be parsed by plugin for sure.

  2. "componentsToInclude": [] is disabling the linting because you are basically saying include nothing for the linting, so it works as expected.

I don't see any options how I could include this kind of controls into the plugin, it will not be parsed properly because it lacks basic info about the project it is in and it uses non-ui5 resources.

So I would suggest to use ui5ignore in XML:

<!-- @ui5ignore -->
<md:Markdown fromFile="../../resources/test.md"/>

The best thing which comes into my mind is to create another configuration entry for ui5plugin-parser, where you could describe additional classes manually, e.g.

"additionalClasses": [{
	"name": "cc.md.Markdown",
	"extends": "sap.ui.core.Control",
	"methods": [],
	"fields": [],
	"properties": [{
		"name": "content",
		"type": "string",
		"multiple": false,
		"defaultValue": ""
	},{
		"name": "fromFile",
		"type": "string",
		"multiple": false,
		"defaultValue": ""
	},{
		"name": "baseURL",
		"type": "string",
		"multiple": false,
		"defaultValue": ""
	}],
	"associations": [],
	"aggregations": [],
}]

And then it could work with the extension.

Closed because of inactivity