Git Product home page Git Product logo

vscode-react-components's Introduction

React Components

Tired of typing the same ol' stuff 1,032 times a day? React Components saves you time by scaffolding out your React Components. When you create a React component, you can also have a test created with it, with a Jest snapshot test already created ๐Ÿ˜ƒ

React Components

Installation

You can install the plugin by searching for react-components in the Visual Studio Code Marketplace

or

  1. Open Visual Studio Code
  2. Launch Quick Open (โŒ˜+P), paste ext install react-components, and press enter.

Features

Right from the command palette (or even better, a shortcut), have a component created for you that is already scaffolded out. If you want tests created alongside your component, all you have to do is configure the settings to do so. Right now, you can create class-based and functional components. More will be added as they are needed.

Configuration

{
	"react-components.root": "<root>/src/components", // use <root> and <component>. <root> is project root and <component> is the component's path (the component that you are creating)
	"react-components.fileExtension": ".js", // .js, .jsx
	"react-components.openAfterCreate": true, // true, false
	"react-components.tests": true, // true, false Create a test with your component
	"react-components.testsRoot": "<component>/__tests__", // use <root> or <component> to give a path for the test location
	"react-components.testsNameAppend": ".test" // append this to the end of the file so it can be Component.test.js or component_test.js
}

Issues

If you see an issue, please submit it on Github. Even better, fix it and submit a pull request.

Contributing

I know this package can be better and I have plans for it to be. If you want to chip in, here are a few things that I would like to accomplish. By all means, this is not an exhaustive list and I would love your input of ways you think it could be better.

  • Add ability to use test templates. See #1
  • Add the ability to create tests only (should be very easy). See #2
  • Add ability to take lowercase file names and automatically create create CamelCase or snake_case file names from them. This may be tricky. See #3
  • Add ability to have lifecycle methods in the created component. See #4
  • Extract some code from a file into its own component. See #5
  • Add test. See #6

If you you want to help, please feel free create an issue and talk about what you want to change/fix/add. Once we have discused the changes that need to be made, fork the repo, make the changes and submit a pull request. Make sure that your code is linted before submitting the pull request.

If you have any questions about anything at all, please do not hesitate to reach out.

vscode-react-components's People

Contributors

dericcain avatar

Stargazers

 avatar

vscode-react-components's Issues

Add lifecycle methods to components

It would be nice if the user could choose what lifecycle methods they wanted in the template when they were creating the template. Also, it would be nice to have the constructor for them too.

We need some tests

I hacked this together ASAP so I avoided testing. This means that I really need tests haha!

Add config helper for the testsAppendName

This is missing from the package.json and needs to be added to give guidance on the use of this property.

"react-components.testsAppendName": ".test" // All of the created tests will now have the .test on the end before .js

Extract code into its own component file

It would be nice to be able to extract some code from a component and have a component created for the selected code. This would really speed up development time.

Add ability to use test templates

A user could create their own test template that would be used when tests are created. The template files could have some variables in it that could be used in order to make it dynamic.

Allow lowercase file names to be inputted and then converted to CamelCase or snake_case

So, the user would enter homebutton. We look at their config to see what naming style they chose, and then we style the component name after that. If they have "react-components.namingStyle": "camel" then we name the component HomeButton for them.

Maybe the options could be camel, snakeand kebab for HomeButton, home_button and home-button, respectively.

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.