🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ramda-codemod

Simple codemode to add R import to ramda for files using R as global.

1.0.1
latest
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created

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

  • Install jscodeshiftnpm i -g jscodeshift
  • 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
  • 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
  • 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 :)

FAQs

Package last updated on 12 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts