question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What should the filename be of a file with no default exports?

See original GitHub issue

The 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:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
ljharbcommented, Mar 10, 2022

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.

0reactions
xiaohubeicommented, Oct 11, 2022

来信已收到,我会尽快回复你,谢谢来信!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found