wikimedia / eslint-plugin-no-jquery

Control allowance of certain jQuery functions, and suggest or autofix alternatives.
MIT License
31 stars 8 forks source link

Rule fix: `no-extend`: Only fix if first arg is object literal #330

Closed edg2s closed 1 month ago

edg2s commented 1 month ago

If the first argument is a variable which could be null or undefined, then Object.assign will throw.

We could convert to Object.assign( foo || {}, ... ) but in most cases this is unnecessary, so probably better to leave it to users to fix manually.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Please upload report for BASE (master@f3e29be). Learn more about missing BASE report.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #330 +/- ## ========================================== Coverage ? 100.00% ========================================== Files ? 103 Lines ? 608 Branches ? 0 ========================================== Hits ? 608 Misses ? 0 Partials ? 0 ``` | [Files](https://app.codecov.io/gh/wikimedia/eslint-plugin-no-jquery/pull/330?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=wikimedia) | Coverage Δ | | |---|---|---| | [src/rules/no-extend.js](https://app.codecov.io/gh/wikimedia/eslint-plugin-no-jquery/pull/330?src=pr&el=tree&filepath=src%2Frules%2Fno-extend.js&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=wikimedia#diff-c3JjL3J1bGVzL25vLWV4dGVuZC5qcw==) | `100.00% <100.00%> (ø)` | |