Skip to content
This repository was archived by the owner on Mar 11, 2021. It is now read-only.

Commit 41b2d44

Browse files
bc022699bc022699
authored andcommitted
Implement tslint
1 parent 2c2b7da commit 41b2d44

43 files changed

Lines changed: 390 additions & 355 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.gitignore
22
gulpfile.js
3-
tsconfig.json
43
src/
54
kitchen-sink/
65
.vscode/

gulpfile.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ var gulp = require('gulp'),
66
sourcemaps = require('gulp-sourcemaps'),
77
tsc = require('gulp-typescript'),
88
merge = require('merge2'),
9-
replace = require('gulp-replace');
9+
replace = require('gulp-replace'),
10+
tslint = require('gulp-tslint');
1011

1112
gulp.task('clean', function () {
1213
return gulp.src('./dist', { read: false })
@@ -30,12 +31,20 @@ gulp.task('copy-less', ['clean'], function () {
3031
.pipe(gulp.dest('./dist/src/less'))
3132
});
3233

33-
gulp.task('compile-ts', ['clean'], function () {
34+
gulp.task("tslint", () =>
35+
gulp.src(["./src/**/*.ts", "./src/**/*.tsx"])
36+
.pipe(tslint({
37+
formatter: "verbose"
38+
}))
39+
.pipe(tslint.report())
40+
);
41+
42+
gulp.task('compile-ts', ['tslint', 'clean'], function () {
3443
var tsProject = tsc.createProject('tsconfig.json');
3544

3645
var tsResult = gulp.src(['./src/**/*.ts', './src/**/*.tsx', './typings/**/*.ts'])
3746
.pipe(sourcemaps.init())
38-
.pipe(tsc(tsProject));
47+
.pipe(tsProject());
3948

4049
return merge([
4150
tsResult.dts.pipe(gulp.dest('dist/src/')),
@@ -50,4 +59,4 @@ gulp.task('compile-ts', ['clean'], function () {
5059
]);
5160
});
5261

53-
gulp.task('default', ['build-framework7-core', 'compile-ts', 'copy-less']);
62+
gulp.task('default', ['build-framework7-core', 'tslint', 'compile-ts', 'copy-less']);

kitchen-sink/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

kitchen-sink/components/App.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,19 @@ const App = (props: React.Props<any>) => {
4343
</Views>
4444
</Framework7App>
4545
);
46-
}
46+
};
47+
48+
const getPages = () => {
49+
return pages.map(pageRoute => {
50+
return <Route key={pageRoute.path} path={pageRoute.path} component={pageRoute.component} />
51+
});
52+
};
4753

4854
export const Routes = () => {
4955
return (
5056
<Router history={hashHistory}>
5157
<Route component={App}>
52-
{pages.map(pageRoute => {
53-
return <Route key={pageRoute.path} path={pageRoute.path} component={pageRoute.component} />
54-
})}
58+
{getPages()}
5559
</Route>
5660
</Router>
5761
);
Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as React from 'react';
22
import {hashHistory} from 'react-router';
33
import {
4-
Page, PageBody, PageContent,
5-
Navbar, Left, Center, Right,
4+
Page, PageBody, PageContent,
5+
Navbar, Left, Center, Right,
66
ContentBlock,
7-
ListBlock, ListItem,
8-
Icon,
7+
ListBlock, ListItem,
8+
Icon,
99
SidePanel, PanelSlideInType, PanelSideEnum
1010
} from 'framework7-react';
1111

@@ -16,6 +16,27 @@ export interface IIndexPageState {
1616
leftPanelOpen: boolean;
1717
}
1818

19+
const getPages = () => {
20+
return pages.map((page, index) => {
21+
const pageTitle = page.pageTitle;
22+
const pageId = '/' + pageTitle.toLowerCase().replace(/\s/g, '-');
23+
24+
if (index) {
25+
return <ListItem key={pageId} showAsLink={true} title={pageTitle} iconClass="icon-f7" onClick={() => routeState.navigate(pageId, false)} />
26+
} else {
27+
return null;
28+
}
29+
});
30+
};
31+
32+
const PageList = () => {
33+
return (
34+
<ListBlock>
35+
{getPages()}
36+
</ListBlock>
37+
);
38+
};
39+
1940
export class IndexPage extends React.Component<any, IIndexPageState> {
2041
constructor() {
2142
super();
@@ -25,24 +46,27 @@ export class IndexPage extends React.Component<any, IIndexPageState> {
2546
};
2647
}
2748

28-
render() {
49+
public render() {
2950
return (
3051
<Page name="index">
31-
<SidePanel
32-
isOpen={this.state.leftPanelOpen}
33-
side={PanelSideEnum.Left}
34-
slideInType={PanelSlideInType.Cover}
35-
isSwipable={false}
52+
<SidePanel
53+
isOpen={this.state.leftPanelOpen}
54+
side={PanelSideEnum.Left}
55+
slideInType={PanelSlideInType.Cover}
56+
isSwipable={false}
3657
overlayClickHandler={this.toggleLeftPanel.bind(this)}
3758
additionalClassName="layout-dark"
3859
>
3960
<ContentBlock title="Left Panel">
40-
<p>This is a side panel. You can close it by clicking outsite or on this link: <a onClick={this.toggleLeftPanel.bind(this)} className="close-panel">close me</a>.</p>
61+
<p>
62+
This is a side panel. You can close it by clicking outsite or on this link:
63+
<a onClick={this.toggleLeftPanel.bind(this)} className="close-panel">close me</a>.
64+
</p>
4165
</ContentBlock>
4266
<PageList />
4367
</SidePanel>
4468
<Navbar>
45-
<Left></Left>
69+
<Left />
4670
<Center>Framework7 React</Center>
4771
<Right><Icon iconClass="icon-bars" showAsLink={true} onClick={this.toggleLeftPanel.bind(this)} /></Right>
4872
</Navbar>
@@ -60,21 +84,4 @@ export class IndexPage extends React.Component<any, IIndexPageState> {
6084
leftPanelOpen: !this.state.leftPanelOpen
6185
});
6286
}
63-
};
64-
65-
const PageList = () => {
66-
return (
67-
<ListBlock>
68-
{pages.map((page, index) => {
69-
let pageTitle = page.pageTitle,
70-
pageId = '/' + pageTitle.toLowerCase().replace(/\s/g, '-');
71-
72-
if (index) {
73-
return <ListItem key={pageId} showAsLink={true} title={pageTitle} iconClass="icon-f7" onClick={() => routeState.navigate(pageId, false)} />
74-
} else {
75-
return null;
76-
}
77-
})}
78-
</ListBlock>
79-
)
80-
};
87+
}

kitchen-sink/components/pages/ListViewPage.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ export const ListViewPage = () => {
99
<Navbar>
1010
<Left><BackButton onClick={() => routeState.navigate('/', true)} /></Left>
1111
<Center>List View</Center>
12-
<Right></Right>
12+
<Right />
1313
</Navbar>
1414
<PageBody>
1515
<PageContent>
1616
<ContentBlock>
1717
<p>
18-
Framework7 allows you to be flexible with list views (table views). You can make them as navigation menus, you can use their icons, inputs, and any elements inside of the list, and even make them nested:
18+
Framework7 allows you to be flexible with list views (table views).
19+
You can make them as navigation menus, you can use their icons,
20+
inputs, and any elements inside of the list, and even make them nested:
1921
</p>
20-
</ContentBlock>
22+
</ContentBlock>
2123
<ListBlock title="Data List, With Icons">
2224
<ListItem title="Ivan Petrov" iconClass="icon-f7" afterTitleText="CEO" />
2325
<ListItem title="John Doe" iconClass="icon-f7" />
@@ -36,4 +38,4 @@ export const ListViewPage = () => {
3638
</PageBody>
3739
</Page>
3840
);
39-
}
41+
};

kitchen-sink/components/pages/NavbarAndToolbarPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const NavbarAndToolbarPage = () => {
99
<Navbar>
1010
<Left><BackButton onClick={() => routeState.navigate('/', true)} /></Left>
1111
<Center>Navbars and Toolbars</Center>
12-
<Right></Right>
12+
<Right />
1313
</Navbar>
1414
<PageBody>
1515
<PageContent>

kitchen-sink/components/pages/ProgressBarPage.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as React from 'react';
2-
import {Page, Navbar, Left, Right, Center, PageBody, PageContent, ContentBlock, ListBlock, ListItem, Icon, BackButton, ProgressBar} from 'framework7-react';
2+
import {Page, Navbar, Left, Right, Center, ColorsEnum, PageBody, PageContent, ContentBlock, ListBlock, ListItem, Icon, BackButton, ProgressBar} from 'framework7-react';
33

4-
import {ColorsEnum} from '../../../src/utils/Colors';
54
import {routeState} from '../../utils/RouteState';
65

76
export const ProgressBarPage = () => {
@@ -10,15 +9,17 @@ export const ProgressBarPage = () => {
109
<Navbar>
1110
<Left><BackButton onClick={() => routeState.navigate('/', true)} /></Left>
1211
<Center>Progress Bar</Center>
13-
<Right></Right>
12+
<Right />
1413
</Navbar>
1514
<PageBody>
1615
<PageContent>
1716
<ContentBlock>
1817
<p>
19-
Framework7 has two different styles of progress bars...determinate (accepts a progress percentage number to update itself) and indeterminate/infinite (when no progress number can be calculated) to indicate activity:
18+
Framework7 has two different styles of progress bars...determinate
19+
(accepts a progress percentage number to update itself) and indeterminate/infinite
20+
(when no progress number can be calculated) to indicate activity:
2021
</p>
21-
</ContentBlock>
22+
</ContentBlock>
2223
<ListBlock title="Determinate progress bars:">
2324
<ListItem>
2425
<ProgressBar infinite={false} progress={25} color={ColorsEnum.Blue} />
@@ -42,4 +43,4 @@ export const ProgressBarPage = () => {
4243
</PageBody>
4344
</Page>
4445
);
45-
}
46+
};

kitchen-sink/dist/app.css

Lines changed: 0 additions & 2 deletions
This file was deleted.

kitchen-sink/dist/app.css.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)