Open platform to collect and prioritize feedback
add lint and npm to build
goenningd82ef7d54b48
diff --git a/.travis.yml b/.travis.ymlindex 1341a683f..7ed8edd0b 100644--- a/.travis.yml+++ b/.travis.yml@@ -5,17 +5,20 @@ services:language: go-go:- - 1.7.x+node_js: 6.10.0+go: 1.7.5env:global:- GO_ENV=test+ - NODE_ENV=testinstall:- make setup-ciscript:+ - npm run lint+ - npm run build- make test- make goverallsdiff --git a/package.json b/package.jsonindex 6113474cf..23f12a4c6 100644--- a/package.json+++ b/package.json@@ -7,7 +7,8 @@"scripts": {"build": "rm -rf dist && webpack","build:watch": "rm -rf dist && webpack --watch",- "postinstall": "npm run build"+ "postinstall": "npm run build",+ "lint": "tslint public/**/**.tsx public/**/**.ts"},"dependencies": {"react": "^15.4.2",@@ -25,6 +26,7 @@"rimraf": "^2.6.1","style-loader": "^0.13.2","ts-loader": "^2.0.1",+ "tslint": "^4.5.1","typescript": "^2.2.1","webpack": "^2.2.1","webpack-auto-clean-build-plugin": "^1.0.3"diff --git a/public/components/Footer.tsx b/public/components/Footer.tsxindex 68375a949..1b2537eba 100644--- a/public/components/Footer.tsx+++ b/public/components/Footer.tsx@@ -1,6 +1,6 @@import * as React from "react";-/*+/*<!--<div class="ui stackable inverted divided grid"><div class="six wide column">@@ -30,14 +30,15 @@ import * as React from "react";*/export class Footer extends React.Component<{}, {}> {- render() {+ public render() {return <div id="footer" className="ui inverted vertical footer segment"><div className="ui center aligned container"><div className="ui inverted section divider"></div><div className="ui horizontal inverted small divided link list">- Powered by <a className="item" target="_blank" href="http://we.canhearyou.com/">WeCanHearYou</a>+ <span>Powered by</span>+ <a className="item" target="_blank" href="http://we.canhearyou.com/">WeCanHearYou</a></div></div></div>;}-}\ No newline at end of file+}diff --git a/public/components/Header.tsx b/public/components/Header.tsxindex 1c6bb9db0..6b6cd991d 100644--- a/public/components/Header.tsx+++ b/public/components/Header.tsx@@ -5,28 +5,21 @@ const tenant = (window as any)._tenant;const claims = (window as any)._claims;const gravatar = (window as any)._gravatar;-/*- {{if not .Claims }}- {{ else }}-- {{ end }}-*/-export class Header extends React.Component<{}, {}> {- render() {- const profile = claims ?+ public render() {+ const profile = claims ?<a className="item right signin"><img className="ui avatar image" src={ "https://www.gravatar.com/avatar/" + gravatar } />{ claims["user/name"] }<i className="dropdown icon"></i>- </a> :+ </a> :<a className="item right signin"><img className="ui avatar image" src="https://www.gravatar.com/avatar/" />Sign in<i className="dropdown icon"></i></a>;-- const dropdown = claims ?++ const dropdown = claims ?<div id="user-popup" className="ui popup top left transition hidden"><div className="ui"><div className="item">@@ -35,7 +28,7 @@ export class Header extends React.Component<{}, {}> {</a></div></div>- </div> :+ </div> :<div id="user-popup" className="ui popup top left transition hidden"><div className="ui list"><div className="item">@@ -59,4 +52,4 @@ export class Header extends React.Component<{}, {}> {{ dropdown }</div>;}-}\ No newline at end of file+}diff --git a/public/components/IdeaInput.tsx b/public/components/IdeaInput.tsxindex 77f68337d..c965cfd60 100644--- a/public/components/IdeaInput.tsx+++ b/public/components/IdeaInput.tsx@@ -14,8 +14,8 @@ export class IdeaInput extends React.Component<{}, IdeaInputState> {this.state = { idea: "" };}- render() {- const details = claims ?+ public render() {+ const details = claims ?<button className="ui positive button">Submit Idea</button> :@@ -46,4 +46,4 @@ export class IdeaInput extends React.Component<{}, IdeaInputState> {</div></div>;}-}\ No newline at end of file+}diff --git a/public/components/Root.tsx b/public/components/Root.tsxindex d8da4424e..9851cb87e 100644--- a/public/components/Root.tsx+++ b/public/components/Root.tsx@@ -1,15 +1,16 @@import * as React from "react";-import { IdeaInput } from "./IdeaInput";-import { Header } from "./Header";+import { Footer } from "./Footer";+import { Header } from "./Header";+import { IdeaInput } from "./IdeaInput";const claims = (window as any)._claims;-const ideas:any[] = (window as any)._ideas || [];+const ideas: any[] = (window as any)._ideas || [];export class Root extends React.Component<{}, {}> {- render() {+ public render() {- const ideasList = ideas.map(x =>+ const ideasList = ideas.map((x: any) =><div className="item" key={x.id}><div className="content"><a className="header">{ x.title }</a>@@ -31,8 +32,8 @@ export class Root extends React.Component<{}, {}> {<div className="ui divided items">{ ideasList }</div>- </div>- : <p>No ideas have been shared yet.</p>+ </div>+ : <p>No ideas have been shared yet.</p>;return <div><Header />@@ -50,4 +51,4 @@ export class Root extends React.Component<{}, {}> {<Footer /></div>;}-}\ No newline at end of file+}diff --git a/public/components/SocialSignInButton.tsx b/public/components/SocialSignInButton.tsxindex a8fcd465a..aa96c9454 100644--- a/public/components/SocialSignInButton.tsx+++ b/public/components/SocialSignInButton.tsx@@ -17,9 +17,9 @@ export class SocialSignInButton extends React.Component<SocialSignInButtonProps,};}- render() {- const providerClassName = this.props.provider == "google" ? "google plus" : "facebook";- const providerDisplayName = this.props.provider == "google" ? "Google" : "Facebook";+ public render() {+ const providerClassName = this.props.provider === "google" ? "google plus" : "facebook";+ const providerDisplayName = this.props.provider === "google" ? "Google" : "Facebook";const oauthUrl = `${authEndpoint}/oauth/${this.props.provider}?redirect=${location.href}`;const cssClasses = `${providerClassName} ui fluid button ${this.state.clicked ? "loading" : ""}`;@@ -28,4 +28,4 @@ export class SocialSignInButton extends React.Component<SocialSignInButtonProps,Sign in with { providerDisplayName }</a>;}-}\ No newline at end of file+}diff --git a/public/index.ts b/public/index.tsindex ea30c5475..cb8bb0600 100644--- a/public/index.ts+++ b/public/index.ts@@ -1,11 +1,11 @@import * as $ from "jquery";-import init from "./init"+import init from "./init";-(<any>window).$ = (<any>window).jQuery = $;+(<any> window).$ = (<any> window).jQuery = $;import "semantic-ui-css/semantic.min.css";-import "./css/main.css";import "semantic-ui-css/semantic.min.js";+import "./css/main.css";$(document).ready(() => {init();@@ -22,4 +22,3 @@ $(document).ready(() => {}});});-diff --git a/tslint.json b/tslint.jsonnew file mode 100644index 000000000..76e030902--- /dev/null+++ b/tslint.json@@ -0,0 +1,12 @@+{+ "extends": "tslint:recommended",+ "rules": {+ "object-literal-sort-keys": false,+ "trailing-comma": [+ false+ ],+ "interface-name": [+ false+ ]+ }+}\ No newline at end of file