Skip to content

Conversation

@StojanovicMilos
Copy link
Contributor

In order to enable stricter rules in tsconfig, as shown below, we need to disable those ts checks in generated code

"compilerOptions": {
"noUnusedLocals": true,
"noUnusedParameters": true,

@StojanovicMilos StojanovicMilos requested review from avanwaas and msljivic and removed request for avanwaas March 18, 2024 14:01
@msljivic
Copy link
Contributor

msljivic commented Mar 21, 2024

I would like to see if we can address these issues in generated code rather then disabling the ts-checks.
There are just three ts files generated - module, table and edit components.
We can start with rule --noUnusedParameters - see which parameters are not used, and add _ prefix to these parameters...

@msljivic
Copy link
Contributor

msljivic commented Mar 21, 2024

For start, I see validation rules in generated module:

validationMessages: [
{ name: 'required', message: (err, field) => $localize `:@@validators.required:${field?.templateOptions?.label}:property-name: is required` }]

where err should be _err
and field?.templateOptions?.label should be field?.props?.label (templateOptions are depricated)

@StojanovicMilos
Copy link
Contributor Author

Done those two changes. However, we also need to deal with field. Changing field to _field will be a bit more complex as it's sometimes needed, sometimes not. But when I manually changed field to _field, the code builds with --noUnusedParameters, so we are close.

As for --noUnusedLocals true, it looks like it's fixed if we'd remove private method applyOptionally, which I don't see used anywhere. Can I just remove it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants