-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: CommonJS examples #18505
Comments
Hi @bukowa, thanks for the issue! ESLint configuration files can be ESM or CommonJS, as explained in the Configuration Files docs: https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file. I don't think we should clutter the documentation by showing every example in both formats, as examples in the two formats would be pretty much the same except for the difference in importing and exporting. Perhaps we could update the documentation so that the "configuration file" text before examples is always a link to the Configuration Files docs? @eslint/eslint-team thoughts? |
I agree, we don't need to show examples in both the formats.
Adding a link sounds good to me 👍🏻 . Should we target "configuration files" text in headings or normal paragraph text? |
That looks great, it also instantly shows what is the difference and why there's a difference! |
This will increase maintenance overhead, we will need to write two different examples. |
We do already have a tabs component: But I agree with @mdjermanovic and @snitin315, I think providing two formats for every example is too much overhead and will likely lead to errors going forward. Unless there's a way to automatically generate the CommonJS version and the tabs, then I think adding a link is the best option. |
agreed for adding a link, as @mdjermanovic suggested i also feel it would be good to add a text as link before the example that will be easily visible to readers. |
Here's a PR to add links: #18535 |
Docs page(s)
https://eslint.org/docs/latest/use/configure/rules#using-configuration-files
solution:
The text was updated successfully, but these errors were encountered: