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

Suggestion: Add documentation regarding eslint-ignore comments #16426

Closed
1 task done
maritaria opened this issue Oct 13, 2022 · 2 comments · Fixed by #16430
Closed
1 task done

Suggestion: Add documentation regarding eslint-ignore comments #16426

maritaria opened this issue Oct 13, 2022 · 2 comments · Fixed by #16430
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation
Projects

Comments

@maritaria
Copy link
Contributor

maritaria commented Oct 13, 2022

What problem do you want to solve?

Give a comprehensive explanation of directive comments (e.g. // eslint-disable-next-line).

I wanted to know how to add a justification to an eslint directive, the only reference to directives (which I didn't know that's what they are called anyway) is for the --no-ignore-lines argument (link).

To answer my question I ended up going through the eslint source code to find the parsing code of directive statments.
Turns out you need a (space)--(space) separator to add a justification to a directive.
Silly me had only tried a single -, enclosing the comment with " and similar.

What do you think is the correct solution?

Have a page dedicated to ignore comments, the following should be covered:

  1. The available directives (including code example for each)
  2. The differences between directive behaviours
  3. How to add justification to directives (example for each directive type)
  4. Link to the --no-ignore-lines argument that can disable them again
  5. Links to any configuration settings that may affect behaviour of directives
  6. List of rules that lint directives (if any)

Participation

  • I am willing to submit a pull request for this change.

Additional comments

Should there be a rule/setting to require all directives to have justifications then that would be good to mention that as well.

@maritaria maritaria added the enhancement This change enhances an existing feature of ESLint label Oct 13, 2022
@maritaria
Copy link
Contributor Author

Since posting I have spotted the relevant section in 'configuring rules'. 🤦 .

The justification thing could be added as a separate item so it is shown in the nav as well.

@mdjermanovic mdjermanovic transferred this issue from eslint/eslint.org Oct 14, 2022
@mdjermanovic mdjermanovic added documentation Relates to ESLint's documentation accepted There is consensus among the team that this change meets the criteria for inclusion and removed enhancement This change enhances an existing feature of ESLint labels Oct 14, 2022
@mdjermanovic mdjermanovic moved this from Needs Triage to Ready to Implement in Triage Oct 14, 2022
@mdjermanovic
Copy link
Member

Hi @maritaria! I've transferred the issue to eslint/eslint since the docs are in this repository.

The justification thing could be added as a separate item so it is shown in the nav as well.

Makes sense to me, PR is welcome!

maritaria added a commit to maritaria/eslint that referenced this issue Oct 16, 2022
Places the documentation related to justifications (on comment directives) in its own section so it may be more easily found from the table of contents.

Fixes eslint#16426
@mdjermanovic mdjermanovic linked a pull request Oct 16, 2022 that will close this issue
1 task
Triage automation moved this from Ready to Implement to Complete Oct 31, 2022
nzakas added a commit that referenced this issue Oct 31, 2022
* docs: Add heading to justification explanation

Places the documentation related to justifications (on comment directives) in its own section so it may be more easily found from the table of contents.

Fixes #16426

* Update docs/src/user-guide/configuring/rules.md

Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Apr 30, 2023
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Apr 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation
Projects
Archived in project
Triage
Complete
Development

Successfully merging a pull request may close this issue.

2 participants