mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-11-30 23:12:13 +03:00
Update the order in which the rule visitors are called, with regards to project-related data
This commit is contained in:
parent
3d56b620cd
commit
0540ee850e
@ -15,12 +15,14 @@ module Lint.Rule exposing
|
||||
# How does it work?
|
||||
|
||||
`elm-lint` turns the code of the analyzed file into an [Abstract Syntax Tree (AST)](https://en.wikipedia.org/wiki/Abstract_syntax_tree)
|
||||
using the [`elm-syntax` package](https://package.elm-lang.org/packages/stil4m/elm-syntax/latest/).
|
||||
An AST is a tree-like structure which represents your source code.
|
||||
Then, `elm-lint` will traverse the nodes in the AST in the following order, and
|
||||
call the visitor function associated to the type of node:
|
||||
(a tree-like structure which represents your source code) using the
|
||||
[`elm-syntax` package](https://package.elm-lang.org/packages/stil4m/elm-syntax/latest/).
|
||||
Then, for each file and rule, it will give the details of your project (like the `elm.json` file) and the
|
||||
contents of the file to analyze to the rule. The order in which things get passed to the rule is the following:
|
||||
|
||||
- The `elm.json` file, visited by [`withElmJsonVisitor`](#withElmJsonVisitor) (can only collect data)
|
||||
- Read project-related info (only collect data in these steps)
|
||||
- The `elm.json` file, visited by [`withElmJsonVisitor`](#withElmJsonVisitor)
|
||||
- Visit the file (in the following order)
|
||||
- The module definition, visited by [`withSimpleModuleDefinitionVisitor`](#withSimpleModuleDefinitionVisitor) and [`withModuleDefinitionVisitor`](#withModuleDefinitionVisitor)
|
||||
- Each import statement, visited by [`withSimpleImportVisitor`](#withSimpleImportVisitor) and [`withImportVisitor`](#withImportVisitor)
|
||||
- Each declaration statement, visited by [`withSimpleDeclarationVisitor`](#withSimpleDeclarationVisitor) and [`withDeclarationVisitor`](#withDeclarationVisitor).
|
||||
|
Loading…
Reference in New Issue
Block a user