Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore ts rules in generated code #51

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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 msljivic and avanwaas 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.

2 participants