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: Conflicting fixes #16366

Merged
merged 2 commits into from Oct 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 a string.
bpmutter marked this conversation as resolved.
Show resolved Hide resolved
There is no way to specify which of the conflicting fixes is applied.
mdjermanovic marked this conversation as resolved.
Show resolved Hide resolved

For example, if two fixes want to modify characters 0 through 5, only one is applied.
mdjermanovic marked this conversation as resolved.
Show resolved Hide resolved

### 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