no-null: false positive when null is used as function argument
#1,842 opened on Jun 15, 2022
Repository metrics
- Stars
- (5,022 stars)
- PR merge metrics
- (Avg merge 1d 16h) (399 merged PRs in 30d)
Description
eslint unicorn v42.0.0
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-null.md
Fails when null is used as function argument, even though this should pass. In fact this is even an example given in the "Pass" section: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-null.md#pass
This works (no error):
const foo = Object.create(null);
but this fails:
drawingManager.setMap( null );
markers[ index ].setMap( null );
I think this shouldn't fail? I can't choose what argument types a function accepts in many cases (libraries). And if we want to have this error for functions we can control, it's better to give an error for no null arg when function is declared?