sindresorhus/eslint-plugin-unicorn
Rule proposal: `no-blob-to-file`
Closed
#1,270 opened on May 13, 2021
help wantednew rule
Repository metrics
- Stars
- (5,022 stars)
- PR merge metrics
- (Avg merge 1d 16h) (399 merged PRs in 30d)
Description
Many people don't know File implements Blob, the only difference is File has .name ..lastModified in most cases don't need convert to File.
Fail
const file = new File([blob], {name: '1.jpg'});
formData.append('file', file);
const file = new File([blob], {name: '1.jpg'});
URL.createObjectURL(file);
Pass
formData.append('file', blob, '1.jpg');
URL.createObjectURL(blob);
This rule might need type info.