(prop)
properties in objects and destructuring patterns
(prop key? val?)Where:
Matching:
- key-value pairs, e.g.
a: 1 - shorthand properties, e.g.
a - spread and rest, e.g.
...rest - computed properties, e.g.
[key]: value - default values in destructuring, e.g.
a = 1
Behavior
- Matches properties in object literals, object patterns, and TypeScript object types.
- Handles both regular properties and destructuring patterns in function parameters.
- For spread elements like
{ ...rest }, use the val argument to match the identifier being spread. Matching the spread operator itself (...) is not currently supported.
Examples
Find objects using deprecated configuration keys before renaming them.
(obj (prop apiKey))Selects in lines { 1, 3 } but not in { 2 }:
const config = { apiKey: 'secret' }
const settings = { token: 'secret' }
const partial = { apiKey: 'key', token: 'val' }Locate environment-specific config objects that hardcode production URLs.
(obj (prop url (str /prod|production/)))Selects in lines { 1 } but not in { 2, 3 }:
const config = { url: 'https://api.production.com' }
const dev = { url: 'https://api.dev.com' }
const staging = { url: 'https://api.staging.com' }Find React components using inline style objects to migrate to CSS modules.
(obj (prop style (obj)))Selects in lines { 1, 3 } but not in { }:
<div style={{ color: 'red' }} />
<div className="red" />
<Component style={{ margin: 0 }} />Identify destructuring patterns with defaults that may hide undefined values.
(fun _ (arg _ (obj (prop _ (num)))))Selects in lines { 1, 2 } but not in { 3 }:
function load({ timeout = 3000 }) {}
function fetch({ retries = 5 }) {}
function init({ port }) {}Arguments
key
• Identifier: shorthand for (id)
• String: shorthand for (str)
• Number: shorthand for (num)
• (id)
• (str)
• (num)
• (comp)
• (:into) • (:and) • (:or) • (:not) • (:text) • (:kind) • (:replace) • (:capture)
val
• Identifier: shorthand for (id)
• String: shorthand for (str)
• (:kind) • (:ref) • (:text) • (arr) • (attr) • (bool) • (call) • (child) • (comp) • (export) • (fun) • (id) • (id+) • (import) • (jsx) • (mem) • (null) • (num) • (obj) • (of) • (prop) • (regex) • (regex+) • (str) • (str*) • (str+) • (tpl) • (tpl*) • (var) • (:into) • (:and) • (:or) • (:not) • (:replace) • (:capture)