Skip to content

Instantly share code, notes, and snippets.

View fay-jai's full-sized avatar
✌️

Willson Mock fay-jai

✌️
View GitHub Profile
@fay-jai
fay-jai / karma.conf.js
Last active August 29, 2016 16:07
Getting Started on Testing with Typescript, ReactJS, and Webpack
/*
* More detailed explanation here: http://karma-runner.github.io/0.13/config/configuration-file.html
*/
var webpackConfig = require("./webpack.config");
module.exports = function(config) {
config.set({
/*
* Enable or disable watching files and executing the tests whenever
@fay-jai
fay-jai / Hello.spec.tsx
Created March 31, 2016 06:01
Getting Started on Testing with Typescript, ReactJS, and Webpack
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as TestUtils from "react-addons-test-utils";
import Hello from "../src/Hello";
describe("Hello", () => {
let renderer: React.ShallowRenderer;
beforeEach(() => {
renderer = TestUtils.createRenderer();
@fay-jai
fay-jai / .eslintrc
Created March 30, 2016 19:10 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@fay-jai
fay-jai / index.html
Created March 21, 2016 06:36
Getting Started with Typescript, ReactJS, and Webpack
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Getting Started with Typescript, ReactJS, and Webpack</title>
</head>
<body>
<!-- this is where our Hello component will get rendered into -->
<div id="root"></div>
@fay-jai
fay-jai / webpack.config.js
Created March 21, 2016 06:22
Getting Started with Typescript, ReactJS, and Webpack
var path = require("path");
var config = {
/*
* app.ts represents the entry point to your web application. Webpack will
* recursively go through every "require" statement in app.ts and
* efficiently build out the application's dependency tree.
*/
entry: ["./src/app.tsx"],
@fay-jai
fay-jai / app.tsx
Created March 21, 2016 06:19
Getting Started with Typescript, ReactJS, and Webpack
// Remember to rename the file from app.ts to app.tsx
// and to keep it in the src/ directory.
import * as React from "react";
import * as ReactDOM from "react-dom";
import Hello from "./Hello";
ReactDOM.render(
<Hello name="Willson" />,
document.getElementById("root")
@fay-jai
fay-jai / Hello.tsx
Created March 21, 2016 06:06
Getting Started with Typescript, ReactJS and Webpack
// Remember to rename your file to Hello.tsx and
// place it within your src/ directory
import * as React from "react";
interface HelloProps {
name: string;
}
class Hello extends React.Component<HelloProps, {}> {
@fay-jai
fay-jai / tsconfig.json
Created March 21, 2016 05:55
Getting Started with Typescript, ReactJS, and Webpack
{
"compilerOptions": {
"jsx": "react",
"module": "commonjs",
"noImplicitAny": true,
"outDir": "./build/",
"preserveConstEnums": true,
"removeComments": true,
"target": "ES5"
},
@fay-jai
fay-jai / index.html
Created March 21, 2016 05:19
Getting Started with Typescript, ReactJS, and Webpack
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Getting Started with Typescript, ReactJS, and Webpack</title>
</head>
<body>
<script src="build/bundle.js"></script>
</body>
</html>
@fay-jai
fay-jai / some_module.ts
Last active March 21, 2016 05:21
Getting Started with Typescript, ReactJS, and Webpack
// Remember to put this file in your src/ directory
const greeting: string = "Hello World!";
export default greeting;