What should the filename be of a file with no default exports?
See original GitHub issueThe rules state that a file with a default export should exactly match the name of the default export. What should the filename be of a file with no default export? Should such a file exist at all?
Consider the following file:
export function getItem(key) {
return localStorage.getItem(key);
}
export function setItem(key, value) {
return localStorage.setItem(key, value);
}
In this case the guidelines does not seem to have a clear answer. I would lean towards localStorage.js
, but I could see how LocalStorage.js
could be considered as well.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
TypeScript static code analysis: Default export names and file ...
Default export names and file names should match ... By convention, a file that exports only one class, function, or constant should be...
Read more >Default export not explicitly defined - Stack Overflow
There is no default export defined in this file. However, I am able to do the following: import NM from "nodemailer";
Read more >Solved - Export 'x' (imported as 'y') was not found in the ...
It is said to be a named export. Since there is no default keyword, we have to specify the exact name to import...
Read more >eslint-plugin-canonical - npm
Match the file name against the default exported value in the module. Files that don't have a default export will be ignored. The...
Read more >export - JavaScript - MDN Web Docs
Exported values can then be imported into other programs with the ... file test.js const k = 12; export default k; ... WebView...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m not sure if they’re silly, but i don’t think they’re common enough to warrant an explicit rule, so I’ll close it.
来信已收到,我会尽快回复你,谢谢来信!