Giter Site home page Giter Site logo

ts-fix's People

Contributors

andrewbranch avatar iisaduan avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

andrewbranch

ts-fix's Issues

Running tests changes source code

It's because cli.ts has side effects (running codefixes), but you try to import makeOptions from it. So when the import gets evaluated, it's like you're actually running the CLI. You should separate makeOptions (and anything else you could need to import) into a different file.

Multipass runs don’t work with TestHost

We're not actually writing files, but on the second pass, the TS project reads the original files from disk instead of reading our virtual changes. We need to make TS read those virtual changes.

Require a fix name / error code

I think we should do away with the default of applying all available fixes. It’s bound to produce a ton of undesired changes.

Tests fail on macOS/Linux

This is what I get on my machine:

  ● option_empty_argv

    expect(received).toEqual(expected) // deep equality

    Expected: "/Users/anbranc/Developer/microsoft/TS-transform-project/C:\\TSuser\\src\\tsconfig.json"
    Received: "/Users/anbranc/Developer/microsoft/TS-transform-project/C:\\TSuser\\src/tsconfig.json"

Both the expected and received look fishy to me. We should probably avoid hard-coding Windows-style paths into tests as they’ll behave differently on different OSes.

Rethink fixing by error code and fixName

interface I {}

declare const obj: I;

obj.foo;
//  ^^^ Property 'aa' does not exist on type 'I'.ts(2339)

This error returns two fixes:

image

For each, the fixName is fixMissingMember. They represent two different ways of fixing the same thing. I believe the current code will try to apply them both. Unfortunately, there’s not actually a way to differentiate them besides their description property, which is dynamic.

A minimal fix, probably good enough to start with, would be to only apply the first fix returned for a given error, since we try to sort the most likely fixes first. If we need more granularity, we’d need an API change from TypeScript itself.

TS program can’t find default lib files

The number of diagnostics the tool reports is way higher than what tsc -p reports because the LS host seems to have a wrong implementation of getDefaultLibFileName.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.