liferay / liferay-frontend-projects

A monorepo containing assorted Frontend Infrastructure Team projects
Other
69 stars 68 forks source link

Audit "object" types in js-toolkit #127

Closed wincent closed 3 years ago

wincent commented 3 years ago

While preparing https://github.com/liferay/liferay-frontend-projects/pull/126 I see a lot (several dozen) lint errors of the form:

projects/js-toolkit/packages/liferay-js-toolkit-scripts/src/scripts/translate.ts
  121:62  error  Don't use `object` as a type. The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).
Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys  @typescript-eslint/ban-types
  152:42  error  Don't use `object` as a type. The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).
Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys  @typescript-eslint/ban-types
  164:62  error  Don't use `object` as a type. The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).
Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys  @typescript-eslint/ban-types
  176:46  error  Don't use `object` as a type. The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).
Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys  @typescript-eslint/ban-types
  281:39  error  Don't use `object` as a type. The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).
Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys  @typescript-eslint/ban-types
  300:62  error  Don't use `object` as a type. The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).
Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys  @typescript-eslint/ban-types

Rather than make those changes now (which might be time-consuming and break the build, which I can't even test yet because I need to update the scripts in the package.json and make them work in the new context of the monorepo workspaces), I am just going to turn off this rule.

This issue is a reminder to turn it back on and then audit all these object sites to see what can be done about them.

izaera commented 3 years ago

The translate.ts script was directly copied from v2, where it was a .js and migrated quickly, thus these errors. However, we'll be removing/changing all this stuff, so we can close this as it won't apply.