Skip to content

Commit

Permalink
Add tslint, fix lint errors, add lint to precommit
Browse files Browse the repository at this point in the history
Add palantir's default tslint-react config. Add lint checkint to precommit
hook.
  • Loading branch information
inodb committed Oct 17, 2016
1 parent 4452bc9 commit f7f5b14
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 221 deletions.
115 changes: 57 additions & 58 deletions dist/reactapp/js/1.chunk.js

Large diffs are not rendered by default.

22 changes: 10 additions & 12 deletions dist/reactapp/js/2.chunk.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/reactapp/js/main.app.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build:size": "npm run clean && webpack --define process.env.NODE_ENV='\"production\"' --json > stats.json",
"test": "karma start karma.conf.js",
"test:watch": "npm run test -- --watch",
"lint": "eslint src/** --ext .js --ext .jsx --cache",
"lint": "tslint $(find . -name '*.tsx')",
"eslint": "eslint src/** --ext .js --ext .jsx --cache",
"storedist": "npm run build && git add -f dist",
"comparedist": "bash ./scripts/test_compare_dist_with_committed_dist.sh",
"syncmock": "node src/test/fetchMockData.js --diff",
Expand Down Expand Up @@ -117,12 +118,15 @@
"sinon": "^1.17.4",
"source-map-loader": "^0.1.5",
"ts-loader": "^0.8.2",
"tslint": "^3.15.1",
"tslint-react": "^1.0.0",
"typescript": "^2.0.3",
"webpack-dev-server": "^1.15.0",
"webpack-fail-plugin": "^1.0.5",
"yargs": "^4.8.0"
},
"pre-commit": [
"lint",
"storedist",
"comparedist"
]
Expand Down
26 changes: 10 additions & 16 deletions src/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
import * as React from "react";
import * as React from 'react';

interface HomePageProps
{
interface IHomePageProps {
}

interface HomePageState
{
interface IHomePageState {
}

export default class HomePage extends React.Component<HomePageProps, HomePageState>
{
render()
{
let x = 3;
x += 4;
console.log(x);
x += 4;
console.log(x);
return <div>Hello TypeScript1</div>;
}
export default class HomePage extends React.Component<IHomePageProps, IHomePageState> {
public render() {
let x = 3;
x += 4;
x += 4;
return <div>Hello TypeScript1</div>;
}
};
33 changes: 14 additions & 19 deletions src/pages/patientView/PatientViewPage.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,41 @@
import * as Immutable from 'immutable';
import OrderedMap = Immutable.OrderedMap;
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {Button, Overlay, Tooltip, Popover} from 'react-bootstrap';
import { connect } from 'react-redux';

import ClinicalInformationContainer from './clinicalInformation/ClinicalInformationContainer';
import PatientHeaderUnconnected from './patientHeader/PatientHeader';
import { connect } from 'react-redux';
import * as Immutable from "immutable";
import OrderedMap = Immutable.OrderedMap;
import {PatientHeaderProps} from "./patientHeader/PatientHeader";
import {IPatientHeaderProps} from './patientHeader/PatientHeader';

type TODO = any;

interface PatientViewPageProps
{
interface IPatientViewPageProps {
store?: TODO;
}

export default class PatientViewPage extends React.Component<PatientViewPageProps, {}>
{
static mapStateToProps(state:OrderedMap<string, any>):PatientHeaderProps
{
export default class PatientViewPage extends React.Component<IPatientViewPageProps, {}> {
private static mapStateToProps(state: OrderedMap<string, any>): IPatientHeaderProps {
let ci = state.get('clinicalInformation');
return {
patient: ci.get('patient'),
samples: ci.get('samples'),
status: ci.get('status'),
patient: ci.get('patient'),
};
}

componentDidMount()
{
const PatientHeader:TODO = connect(PatientViewPage.mapStateToProps)(PatientHeaderUnconnected as TODO);
public componentDidMount() {
const PatientHeader: TODO = connect(PatientViewPage.mapStateToProps)(PatientHeaderUnconnected as TODO);

ReactDOM.render(
<PatientHeader store={this.props.store} />,
document.getElementById("clinical_div") as Element
document.getElementById('clinical_div') as Element
);
//ReactDOM.render(<div><Example /><Example /></div>, document.getElementById("clinical_div") as Element);
// ReactDOM.render(<div><Example /><Example /></div>, document.getElementById('clinical_div') as Element);

}

render()
{
public render() {
return (
<ClinicalInformationContainer />
);
Expand Down
32 changes: 12 additions & 20 deletions src/pages/patientView/SampleLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import * as React from 'react';

export default class SampleLabelSVG extends React.Component<SampleLabelSVGProps, {}>
{
constructor(props:SampleLabelSVGProps)
{
export default class SampleLabelSVG extends React.Component<ISampleLabelSVGProps, {}> {
constructor(props: ISampleLabelSVGProps) {
super(props);
this.render = this.render.bind(this);
}

render()
{
public render() {
const { label, color, x, y } = this.props;
return (
<g>
Expand All @@ -20,38 +17,33 @@ export default class SampleLabelSVG extends React.Component<SampleLabelSVGProps,
}
}

export interface SampleLabelSVGProps
{
export interface ISampleLabelSVGProps {
label: string;
color: string;
x: number;
y: number;
}

export class SampleLabelHTML extends React.Component<SampleLabelHTMLProps, {}>
{
constructor(props:SampleLabelHTMLProps)
{
export class SampleLabelHTML extends React.Component<ISampleLabelHTMLProps, {}> {
constructor(props: ISampleLabelHTMLProps) {
super(props);
this.render = this.render.bind(this);
}

render()
{
public render() {
const { label, color } = this.props;
return (
<svg width="12" height="12" className="case-label-header" alt="HCI002T">
<g transform="translate(6,6)">
<circle r="6" fill={color} />
<text y="4" textAnchor="middle" fontSize="10" fill="white">{label}</text>
<svg width='12' height='12' className='case-label-header' alt='HCI002T'>
<g transform='translate(6,6)'>
<circle r='6' fill={color} />
<text y='4' textAnchor='middle' fontSize='10' fill='white'>{label}</text>
</g>
</svg>
);
}
}

interface SampleLabelHTMLProps
{
interface ISampleLabelHTMLProps {
label: string;
color: string;
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import {List} from "immutable";
import {List} from 'immutable';
import * as React from 'react';
import { Table } from 'react-bootstrap';
import * as Immutable from 'immutable';

type TODO = any;

export interface ClinicalInformationPatientTableProps
{
export interface IClinicalInformationPatientTableProps {
data: List<TODO>;
}

export default class ClinicalInformationPatientTable extends React.Component<ClinicalInformationPatientTableProps, {}>
{
render()
{
const rows:JSX.Element[] = [];
class ClinicalInformationPatientTable extends React.Component<IClinicalInformationPatientTableProps, {}> {
public render() {
const rows: JSX.Element[] = [];

this.props.data.forEach((item) => {
rows.push(
<tr key={item.get('id')}>
Expand Down Expand Up @@ -71,3 +68,5 @@ export default class ClinicalInformationPatientTable extends React.Component<Cli
// );
}
}

export default ClinicalInformationPatientTable;
Loading

0 comments on commit f7f5b14

Please sign in to comment.