refactor(format): drop extra indentation for field

This commit is contained in:
Phạm Huy Hoàng 2024-03-21 20:44:35 +09:00 committed by Christian Clason
parent c28396de30
commit 722617e672
140 changed files with 2146 additions and 2766 deletions

View file

@ -58,11 +58,10 @@
name: (identifier) @function)
(method_definition
name:
[
(property_identifier)
(private_property_identifier)
] @function.method)
name: [
(property_identifier)
(private_property_identifier)
] @function.method)
(method_definition
name: (property_identifier) @constructor
@ -77,15 +76,13 @@
value: (arrow_function))
(assignment_expression
left:
(member_expression
property: (property_identifier) @function.method)
left: (member_expression
property: (property_identifier) @function.method)
right: (arrow_function))
(assignment_expression
left:
(member_expression
property: (property_identifier) @function.method)
left: (member_expression
property: (property_identifier) @function.method)
right: (function_expression))
(variable_declarator
@ -110,13 +107,11 @@
function: (identifier) @function.call)
(call_expression
function:
(member_expression
property:
[
(property_identifier)
(private_property_identifier)
] @function.method.call))
function: (member_expression
property: [
(property_identifier)
(private_property_identifier)
] @function.method.call))
; Builtins
;---------

View file

@ -8,12 +8,11 @@
; html(`...`), html`...`, sql(...) etc
(call_expression
function: (identifier) @injection.language
arguments:
[
(arguments
(template_string) @injection.content)
(template_string) @injection.content
]
arguments: [
(arguments
(template_string) @injection.content)
(template_string) @injection.content
]
(#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
@ -24,38 +23,32 @@
; svg`...` or svg(`...`)
(call_expression
function:
((identifier) @_name
(#eq? @_name "svg"))
arguments:
[
(arguments
(template_string) @injection.content)
(template_string) @injection.content
]
function: ((identifier) @_name
(#eq? @_name "svg"))
arguments: [
(arguments
(template_string) @injection.content)
(template_string) @injection.content
]
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "html"))
(call_expression
function:
((identifier) @_name
(#eq? @_name "gql"))
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "graphql")))
function: ((identifier) @_name
(#eq? @_name "gql"))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "graphql")))
(call_expression
function:
((identifier) @_name
(#eq? @_name "hbs"))
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "glimmer")))
function: ((identifier) @_name
(#eq? @_name "hbs"))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "glimmer")))
((glimmer_template) @injection.content
(#set! injection.language "glimmer"))
@ -64,67 +57,54 @@
(call_expression
function: (identifier) @_name
(#any-of? @_name "css" "keyframes")
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled.div`<css>`
(call_expression
function:
(member_expression
object: (identifier) @_name
(#eq? @_name "styled"))
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
function: (member_expression
object: (identifier) @_name
(#eq? @_name "styled"))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled(Component)`<css>`
(call_expression
function:
(call_expression
function: (identifier) @_name
(#eq? @_name "styled"))
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
function: (call_expression
function: (identifier) @_name
(#eq? @_name "styled"))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled.div.attrs({ prop: "foo" })`<css>`
(call_expression
function:
(call_expression
function:
(member_expression
object:
(member_expression
object: (identifier) @_name
(#eq? @_name "styled"))))
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
function: (call_expression
function: (member_expression
object: (member_expression
object: (identifier) @_name
(#eq? @_name "styled"))))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled(Component).attrs({ prop: "foo" })`<css>`
(call_expression
function:
(call_expression
function:
(member_expression
object:
(call_expression
function: (identifier) @_name
(#eq? @_name "styled"))))
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
function: (call_expression
function: (member_expression
object: (call_expression
function: (identifier) @_name
(#eq? @_name "styled"))))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
((regex_pattern) @injection.content
(#set! injection.language "regex"))
@ -141,10 +121,9 @@
; el.innerHTML = `<html>`
(assignment_expression
left:
(member_expression
property: (property_identifier) @_prop
(#any-of? @_prop "outerHTML" "innerHTML"))
left: (member_expression
property: (property_identifier) @_prop
(#any-of? @_prop "outerHTML" "innerHTML"))
right: (template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
@ -152,13 +131,11 @@
; el.innerHTML = '<html>'
(assignment_expression
left:
(member_expression
property: (property_identifier) @_prop
(#any-of? @_prop "outerHTML" "innerHTML"))
right:
(string
(string_fragment) @injection.content)
left: (member_expression
property: (property_identifier) @_prop
(#any-of? @_prop "outerHTML" "innerHTML"))
right: (string
(string_fragment) @injection.content)
(#set! injection.language "html"))
;---- Angular injections -----
@ -167,61 +144,49 @@
; })
(decorator
(call_expression
function:
((identifier) @_name
(#eq? @_name "Component"))
arguments:
(arguments
(object
(pair
key:
((property_identifier) @_prop
(#eq? @_prop "template"))
value:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "angular")))))))
function: ((identifier) @_name
(#eq? @_name "Component"))
arguments: (arguments
(object
(pair
key: ((property_identifier) @_prop
(#eq? @_prop "template"))
value: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "angular")))))))
; @Component({
; styles: [`<css>`]
; })
(decorator
(call_expression
function:
((identifier) @_name
(#eq? @_name "Component"))
arguments:
(arguments
(object
(pair
key:
((property_identifier) @_prop
(#eq? @_prop "styles"))
value:
(array
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "css"))))))))
function: ((identifier) @_name
(#eq? @_name "Component"))
arguments: (arguments
(object
(pair
key: ((property_identifier) @_prop
(#eq? @_prop "styles"))
value: (array
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "css"))))))))
; @Component({
; styles: `<css>`
; })
(decorator
(call_expression
function:
((identifier) @_name
(#eq? @_name "Component"))
arguments:
(arguments
(object
(pair
key:
((property_identifier) @_prop
(#eq? @_prop "styles"))
value:
((template_string) @injection.content
(#set! injection.include-children)
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "css")))))))
function: ((identifier) @_name
(#eq? @_name "Component"))
arguments: (arguments
(object
(pair
key: ((property_identifier) @_prop
(#eq? @_prop "styles"))
value: ((template_string) @injection.content
(#set! injection.include-children)
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "css")))))))