Skip to content
selectorrolematching syntax
(arg) argument and parameter positions -
(arr) array literals and array patterns (destructuring)
  • [a, b]
  • [a, b] = coords
(attr) JSX attributes on opening tags
  • className="active"
  • onClick={handler}
  • disabled
(bin) binary expressions like `a + b` or `a && b`
  • a + b
  • a && b
  • a === b
(bool) boolean literals -
(call) function calls
  • x()
  • import()
(child) JSX children selected by position or value
  • <Link>text</Link>
  • <Link>{expr}</Link>
  • <Link><Icon /></Link>
(comp) computed property access and subscript expressions
  • obj[key]
  • { [key]: value }
(el) array elements selected by position and/or value (used with `(arr ...)`) -
(export) export statements, including re-exports
  • export const x = 1
  • export default function() {}
  • export { a } from "mod"
  • export * from "mod"
(fun) function definitions
  • function x() {}
  • () => {}
  • (function() {})
  • function* x() {}
(id) identifiers
  • foo
  • obj.prop
  • obj.#private
  • { name }
  • super
  • import
  • ...spread
(id+) static property names across member access and object property definitions (the `b` in `a.b`, `a["b"]`, or `{ b: ... }`)
  • a.b
  • a["b"]
  • { "b": value }
  • a[key]
(import) ESM import statements, or imported identifiers when nested inside another selector
  • import x from "mod"
  • import { a } from "mod"
  • import * as ns from "mod"
  • import "./side-effect"
(is) kind constraints for functions and variable declarations
  • async function x() {}
  • function* x() {}
  • const x = 1
  • let x = 1
  • var x = 1
(jsx) JSX elements and fragments, matched by name, attributes, and children
  • <div>...</div>
  • <Button />
  • <A.B />
  • <>...</>
(mem) property access
  • a.b
  • a[expr]
  • a.#field
(null) null literal -
(num) numeric literals -
(obj) object literals and object-like patterns
  • {}
  • { a: 1 }
  • { a, b } = x
  • function x({ a })
(of) constructor calls using `new`
  • new Foo()
  • new Foo
  • new Api.Client()
(prop) properties in objects and destructuring patterns
  • a: 1
  • a
  • ...rest
  • [key]: value
  • a = 1
(regex) regular expression literals -
(regex+) regular expression patterns across literals and RegExp constructor calls
  • /foo/g
  • new RegExp("foo")
(str) string literals
  • 'hello'
  • "hello"
  • `hello`
  • <div>text</div>
(str*) string-like binary expressions matched by their pseudo-evaluated value (e.g., `'foo' + bar`)
  • "foo" + bar
  • "foo" + bar + "baz"
(str+) string values across literals, template literals, concatenations, and string-valued property keys
  • "foo"
  • `foo ${bar}`
  • "foo" + bar
  • obj["foo"]
  • { "foo": value }
(tpl) template literals (`` `...` ``) and tagged template literals like `html`... or `sql`...
  • `hello ${name}`
  • html`<div>${content}</div>`
(tpl*) template literals matched by a pseudo-evaluated value that includes interpolations
  • `hello ${name}`
  • gql`query { ... }`
(var) variable declarations (var/let/const), including destructuring patterns
  • var x = 1
  • let x = 1
  • const x = 1
  • const { a } = obj
  • const [a] = list

Copyright © 2022-present Semantic Works, Inc.