Skip to content

Commit

Permalink
add links to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bpmutter committed Oct 18, 2022
1 parent 25c0909 commit 56acb1e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions docs/src/developer-guide/working-with-rules.md
Expand Up @@ -160,10 +160,9 @@ Additionally, the `context` object has the following methods:

### context.getScope()

This method returns the scope of the current node. It is a useful method for finding
information about the variables in a given scope, and how they are used in other scopes.
This method returns the scope of the current node. It is a useful method for finding information about the variables in a given scope, and how they are used in other scopes.

#### Scope Types
#### Scope types

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.md#scope-interface).

Expand Down Expand Up @@ -203,6 +202,12 @@ Global variables have the following additional properties:
* `Variable.eslintExplicitGlobalComments` (`Comment[] | undefined`) ... The array of `/* globals */` directive comments which defined this global variable in the source code file. This property is `undefined` if there are no `/* globals */` directive comments.
* `Variable.eslintImplicitGlobalSetting` (`"readonly" | "writable" | undefined`) ... The configured value in config files. This can be different from `variable.writeable` if there are `/* globals */` directive comments.

For examples of using `context.getScope()` to track variables, refer to the source code for the following built-in rules:

* [camelcase](https://github.com/eslint/eslint/blob/main/lib/rules/camelcase.js)
* [no-alert](https://github.com/eslint/eslint/blob/main/lib/rules/no-alert.js)
* [no-console](https://github.com/eslint/eslint/blob/main/lib/rules/no-console.js)

### context.report()

The main method you'll use is `context.report()`, which publishes a warning or error (depending on the configuration being used). This method accepts a single argument, which is an object containing the following properties:
Expand Down

0 comments on commit 56acb1e

Please sign in to comment.