@greffon/eslint-plugin
v0.1.1
Published
ESLint rules enforcing the Greffon expression subset (shares the capture validator).
Maintainers
Readme
@greffon/eslint-plugin
The lint surface of Greffon, expression trees for TypeScript: ESLint rules that enforce the expression-lambda subset, in ESLint and in oxlint.
One validator backs three hosts: the rules share @greffon/capture's subset checks with the build transform and
@greffon/ts-plugin, so an invalid lambda gets the
same Rxxxx code and span as a squiggle, a lint finding, and a build error.
Install
npm install -D @greffon/eslint-pluginUsage
In ESLint, use the flat-config preset (the peer dependency is eslint >=8):
import greffon from "@greffon/eslint-plugin";
export default [greffon.configs.recommended];oxlint loads ESLint plugins too, through jsPlugins (alpha, not semver-guarded). Greffon's own .oxlintrc.json:
{
"jsPlugins": [{ "name": "greffon", "specifier": "@greffon/eslint-plugin" }],
"rules": {
"greffon/valid-expression": "error",
"greffon/no-opaque-callback": "warn"
}
}Rules
greffon/valid-expression(errorinrecommended): rejects out-of-subset syntax with the shared codes, and autofixes==/!=to===/!==(R1103).greffon/no-opaque-callback(warninrecommended): flags a function passed by reference where a provider would need a tree (R2003), the lint-time face of the boundary rule.
The rules run without type information. They check expr() calls and query calls whose receiver roots at a
createContext() result from @greffon/query, traced within one file. A context imported from another module is not
checked at lint time; the build transform and the editor plugin resolve receivers across modules and catch it.
