Skip to content

Commit e9cef99

Browse files
author
Kai Cataldo
authored
Docs: wrap {{}} in raw liquid tags to prevent interpolation (#12643)
1 parent e707453 commit e9cef99

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

docs/developer-guide/working-with-rules.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ In some cases fixes aren't appropriate to be automatically applied, for example,
352352
In order to provide suggestions, use the `suggest` key in the report argument with an array of suggestion objects. The suggestion objects represent individual suggestions that could be applied and require either a `desc` key string that describes what applying the suggestion would do or a `messageId` key (see [below](#suggestion-messageids)), and a `fix` key that is a function defining the suggestion result. This `fix` function follows the same API as regular fixes (described above in [applying fixes](#applying-fixes)).
353353
354354
```js
355+
{% raw %}
355356
context.report({
356357
node: node,
357358
message: "Unnecessary escape character: \\{{character}}.",
@@ -371,6 +372,7 @@ context.report({
371372
}
372373
]
373374
});
375+
{% endraw %}
374376
```
375377
376378
Note: Suggestions will be applied as a stand-alone change, without triggering multipass fixes. Each suggestion should focus on a singular change in the code and should not try to conform to user defined styles. For example, if a suggestion is adding a new statement into the codebase, it should not try to match correct indentation, or confirm to user preferences on presence/absence of semicolumns. All of those things can be corrected by multipass autofix when the user triggers it.
@@ -385,6 +387,7 @@ Best practices for suggestions:
385387
Instead of using a `desc` key for suggestions a `messageId` can be used instead. This works the same way as `messageId`s for the overall error (see [messageIds](#messageIds)). Here is an example of how to use it in a rule:
386388
387389
```js
390+
{% raw %}
388391
module.exports = {
389392
meta: {
390393
messages: {
@@ -416,6 +419,7 @@ module.exports = {
416419
});
417420
}
418421
};
422+
{% endraw %}
419423
```
420424
421425
#### Placeholders in suggestion messages
@@ -425,6 +429,7 @@ You can also use placeholders in the suggestion message. This works the same way
425429
Please note that you have to provide `data` on the suggestion's object. Suggestion messages cannot use properties from the overall error's `data`.
426430
427431
```js
432+
{% raw %}
428433
module.exports = {
429434
meta: {
430435
messages: {
@@ -450,6 +455,7 @@ module.exports = {
450455
});
451456
}
452457
};
458+
{% endraw %}
453459
```
454460
455461
### context.options

0 commit comments

Comments
 (0)