feat(xatu): add let order rule #88

Closed
alexion wants to merge 5 commits from xatu-let-order into main
2 changed files with 12 additions and 7 deletions
Showing only changes of commit 90be3f871c - Show all commits

View File

@@ -144,13 +144,18 @@ impl ExprReferences for rnix::ast::Expr {
}
fn is_reference(ident: &rnix::ast::Ident) -> bool {
let parent = ident.syntax().parent();
let grandparent = parent.as_ref().and_then(rowan::SyntaxNode::parent);
!matches!(
ident.syntax().parent().and_then(|parent| parent.parent()),
Some(grandparent)
if matches!(
grandparent.kind(),
rnix::SyntaxKind::NODE_ATTRPATH_VALUE | rnix::SyntaxKind::NODE_SELECT
)
(
parent.map(|node| node.kind()),
grandparent.map(|node| node.kind())
),
(
Some(rnix::SyntaxKind::NODE_ATTRPATH),
Some(rnix::SyntaxKind::NODE_ATTRPATH_VALUE | rnix::SyntaxKind::NODE_SELECT),
)
)
}

View File

@@ -1,6 +1,6 @@
let
support = "support";
primary = support;
primary = support.value;
in {
package = package;
from = pkgs.from;