Skip to content

Commit

Permalink
docs: Conflicting fixes (#16366)
Browse files Browse the repository at this point in the history
* docs: Conflicting fixes

Provide additional documentation on conflicting fixes.

Fixes #13721

* Update docs/src/developer-guide/working-with-rules.md

Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>

Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
  • Loading branch information
bpmutter and nzakas committed Oct 4, 2022
1 parent 5a3fe70 commit 90c6028
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion docs/src/developer-guide/working-with-rules.md
Expand Up @@ -335,7 +335,7 @@ The `fix()` function can return the following values:
* An array which includes `fixing` objects.
* An iterable object which enumerates `fixing` objects. Especially, the `fix()` function can be a generator.

If you make a `fix()` function which returns multiple `fixing` objects, those `fixing` objects must not be overlapped.
If you make a `fix()` function which returns multiple `fixing` objects, those `fixing` objects must not overlap.

Best practices for fixes:

Expand Down Expand Up @@ -377,6 +377,13 @@ context.report({
});
```

#### Conflicting Fixes

Conflicting fixes are fixes that apply different changes to the same part of the source code.
There is no way to specify which of the conflicting fixes is applied.

For example, if two fixes want to modify characters 0 through 5, only one is applied.

### Providing Suggestions

In some cases fixes aren't appropriate to be automatically applied, for example, if a fix potentially changes functionality or if there are multiple valid ways to fix a rule depending on the implementation intent (see the best practices for [applying fixes](#applying-fixes) listed above). In these cases, there is an alternative `suggest` option on `context.report()` that allows other tools, such as editors, to expose helpers for users to manually apply a suggestion.
Expand Down

0 comments on commit 90c6028

Please sign in to comment.