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

Improve documentation about overriding rules #14962

Closed
tzeikob opened this issue Aug 22, 2021 · 1 comment · Fixed by #14976
Closed

Improve documentation about overriding rules #14962

tzeikob opened this issue Aug 22, 2021 · 1 comment · Fixed by #14976
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 enhancement This change enhances an existing feature of ESLint
Projects

Comments

@tzeikob
Copy link
Contributor

tzeikob commented Aug 22, 2021

The version of ESLint you are using.

7.32.0

The problem you want to solve.

The documentation in Extending Configuration Files does a good job to explain the mechanism of extending or overriding rules coming from a base config. But the thing is that I recently have been struggling a bit to figure out how rules with options given as object are resulting from a base config. The question raised about a deriving rule was:

Does it override only the given props in the options object or does it replace the whole object having not given props resolving to their defaults?

Sure it does the latter but that's not clear to the reader.

Your take on the correct solution to problem.

So my suggestion here is to add another example of overriding a rule which has options given as an object instead of just a single string value just to make it crystal clear about how the mechanism works.

The suggested documentation is expected to become like so:

The `rules` property can do any of the following to extend (or override) the set of rules:

...
* override options for rules from base configurations:
    ...
* override options for rules given as object from base configurations:
    * Base config: `'max-lines': ['error', { max: 200, skipBlankLines: true, skipComments: true }]`
    * Derived config: `'max-lines': ['error', { max: 100 }]`
    * Resulting actual config: `'max-lines': ['error', { max: 100 }]` where `skipBlankLines` and `skipComments` default to `false`

Are you willing to submit a pull request to implement this change?

Yes, sure!

@tzeikob tzeikob added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon labels Aug 22, 2021
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Aug 22, 2021
@tzeikob tzeikob changed the title Improve documentation about overriding rules in extending configuration files Improve documentation about overriding rules Aug 22, 2021
@nzakas nzakas removed the triage An ESLint team member will look at this issue soon label Aug 25, 2021
@nzakas
Copy link
Member

nzakas commented Aug 25, 2021

Sounds good to me, feel free to open up a pull request.

@nzakas nzakas added accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation and removed core Relates to ESLint's core APIs and features labels Aug 25, 2021
@nzakas nzakas moved this from Needs Triage to Ready to Implement in Triage Aug 25, 2021
@mdjermanovic mdjermanovic linked a pull request Aug 31, 2021 that will close this issue
1 task
Triage automation moved this from Ready to Implement to Complete Aug 31, 2021
mdjermanovic pushed a commit that referenced this issue Aug 31, 2021
* Docs: Make clear how rule options are overridden (fixes #14962)

* Docs: Use always double quotes for uniformity
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Feb 28, 2022
@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 Feb 28, 2022
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 enhancement This change enhances an existing feature of ESLint
Projects
Archived in project
Triage
Complete
Development

Successfully merging a pull request may close this issue.

2 participants