Giter VIP home page Giter VIP logo

mithril-codemods's Introduction

mithril-codemods NPM Version NPM License

NPM Downloads Build Status Dependency Status devDependency Status

Automated porting of [email protected] code to [email protected].

Usage

> npm i -g mithril-codemods
> mithril-codemods --help

Usage
    $ mithril-codemods [<file|glob> ...]

Options
    --unsafe, -u    Use unsafe transforms
    --apply,  -a    Apply transforms (instead of a dry run)

Examples
    mithril-codemods **/*.js
    mithril-codemods --apply **/*.js
    mithril-codemods -ua some/specific/file.js

Transforms

Safe

These transforms are pretty safe and unlikely to have many false positives.

⚠️️️ Unsafe ⚠️

These transform are usually fine, but not applied by default since they can have unfortunate side-effects.

Warnings

There are certain classes of changes that are impossible to automatically convert.

mithril-codemods's People

Contributors

greenkeeper[bot] avatar porsager avatar tivac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mithril-codemods's Issues

Controller.onunload should become onremove

Original Source

{
    controller : function() {
        // ...
        this.onunload = clear;
    }
}

Tool Output

{
    controller : function() {
        // ...
        this.onunload = clear;
    }
}

Expected Output

{
    controller : function() {
        // ...
    },
    onremove : clear
}

m.redraw.strategy should be wrapped/warn when not removed

Original Source

function() {
    m.redraw.strategy("diff");
}

Tool Output

function() {
    m.redraw.strategy("diff");
}

Expected Output

function() {
    if(m.redraw.stategy) {
        m.redraw.strategy("diff");
    }
}

or

function() {
    console.warn("m.redraw.strategy is DEPRECATED") || m.redraw.strategy("diff");
}

buildQueryString/parseQueryString

Original Source

m.route.buildQueryString({ ... })
m.route.parseQueryString("...")

Tool Output

m.route.buildQueryString({ ... })
m.route.parseQueryString("...")

Expected Output

m.buildQueryString({ ... })
m.parseQueryString("...")

An in-range update of execa is breaking the build 🚨

Version 0.6.1 of execa just got published.

Branch Build failing 🚨
Dependency execa
Current Version 0.6.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As execa is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 4 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of execa is breaking the build 🚨

Version 0.6.2 of execa just got published.

Branch Build failing 🚨
Dependency execa
Current Version 0.6.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As execa is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 3 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

View functions should have ctrl & options references updated

{
    view : function(ctrl, options) {
        ctrl.fooga;
        options.wooga;
    }
}

should become

{
    view : function(vnode) {
        vnode.state.fooga;
        vnode.attrs.wooga;
    }
}

... at least I think so. There's nothing in the migration guide about it and there ought to be.

Transform empty selectors into divs

Original Source

m("")

Expected Output

m("div")

The original form is arguably a bug, and there's no reason this tool couldn't trivially update that to not be a bug.

An in-range update of eslint-config-arenanet is breaking the build 🚨

Version 3.2.0 of eslint-config-arenanet just got published.

Branch Build failing 🚨
Dependency eslint-config-arenanet
Current Version 3.1.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-config-arenanet is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 7 commits .

  • 5748466 v3.2.0
  • 65b41ab test: more specimen, also nicer errors & correct prop
  • 9d1bb08 style: clean up unecessary details
  • fd346b5 test: set up simple testing env
  • 48734e2 feat: add eslint 3.15.0 support
  • cd32ae6 disable comma-dangle rule
  • 9bb0143 Add package metadata

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of validate-commit-msg is breaking the build 🚨

Version 2.12.0 of validate-commit-msg just got published.

Branch Build failing 🚨
Dependency validate-commit-msg
Current Version 2.11.2
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As validate-commit-msg is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes v2.12.0

<a name"2.12.0">

2.12.0 (2017-03-31)

Features

Commits

