Giter Site home page Giter Site logo

ramda-codemod's Introduction

ramda-codemod ๐Ÿ› 

It's a simple codemod to add explicit import for ramda for files which are using it as R global variable.

Why?

ProvidePlugin for Webpack for globals such as R for global ramda import doesn't work properly with babel-plugin-ramda so to fix it you need a lot of manual work. This codemod here to do it automate it for you.

Input/Output

R.map();
import R from 'ramda';
R.map();

Usage

  1. Install jscodeshiftnpm i -g jscodeshift
  2. Download R-globals-add-explicit-import.js from this repo or download it like npm i ramda-codemod and take it from node_modules/ramda-codemod/R-globals-add-explicit-import.js
  3. In root of the project with sources under /src for example call jscodemode -t <path-to-codemod>/R-globals-add-explicit-import.js ./src --noSemi=true
  4. PROFIT!

Run Options

  • noSemi - removes ; from the import statement :)
  • useDouble - wraps with " instead of ' so import R from "ramda";
  • useRequire - instead of ES6 imports uses require() function.

IT DOESN'T WORK!!!

If you use some other global variable which is differentiate from R then, I'm sorry, it will not work :)

ramda-codemod's People

Contributors

rip21 avatar

Stargazers

 avatar

Watchers

 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.