shumbo / choreography-ts

Choreographic Programming in TypeScript
0 stars 1 forks source link

Update current `eslint` rules to use resolved type information #35

Open ImpregnableProgrammer opened 10 months ago

ImpregnableProgrammer commented 10 months ago

At the moment, the ESLint rules as implemented rely on cursory selectors to identify certain constructs, which might be insufficient for identifying the same constructs defined via other valid means. For instance, the following selector is used to select choreographic variables:

const choreographySelector = `VariableDeclaration[kind = "const"] > VariableDeclarator[id.typeAnnotation.typeAnnotation.typeName.name = "Choreography"];

This will match choreographies declared as follows

const myChoreography: Choreography<Locations, [], []> = ...

But won't match the following

type MyType = Choreography<Locations, [], []>;
const myChoreography: MyType = ...

since the Choreography type is aliased with MyType. This problem can be fixed by rewriting the rules to use resolved type information provided by TypeScript's typechecker API.

ImpregnableProgrammer commented 9 months ago

This is being worked on in PR #37