Giter VIP home page Giter VIP logo

babel-preset-neeto's People

Contributors

ajmaln avatar akhilxavier95 avatar amaljith-k avatar calvinchiramal avatar dependabot[bot] avatar jagannathbhat avatar josephmathew900 avatar krishnapriyaskk avatar udai1931 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

babel-preset-neeto's Issues

Standardize this repo

Code quality

  • Use eslint, prettier, jsconfig configuration from neeto-commons-frontend. Make sure that lint-staged is correctly configured to cover all files in the package during commit.
  • Use zustand for state management. Remove the use of contexts.

Dead code removal

  • Remove unused configuration files like webpack config from projects which use rollup: example: neeto-form-frontend
  • Remove commons functions. Remove boilerplate code, that is already present in neeto-commons-frontend: example: neeto-form-frontend
  • Delete legacy exports & unused code.

Dependency management

  • Move dependencies to devDependencies this will speed up package installation time. We don't need dependencies as we are serving bundles. Try to move packages to peerDependencies if the package exists on host project too. Refer: neetoui, neeto-commons-frontend
  • Audit & remove unused dependencies.

General enhancements

  • Clean up documentation & include exported functions, development & release instructions.
  • Mark function call wrappings of exports as PURE. Reference: arrays.js
  • Have a mechanism to test changes without depending on a host project and yalc: example: neeto-team-members-frontend
  • Have type declaration for all exports: example: neetoui

Building & releasing

  • Standardize release process: release on merge. Example: neetoui
  • Use rollup for bundling
  • Export ESM bundles

Reference: https://github.com/bigbinary/neeto-engineering-web/issues/282#issuecomment-1415911052

Add transformer for picking a single item from store

Right now, zustand pick operator returns an object containing the picked keys. It is inefficient for picking a single item from the store.

Current workaround
User's code Transpiled code
const { setUser } = useUserStore.pick();
import { shallow } from "zustand/shallow";

const { setUser } = useUserStore(
  store => ({ setUser: store.setUser }),
  shallow
);
const { name } = useUserStore.pick("user");
import { shallow } from "zustand/shallow";

const { name } = useUserStore(
  store => ({ name: store.user?.name }),
  shallow
);
Proposed transformer
const setUser = useUserStore.pickFrom();
const setUser = useUserStore(store => store.setUser);
const name = useUserStore.pickFrom("user");
const name = useUserStore(store => store.user?.name);

@ajmaln _a please assign someone to work on this.

babel transformer for removing zustand store property access boilerplate

Check whether it is feasible to create a babel transformer that will make these transformations:

// from
const { x, y, z} = useSampleStore.pick();
    // to
    import { shallow } from "zustand/shallow";
    const { x, y, z} = useSampleStore(store => ({ x: store.x, y: store.y, z: store.z }), shallow);

// from
const { x, y, z} = useSampleStore.pick("nested");
    // to
    import { shallow } from "zustand/shallow";
    const { x, y, z} = useSampleStore(store => ({ x: store.nested.x, y: store.nested.y, z: store.nested.z }), shallow);

// from
const { x, y, z} = useSampleStore.pick(["nested", "data"]);
    // to
    import { shallow } from "zustand/shallow";
    const { x, y, z} = useSampleStore(store => ({ x: store.nested.data.x, y: store.nested.data.y, z: store.nested.data.z }), shallow);
// from
const isOpen = useSampleStore.prop();
    // to
    const isOpen = useSampleStore(store => store.isOpen);

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.