Skip to content

types

luau
local types = require("@std/commands/lint/types")

WARNING

These APIs are still open to future evolution. In new major versions, they may change in backwards incompatible ways.

Summary

EntryDescription
GlobalsConfig
LintRule
LintViolation
RuleContext
RuleOptions
severity
tag

Types

GlobalsConfig

luau
type GlobalsConfig = { [string]: unknown }

LintRule

luau
type LintRule = {
	read lint: (cst: syntax.CstStatBlock, sourcepath: path.Path?, context: RuleContext) -> { LintViolation },
	read name: string,
}

LintViolation

luau
type LintViolation = {
	lintname: string,
	location: syntax.Span,
	message: string,
	severity: severity,
	sourcepath: path.Path?,
	suggestedfix: {
		read location: syntax.Span?, -- if nil, applies to whole violation location
		read fix: string,
	}?,
	target: string?, -- Additional information on the violation (e.g link to docs)
	tags: { tag }?,
}

RuleContext

luau
type RuleContext = {
	globals: GlobalsConfig,
	options: RuleOptions,
}

RuleOptions

luau
type RuleOptions = { [string]: unknown }

severity

luau
type severity = "error" | "warning" | "info" | "hint"

tag

luau
type tag = "unnecessary" | "deprecated"