Skip to content

Commit ecbd522

Browse files
authored
docs: Mention code explorer (#18978)
1 parent 7ea4ecc commit ecbd522

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

docs/src/extend/code-path-analysis.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ bar();
1818
![Code Path Example](../assets/images/code-path-analysis/helo.svg)
1919
:::
2020

21+
::: tip
22+
You can view code path diagrams for any JavaScript code using [Code Explorer](http://explorer.eslint.org).
23+
:::
24+
2125
## Objects
2226

2327
Program is expressed with several code paths.

docs/src/extend/custom-rule-tutorial.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ To learn more about rule metadata, refer to [Rule Structure](custom-rules#rule-s
113113
Define the rule's `create` function, which accepts a `context` object and returns an object with a property for each syntax node type you want to handle. In this case, you want to handle `VariableDeclarator` nodes.
114114
You can choose any [ESTree node type](https://github.com/estree/estree) or [selector](selectors).
115115

116+
::: tip
117+
You can view the AST for any JavaScript code using [Code Explorer](http://explorer.eslint.org). This is helpful in determining the type of nodes you'd like to target.
118+
:::
119+
116120
Inside the `VariableDeclarator` visitor method, check if the node represents a `const` variable declaration, if its name is `foo`, and if it's not assigned to the string `"bar"`. You do this by evaluating the `node` passed to the `VariableDeclaration` method.
117121

118122
If the `const foo` declaration is assigned a value of `"bar"`, then the rule does nothing. If `const foo` **is not** assigned a value of `"bar"`, then `context.report()` reports an error to ESLint. The error report includes information about the error and how to fix it.

docs/src/extend/custom-rules.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ module.exports = {
101101
};
102102
```
103103

104+
::: tip
105+
You can view the complete AST for any JavaScript code using [Code Explorer](http://explorer.eslint.org).
106+
:::
107+
104108
## The Context Object
105109

106110
The `context` object is the only argument of the `create` method in a rule. For example:
@@ -804,6 +808,10 @@ To learn more about JSON Schema, we recommend looking at some examples on the [J
804808

805809
The `SourceCode#getScope(node)` method returns the scope of the given node. It is a useful method for finding information about the variables in a given scope and how they are used in other scopes.
806810

811+
::: tip
812+
You can view scope information for any JavaScript code using [Code Explorer](http://explorer.eslint.org).
813+
:::
814+
807815
#### Scope types
808816

809817
The following table contains a list of AST node types and the scope type that they correspond to. For more information about the scope types, refer to the [`Scope` object documentation](./scope-manager-interface#scope-interface).

0 commit comments

Comments
 (0)