Type Project
File match sgconfig.yml sgconfig.yaml
Schema URL https://catalog.lintel.tools/schemas/ast-grep/ast-grep-sgconfig-yml/latest.json
Source https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/project.json

Validate with Lintel

npx @lintel/lintel check
Type: Project

Definitions

Project object
ruleDirs string[] required

A list of string instructing where to discover ast-grep's YAML rules.

testConfigs TestConfig[]

A list of object to configure ast-grep's test cases. Each object can have two fields.

utilDirs string[]

A list of string instructing where to discover ast-grep's global utility rules.

languageGlobs Record<string, string[]>

A mapping to associate a language to files that have non-standard extensions or syntaxes.

customLanguages Record<string, object>

A dictionary of custom languages in the project.

languageInjections LanguageInjection[]

A list of language injections to support embedded languages in the project like JS/CSS in HTML. This is an experimental feature.

TestConfig object
testDir string required

A string specifies where to discover test cases for ast-grep.

snapshotDir string

A string path relative to testDir that specifies where to store test snapshots for ast-grep. You can think it like snapshots_ in popular test framework like jest. If this option is not specified, ast-grep will store the snapshot under the snapshots folder under the testDir.

CustomLanguage object
libraryPath string | object required

The path to the tree-sitter dynamic library of the language.

extensions string[] required

The file extensions for this language.

expandoChar string

An optional char to replace $ in your pattern.

languageSymbol string

The dylib symbol to load ts-language, default is tree_sitter_{name}

LanguageInjection object

A list of language injections to support embedded languages in the project like JS/CSS in HTML. This is an experimental feature.

hostLanguage string required

The host language name, e.g. html. This is the language of documents that contains the embedded language code.

rule SerializableRule required

Defines the ast-grep rule to identify the injected language region within the host language documents.

injected string | string[] required

The injected language name