Skip to main content

extract_array_comments

Function extract_array_comments 

Source
pub fn extract_array_comments(
    source: &str,
    path: &Path,
) -> Option<Vec<ElementComment>>
Expand description

The comments next to the elements of the array literals of source, a JavaScript or TypeScript file whose extension (in path) selects the dialect. Paths start at each outermost object or array literal, so the object a config file exports, directly or through a constant or a call such as defineConfig({ ... }), is the root. A property or element whose value is the name of a top-level const bound to an object or array literal is followed into that literal, so const deps = [...]; export default { ignoreDependencies: deps } puts the comments of deps under ignoreDependencies (they are also reported under deps as a root of its own). A spread is not followed. A comment that is a tool directive (// eslint-disable-next-line, // @ts-expect-error) is left out.

The elements a comment only heads (see ElementComment::heading) are left out; extract_config_comments has them, and the comments on properties.

None when the file does not parse; nothing is executed.