Git Product home page Git Product logo

typescript-react-native-starter's Introduction

TypeScript React Native Starter

A starter template for TypeScript and React Native.

This template was inspired by Microsoft's TypeScript React Native Starter.

It builds on top of this foundation by adding the following:

  • --strict compiler flag to enable all strict type-checking options
  • tslint:latest preset and tslint-react custom rule set
  • Prettier TypeScript code formatting
  • git add, commit and push hooks via husky and lint-staged to lint and format code, and run unit tests

Overview

Using TypeScript with React Native requires an extra TypeScript compilation step before the usual React Native bundler operations take place.

tsconfig.json instructs the TypeScript compiler to build any TypeScript files (.ts, .tsx) under /src and direct the resulting transpiled ES6 code to /lib, whereby the React Native bundler can then continue as normal.

All of this can be accomplished using the following helper scripts:

  • yarn run-ios
  • yarn run-android

Both versions will run tslint and unit tests before deploying a successful build to the respective device simulator/emulator.

Scripts

yarn run-ios or yarn run-android are the only scripts you'll need to run during development. Both make use of a few of these other helper scripts, which can be run individually:

test

  • run unit and snapshot tests

lint

  • run tslint analysis across .ts and .tsx files

lint-fix

  • attempts to automatically fix any linting issues

build

  • lints, tests and compiles TypeScript code

prettier

  • format TypeScript code according to Prettier rules

precommit

  • runs build script prior to git commit and fails the commit operation on any errors

prepush

  • runs build script prior to git push and fails the push operation on any errors

TODO

typescript-react-native-starter's People

Contributors

johnwakley avatar

Watchers

James Cloos 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.