The new version differs by 2 commits .

  • eefe5f3 feat(cli): Allow validate from text (#71)
  • 3c4aee9 docs(README): Add installation step (#70)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

m.route.set rewrite isn't safe enough

Just look at this 🐛

 export default function() {
-    m.route(
-        document.body,
-        prefix("/setup"),
-        keys({
-            "/setup" : setup
-        }, function(value, key) {
-            return prefix(key);
-        })
-    );
+    m.route.set(document.body, prefix("/setup"), keys({
+        "/setup" : setup
+    }, function(value, key) {
+        return prefix(key);
+    }));
 }

An in-range update of husky is breaking the build 🚨

Version 0.13.3 of husky just got published.

Branch Build failing 🚨
Dependency husky
Current Version 0.13.2
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As husky is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 9 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Key for referenced controller not updating

Original Source

const m = require("mithril"),
    controller = require("./controller");

module.exports = {
    controller : controller,
    view : () => m("div")
};

Tool Output

const m = require("mithril"),
    controller = require("./controller");

module.exports = {
    controller : controller,
    view : () => m("div")
};

Expected Output

const m = require("mithril"),
    controller = require("./controller");

module.exports = {
    oninit : controller,
    view : () => m("div")
};

controller to oninint should rename first arg to vnode

Because this is odd-looking.

- controller : function(options) {
+ oninit: function(options) {
      var ctrl = this,
-         val  = get(options.field, "attrs.value");
+         val  = get(options.attrs.field, "attrs.value");

-     ctrl.id = id(options);
+     ctrl.id = id(options.attrs);

PSA: I've added a bunch of default community health files org-wide

Community health files are stuff like CONTRIBUTING.md, FUNDING.yml, and so on, stuff that normally lives in .github, docs/, or the repo's root. I've added default files for everything on this list of supported file types except for a CONTRIBUTING.md file, as that process varies pretty greatly across repos. For issue templates, there's two templates: one for bugs and one for feature requests. The pull request template and issue templates are each derived from the core project's own core templates but with core-specific stuff omitted.

No action is required on your part, but you may wish to customize these appropriately and/or take other related action in light of this like adding/removing issue templates.


If you have any questions, comments, or concerns, please file an issue and I'd be more than willing to address them.

Event cancelling needs to create a param

m("div", {
    onclick : function() {
        m.redraw.strategy("none");
    }
});

will be rewritten as

m("div", {
    onclick : function() {
        e.redraw = false;
    }
});

which is good, except e is now undefined and the code will break. Will need to add a param if there isn't one.

An in-range update of eslint is breaking the build 🚨

Version 3.17.1 of eslint just got published.

Branch Build failing 🚨
Dependency eslint
Current Version 3.17.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes v3.17.1
  • f8c8e6e Build: change mock-fs path without SSH (fixes #8207) (#8208) (Toru Nagashima)
  • f713f11 Fix: nonblock-statement-body-position multiline error (fixes #8202) (#8203) (Teddy Katz)
  • 41e3d9c Fix: operator-assignment with parenthesized expression (fixes #8190) (#8197) (alberto)
  • 5e3bca7 Chore: add eslint-plugin-eslint-plugin (#8198) (Teddy Katz)
  • 580da36 Chore: add missing output property to tests (#8195) (alberto)
Commits

The new version differs by 7 commits .

  • af8f8b9 3.17.1
  • a6c12f3 Build: package.json and changelog update for 3.17.1
  • f8c8e6e Build: change mock-fs path without SSH (fixes #8207) (#8208)
  • f713f11 Fix: nonblock-statement-body-position multiline error (fixes #8202) (#8203)
  • 41e3d9c Fix: operator-assignment with parenthesized expression (fixes #8190) (#8197)
  • 5e3bca7 Chore: add eslint-plugin-eslint-plugin (#8198)
  • 580da36 Chore: add missing output property to tests (#8195)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

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.