Skip to content
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

Closed
bukowa opened this issue May 25, 2024 · 8 comments · Fixed by #18535
Closed

Docs: CommonJS examples #18505

bukowa opened this issue May 25, 2024 · 8 comments · Fixed by #18535
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation

Comments

@bukowa
Copy link

bukowa commented May 25, 2024

Docs page(s)

https://eslint.org/docs/latest/use/configure/rules#using-configuration-files

yesgooo
ahaaasssaduahsdyuasydusad

solution:

module.exports =  {
    // Other ESLint configuration settings...
    rules: {
        // Other rules...
        'vue/multi-word-component-names': 'off'
    }
};
@bukowa bukowa added the documentation Relates to ESLint's documentation label May 25, 2024
@mdjermanovic
Copy link
Member

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?

@mdjermanovic mdjermanovic changed the title Docs: (fill in) https://eslint.org/docs/latest/use/configure/rules#using-configuration-files Docs: CommonJS examples May 25, 2024
@snitin315
Copy link
Contributor

snitin315 commented May 26, 2024

I agree, we don't need to show examples in both the formats.

Perhaps we could update the documentation so that the "configuration file" text before examples is always a link to the Configuration Files docs?

Adding a link sounds good to me 👍🏻 . Should we target "configuration files" text in headings or normal paragraph text?

@Tanujkanti4441
Copy link
Contributor

What if we give both the examples in single container that will be shown up by corresponding buttons of ESM and CommonJS
something like this:
Screenshot 2024-05-26 190201
Screenshot 2024-05-26 190721

@bukowa
Copy link
Author

bukowa commented May 27, 2024

That looks great, it also instantly shows what is the difference and why there's a difference!

@snitin315
Copy link
Contributor

This will increase maintenance overhead, we will need to write two different examples.

@nzakas
Copy link
Member

nzakas commented May 27, 2024

We do already have a tabs component:
https://eslint.org/docs/latest/component-library/code-tabs

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.

@Tanujkanti4441
Copy link
Contributor

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.

@mdjermanovic
Copy link
Member

Here's a PR to add links: #18535

@Tanujkanti4441 Tanujkanti4441 added the accepted There is consensus among the team that this change meets the criteria for inclusion label Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants