Skip to content

Commit 99a9cf8

Browse files
layershifterlevithomason
authored andcommitted
chore(package): Add ts-lint for typings (Semantic-Org#1156)
* chore(package): Add ts-lint for typings * chore(package): Add typescript as dev-dependency * chore(package): update lint command * style(Input): update `Input` typings * style(Input): update function definition * style(mixed): fix indentation * style(Input): rename interface * style(mixed): fix lint issue * style(mixed): fix lint issues * style(mixed): fix lint issues
1 parent 6258ca1 commit 99a9cf8

File tree

35 files changed

+259
-332
lines changed

35 files changed

+259
-332
lines changed

circle.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ machine:
1010
test:
1111
pre:
1212
- npm run lint
13+
- npm run tsd:lint
1314
post:
1415
- bash <(curl -s https://codecov.io/bash)

package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
"pretest": "npm run build:dll",
3535
"test": "cross-env NODE_ENV=test karma start",
3636
"test:watch": "npm run test --silent -- --watch",
37-
"tsd": "cpx './src/**/*.d.ts' dist/commonjs"
37+
"tsd": "cpx './src/**/*.d.ts' dist/commonjs",
38+
"tsd:lint": "tslint './src/**/*.d.ts'",
39+
"tsd:lint:fix": "npm run -s tsd:lint -- --fix"
3840
},
3941
"repository": {
4042
"type": "git",
@@ -71,8 +73,8 @@
7173
"chai-enzyme": "^0.6.1",
7274
"connect-history-api-fallback": "^1.2.0",
7375
"copy-to-clipboard": "^3.0.5",
74-
"cross-env": "^3.1.4",
7576
"cpx": "^1.5.0",
77+
"cross-env": "^3.1.4",
7678
"css-loader": "^0.26.0",
7779
"del": "^2.2.2",
7880
"dirty-chai": "^1.2.2",
@@ -124,6 +126,9 @@
124126
"style-loader": "^0.13.1",
125127
"ta-scripts": "^2.5.2",
126128
"through2": "^2.0.2",
129+
"tslint": "^4.3.1",
130+
"tslint-config-typings": "^0.3.1",
131+
"typescript": "^2.1.5",
127132
"watch": "^1.0.1",
128133
"webpack": "^1.12.14",
129134
"webpack-dev-middleware": "^1.5.1",

src/addons/Confirm/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ interface ConfirmProps {
2424
open?: boolean;
2525
}
2626

27-
export const Confirm: React.ComponentClass<ConfirmProps>
27+
export const Confirm: React.ComponentClass<ConfirmProps>;

src/collections/Breadcrumb/index.d.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { ReactMouseEvents, SemanticSIZES } from '../..';
22
import * as React from 'react';
33

44
interface BreadcrumbProps extends ReactMouseEvents<HTMLElement> {
5-
65
/** An element type to render as (string or function). */
76
as?: any;
87

@@ -16,7 +15,8 @@ interface BreadcrumbProps extends ReactMouseEvents<HTMLElement> {
1615
divider?: any;
1716

1817
/** For use with the sections prop. Render as an `Icon` component with `divider` class instead of a `div` in
19-
* Breadcrumb.Divider. */
18+
* Breadcrumb.Divider.
19+
*/
2020
icon?: any;
2121

2222
/** Shorthand array of props for Breadcrumb.Section. */
@@ -34,7 +34,6 @@ interface BreadcrumbClass extends React.ComponentClass<BreadcrumbProps> {
3434
export const Breadcrumb: BreadcrumbClass;
3535

3636
interface BreadcrumbDividerProps {
37-
3837
/** An element type to render as (string or function). */
3938
as?: any;
4039

@@ -51,7 +50,6 @@ interface BreadcrumbDividerProps {
5150
export const BreadcrumbDivider: React.ComponentClass<BreadcrumbDividerProps>;
5251

5352
interface BreadcrumbSectionProps {
54-
5553
/** Style as the currently active section. */
5654
active?: boolean;
5755

src/collections/Form/index.d.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { DropdownProps } from '../../modules/Dropdown/index';
1313

1414

1515
interface FormProps {
16-
method?: 'get' | 'post'
16+
method?: 'get' | 'post';
1717

1818
/** An element type to render as (string or function). */
1919
as?: any;
@@ -72,7 +72,6 @@ interface FormClass extends React.ComponentClass<FormProps> {
7272
export const Form: FormClass;
7373

7474
interface FormFieldProps {
75-
7675
/** An element type to render as (string or function). */
7776
as?: any;
7877

@@ -128,7 +127,6 @@ interface FormButtonProps extends ButtonProps {
128127
export const FormButton: React.ComponentClass<FormButtonProps>;
129128

130129
interface FormCheckboxProps {
131-
132130
/** An element type to render as (string or function). */
133131
as?: any;
134132
control?: any;
@@ -141,7 +139,6 @@ interface FormCheckboxProps {
141139
export const FormCheckbox: React.ComponentClass<FormCheckboxProps>;
142140

143141
interface FormDropdownProps extends DropdownProps {
144-
145142
/** An element type to render as (string or function). */
146143
as?: any;
147144

@@ -155,7 +152,6 @@ interface FormDropdownProps extends DropdownProps {
155152
export const FormDropdown: React.ComponentClass<FormDropdownProps>;
156153

157154
interface FormGroupProps {
158-
159155
/** An element type to render as (string or function). */
160156
as?: any;
161157

@@ -183,7 +179,6 @@ interface FormInputProps extends InputProps, ReactFormEvents<HTMLInputElement>,
183179
export const FormInput: React.ComponentClass<FormInputProps>;
184180

185181
interface FormRadioProps {
186-
187182
/** An element type to render as (string or function). */
188183
as?: any;
189184
checked?: boolean;
@@ -200,7 +195,6 @@ interface FormRadioProps {
200195
export const FormRadio: React.ComponentClass<FormRadioProps>;
201196

202197
interface FormSelectProps extends ReactFormEvents<HTMLSelectElement>, ReactFocusEvents<HTMLSelectElement> {
203-
204198
/** An element type to render as (string or function). */
205199
as?: any;
206200

@@ -219,7 +213,6 @@ interface FormSelectProps extends ReactFormEvents<HTMLSelectElement>, ReactFocus
219213
export const FormSelect: React.ComponentClass<FormSelectProps>;
220214

221215
export interface FormTextAreaProps extends ReactFormEvents<HTMLTextAreaElement>, ReactFocusEvents<HTMLTextAreaElement> {
222-
223216
/** An element type to render as (string or function). */
224217
as?: any;
225218

src/collections/Grid/index.d.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import {
88
} from '../..';
99
import * as React from 'react';
1010

11-
export type GridPropReversed = 'computer' | 'computer vertically' | 'mobile' | 'mobile vertically' | 'tablet' | 'tablet vertically'
11+
export type GridPropReversed = 'computer' | 'computer vertically' | 'mobile' | 'mobile vertically' | 'tablet' | 'tablet vertically';
1212
export interface GridProps {
13-
1413
/** An element type to render as (string or function). */
1514
as?: any;
1615

@@ -43,7 +42,7 @@ export interface GridProps {
4342

4443
/** A grid can specify that its columns should reverse order at different device sizes. */
4544
reversed?: GridPropReversed;
46-
45+
4746
/** A grid can have its columns stack on-top of each other after reaching mobile breakpoints. */
4847
stackable?: boolean;
4948

@@ -64,9 +63,8 @@ interface GridClass extends React.ComponentClass<GridProps> {
6463

6564
export const Grid: GridClass;
6665

67-
type GridPropOnly = 'computer' | 'large screen' | 'mobile' | 'tablet mobile' | 'tablet' | 'widescreen'
66+
type GridPropOnly = 'computer' | 'large screen' | 'mobile' | 'tablet mobile' | 'tablet' | 'widescreen';
6867
interface GridColumnProps {
69-
7068
/** An element type to render as (string or function). */
7169
as?: any;
7270

@@ -99,7 +97,7 @@ interface GridColumnProps {
9997

10098
/** A column can specify a width for a tablet device. */
10199
tablet?: SemanticWIDTHSNUMBER | SemanticWIDTHSSTRING| number;
102-
100+
103101
/** A row can specify its text alignment. */
104102
textAlign?: SemanticTEXTALIGNMENTS;
105103

@@ -113,10 +111,9 @@ interface GridColumnProps {
113111
width?: SemanticWIDTHSNUMBER | SemanticWIDTHSSTRING| number;
114112
}
115113

116-
export const GridColumn: React.ComponentClass<GridColumnProps>
114+
export const GridColumn: React.ComponentClass<GridColumnProps>;
117115

118116
interface GridRowProps {
119-
120117
/** An element type to render as (string or function). */
121118
as?: any;
122119

src/collections/Menu/index.d.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {
2-
ReactMouseEvents,
3-
SemanticCOLORS,
4-
SemanticFLOATS,
5-
SemanticSIZES,
6-
SemanticWIDTHSNUMBER,
7-
SemanticWIDTHSSTRING
2+
ReactMouseEvents,
3+
SemanticCOLORS,
4+
SemanticFLOATS,
5+
SemanticSIZES,
6+
SemanticWIDTHSNUMBER,
7+
SemanticWIDTHSSTRING
88
} from '../..';
99
import * as React from 'react';
1010

@@ -161,7 +161,6 @@ interface MenuItemProps extends ReactMouseEvents<HTMLElement> {
161161
export const MenuItem: React.ComponentClass<MenuItemProps>;
162162

163163
interface MenuMenuProps {
164-
165164
/** An element type to render as (string or function). */
166165
as?: any;
167166

src/collections/Message/index.d.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { SemanticCOLORS, SemanticSIZES } from '../..';
22
import * as React from 'react';
33

44
interface MessageProps {
5-
65
/** An element type to render as (string or function). */
76
as?: any;
87

@@ -53,7 +52,7 @@ interface MessageProps {
5352
* Called when the user clicks the "x" icon. This also adds the "x" icon.
5453
*/
5554
onDismiss?: React.MouseEventHandler<HTMLDivElement>;
56-
55+
5756
/** A message may be formatted to display a positive message. Same as `success`. */
5857
positive?: boolean;
5958

@@ -80,7 +79,6 @@ interface MessageClass extends React.ComponentClass<MessageProps> {
8079
export const Message: MessageClass;
8180

8281
interface MessageContentProps {
83-
8482
/** An element type to render as (string or function). */
8583
as?: any;
8684

@@ -94,7 +92,6 @@ interface MessageContentProps {
9492
export const MessageContent: React.ComponentClass<MessageContentProps>;
9593

9694
interface MessageHeaderProps {
97-
9895
/** An element type to render as (string or function). */
9996
as?: any;
10097

@@ -108,7 +105,6 @@ interface MessageHeaderProps {
108105
export const MessageHeader: React.ComponentClass<MessageHeaderProps>;
109106

110107
interface MessageListProps {
111-
112108
/** An element type to render as (string or function). */
113109
as?: any;
114110

@@ -125,7 +121,6 @@ interface MessageListProps {
125121
export const MessageList: React.ComponentClass<MessageListProps>;
126122

127123
interface MessageItemProps {
128-
129124
/** An element type to render as (string or function). */
130125
as?: any;
131126

src/collections/Table/index.d.ts

+10-15
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
import * as React from 'react';
1010

1111
interface TableProps {
12-
1312
/** An element type to render as (string or function). */
1413
as?: any;
1514

@@ -33,13 +32,13 @@ interface TableProps {
3332

3433
/** A table can be given a color to distinguish it from other tables. */
3534
color?: SemanticCOLORS;
36-
35+
3736
/** A table can specify its column count to divide its content evenly. */
3837
columns?: SemanticWIDTHSNUMBER | SemanticWIDTHSSTRING | number;
39-
38+
4039
/** A table may sometimes need to be more compact to make more rows visible at a time. */
4140
compact?: boolean | 'very';
42-
41+
4342
/** A table may be formatted to emphasize a first column that defines a rows content. */
4443
definition?: boolean;
4544

@@ -65,22 +64,22 @@ interface TableProps {
6564
* to be placed within Table.Body.
6665
*/
6766
renderBodyRow?: ()=>void; // TODO - check;
68-
67+
6968
/** A table can have its rows appear selectable. */
7069
selectable?: boolean;
71-
70+
7271
/** A table can specify that its cell contents should remain on a single line and not wrap. */
7372
singleLine?: boolean;
74-
73+
7574
/** A table can also be small or large. */
7675
size?: SemanticSIZES;
77-
76+
7877
/** A table can specify how it stacks table content responsively. */
7978
stackable?: boolean;
8079

8180
/** A table can stripe alternate rows of content with a darker color to increase contrast. */
8281
striped?: boolean;
83-
82+
8483
/** A table can be formatted to display complex structured data. */
8584
structured?: boolean;
8685

@@ -103,7 +102,6 @@ interface TableClass extends React.ComponentClass<TableProps> {
103102
export const Table: TableClass;
104103

105104
interface TableBodyProps {
106-
107105
/** An element type to render as (string or function). */
108106
as?: any;
109107

@@ -150,10 +148,10 @@ interface TableCellProps {
150148

151149
/** A cell may let a user know whether a value is good. */
152150
positive ?: boolean;
153-
151+
154152
/** A cell can be selectable. */
155153
selectable?: boolean;
156-
154+
157155
/** A cell can specify that its contents should remain on a single line and not wrap. */
158156
singleLine ?: boolean;
159157

@@ -173,15 +171,13 @@ interface TableCellProps {
173171
export const TableCell: React.ComponentClass<TableCellProps>;
174172

175173
interface TableFooterProps {
176-
177174
/** An element type to render as (string or function). */
178175
as?: any;
179176
}
180177

181178
export const TableFooter: React.ComponentClass<TableFooterProps>;
182179

183180
interface TableHeaderProps {
184-
185181
/** An element type to render as (string or function). */
186182
as?: any;
187183

@@ -198,7 +194,6 @@ interface TableHeaderProps {
198194
export const TableHeader: React.ComponentClass<TableHeaderProps>;
199195

200196
interface TableHeaderCellProps {
201-
202197
/** An element type to render as (string or function). */
203198
as?: any;
204199
}

0 commit comments

Comments
 (0)