Skip to content

Commit ade4b6a

Browse files
committed
Clarifications in README about writing rules
1 parent bde491a commit ade4b6a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

validator/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ ESLint also maintains [integrations](https://eslint.org/docs/latest/use/integrat
2828
## Writing custom rules
2929

3030
Each rule should be written in a separate JavaScript file (e.g. `single-key-dictionary-key-is-string.js`) following the format of a custom rule [as defined by the typescript-eslint docs](https://typescript-eslint.io/developers/custom-rules).
31-
Within a rule's `create` function, return an object whose keys are the names of [AST node types](https://typescript-eslint.io/packages/typescript-estree/ast-spec) and whose values are functions that validate that node type.
31+
Within a rule's `create` function, return an object whose keys are the names of [AST node types](https://typescript-eslint.io/packages/typescript-estree/ast-spec), or an [esquery string](https://github.com/estools/esquery), and whose values are functions that validate that node type.
3232
To report a problem in a validation function, it should call `context.report()` with the appropriate arguments.
3333

3434
To get a familiar the different node types possible within a TypeScript AST, paste some code into [an AST viewer](https://ts-ast-viewer.com/) and explore the resulting visual tree.
3535

3636
To add your rule to the spec validator ESLint plugin, import it into [the plugin file](./eslint-plugin-es-spec.js) and add it to the `rules` object with an appropriate key.
37+
To enable your rule so that it runs against the spec, add it to [the spec's ESLint config](../specification/eslint.config.js).
3738

3839
### Unit testing rules
3940

0 commit comments

Comments
 (0)