JSMonk / hegel

An advanced static type checker
https://hegel.js.org
MIT License
2.09k stars 59 forks source link

Migration to hegel #208

Open thecotne opened 4 years ago

thecotne commented 4 years ago

ok so i was planning to try and use hegel in real project to see what is missing and what's not.

so i decided to first extract my project setup into open source repository and then conduct this experiment in open way. if project setup is migrated and i am happy with it then i can try and migrate whole project...

List of problems

problems listed here may or may not be know issues in hegel

hegel cli stops execution on first syntax error

it would be much better to show all problems at once so i don't need to fix them one by one if there are 50 files and 3 of them have syntax errors and 5 of them have type errors it is perfectly possible to report all of them at once (of course for files that have syntax error developer needs to fix that syntax first before hegel can report anything about types)

vscode extension is not on the market and i can't install it manually.

i followed this instructions from here https://hegel.js.org/docs/editor-plugins#visual-studio-code and after this command npm run compile i got this npm ERR! missing script: compile

no jsx WAT?

no go for me

hegel just stuck and does not report anything

after ignoring some files and fixing some syntax errors (removing jsx)

it just stuck and project does not even have actual application code it's just config and skeleton of app

edit: i have not excluded node_modules folder correctly.

but this experience can be improved.

multiple environments at same time

i have both nodejs and frontend code and i am not sure how to pick correct environment for all files

project

this is PR https://github.com/thecotne/stateless-app/pull/2 in my test project

thecotne commented 4 years ago

after correctly excluding all node_modules folders https://github.com/thecotne/stateless-app/pull/2/commits/8023220e645e2937be23aa3dae24026d83e6e0fa

i got Never!!! ...

after that i am starting to experiment excluding most of the project and testing it on some files

Problems

YieldExpression

function * letsYield () {
  yield 1
}

SpreadElement

void [...[1]]

Property "isInteger" does not exist in "NumberConstructor"

void Number.isInteger(1)

Never!!!

function func (obj = {}) {}

Never!!! TypeVar

i know void is not a type in hegel but it does not report that

type Defered<T> = void

function defered<T> (): Defered<T> {
  return 1
}

Never!!! TypeVar (the second)

again supported syntax but it does not say anything about syntax or location of a problem

type Defered<T> = {||}

function defered<T> (): Defered<T> {
  return 1
}

Cannot destructure property 'name' of 'undefined' as it is undefined.

export * as ns from 'mod'

reported error from react.js while node_modules are ignored

Screen Shot 2020-05-17 at 02 02 15
thecotne commented 4 years ago

Cannot read property 'name' of null

export default function () {
  return 'hola!'
}