Git Product home page Git Product logo

typescript-refactoring-plugin's Introduction

typescript-refactoring-plugin

WIP: An investigation into writing typescript automated refactorings

Goal

Refactoring (noun): a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.

Refactoring (verb): to restructure software by applying a series of refactorings without changing its observable behavior.

-- Martian Fowler

If a refactoring ever results in a compiler error or an observable behavior change then that is a bug, please open an issue or feel free to add a failing test (using test.failing).

What is not considered an observable behavior change?

  1. Performance profile changes. While it is absolutely true that extracting a function or introducing a variable can have a performance impact it is unfortunately to difficult to reason about the impact of such changes in an automated fashion (at least for the moment). I have found that in almost all of my coding well designed code has always lead to better performance profiles then trying to optimize every bit (usually because the code complexity leads to redundant actions).

Why?

While typescript already supports "rename" and in some cases "Extract Function." It seems unlikely that they will add any more automated refactorings in the near term. This project is intended to fill in the gaps. Also while the TS team is very responsive with fixing issues that are reported with their automated refactorings they seem to be okay with labeling automated code changes that do have behavioral changes also as refactorings. I intend this project to be an opinionated look at pure guaranteed bug for bug and feature for feature refactorings.

In Progress

Currently working on boolean expression related refactorings. Things like simplifying always true/false expressions and applying De Morgans law to an expression.

TODO

  1. Create a vs-code plugin that bundles this language service plugin so that it can be installed directly as an extension. An example of how to do this is here.
  2. Setup CI

typescript-refactoring-plugin's People

Contributors

greyepoxy avatar

Stargazers

 avatar  avatar

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.