no-object-as-default-parameter
should ignore for objects with required parameters
#2199
Labels
no-object-as-default-parameter
should ignore for objects with required parameters
#2199
Sometimes a method has a required set of option parameters. e.g. min and max.
In this case it should be OK to use object default parameters because both min and max are required.
Or to be more precise, it should be ok if defined default properties === required properties.
It is not OK if any optional property is provided.
Yes, it it possible for plain JS users to fall through, but they are also likely to fail with the types in general or cause conflicts due to mismatching boundaries:
Otherwise it is impossible to implement the method parameter default in a type safe way.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-object-as-default-parameter.md
https://github.com/faker-js/faker/blob/fe3fb5dd3b8949d952aa8eb3830f58fc9cc4adcc/src/modules/lorem/index.ts#L377
The text was updated successfully, but these errors were encountered: