Coder Social home page Coder Social logo

react-webpack-boiletplate's Introduction

This repository is setup using

https://www.robinwieruch.de/minimal-react-webpack-babel-setup/

Why Babel?

Babel enables you writing your code in ES6. With Babel the code will get transpiled back to ES5. So that every browser, without having all ES6 features implemented, can intepret it. Babel even takes the one step further. You can not only use ES6 features, but also next generations of ES.

npm install --save-dev babel-core babel-loader babel-preset-env

Additionaly you might want to use some more experimental features in ES6(e.g. object spread) which can get acticated via Stages.

Dont worry, even though its experimental, its used in create-react-app by Facebook too.

npm install --save-dev babel-preset-stage-2

At last step, since you want to use React, you need one more configuration to transform the natural react .jsx files to .js files.

Browser doesnt support jsx natively.

npm install --save-dev babel-preset-react

Hot Module Replacement in React

A huge development boost will give you react-hot-loader (Hot Module Replacement). It will shorten your feedback loop during development.

Basically whenever you change something in your source code, the change will apply in your app running in the browser without reloading the entire page.

npm install --save-dev react-hot-loader

Linting

Coding standards Using Airbnb coding practices

npm install eslint eslint-config-airbnb --save-dev

You'll also need some dependencies for working with ES6:

npm install eslint-plugin-jsx-a11y@^2.0.0 eslint-plugin-react eslint-plugin-import babel-eslint --global

To prevent unnecessary warnings, "func-names" is manually switched off here because Airbnb's JS style guide allows anonymous functions.

.eslintrc file looks like this

{ "extends": "airbnb", "rules": { "func-names": ["error", "never"] } }

to fix few eslint issues I used

https://stackoverflow.com/questions/30398825/eslint-window-is-not-defined-how-to-allow-global-variables-in-package-json

allow jsx file extensions

https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md

CSS Processing https://medium.com/@Connorelsea/using-sass-with-create-react-app-7125d6913760

https://www.npmjs.com/package/extract-text-webpack-plugin

TODO In future commits

  1. Redux
  2. Unit testing
  3. Styleguide
  4. Automation testing

react-webpack-boiletplate's People

Watchers

James Cloos avatar Prashant Alhat 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.