Skip to content

Commit 44ebbc7

Browse files
author
jfusco
committed
Add Flow types to component
Update package.json outdated packages. Add Flow types to Tags and Tag components. Add flow script to the package.json file and add npm run flow to the main build task. Update tests to work with new Jest and React releases.
1 parent 1b19ef9 commit 44ebbc7

File tree

13 files changed

+7031
-122
lines changed

13 files changed

+7031
-122
lines changed

.babelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"presets": [
33
"react",
44
"es2015",
5-
"stage-0"
5+
"stage-0",
6+
"flow"
67
]
78
}

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ charset = utf-8
99

1010
# Main styles for our files
1111
[*]
12-
indent_style = tab
12+
indent_style = space
1313
end_of_line = lf
1414
trim_trailing_whitespace = true
1515
insert_final_newline = true
16-
indent_size = 4
16+
indent_size = 2

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"parser": "babel-eslint",
3+
"plugins": ["flowtype"],
34
"rules": {
45
"eqeqeq": [2, "allow-null"],
56
"no-extra-semi": 2,

.flowconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[ignore]
2+
<PROJECT_ROOT>/__tests__/.*
3+
<PROJECT_ROOT>/__mocks__/.*
4+
<PROJECT_ROOT>/dist
5+
<PROJECT_ROOT>/coverage
6+
<PROJECT_ROOT>/docs
7+
<PROJECT_ROOT>/node_modules
8+
9+
[include]
10+
<PROJECT_ROOT>/src/component/js/*.js
11+
12+
[options]
13+
module.file_ext=.js
14+
module.file_ext=.css
15+
module.file_ext=.scss

__tests__/Tag-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import React from 'react';
42
import renderer from 'react-test-renderer';
53
import { shallow, mount } from 'enzyme';

__tests__/Tags-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
'use strict';
2-
31
import React from 'react';
42
import { findDOMNode } from 'react-dom';
5-
import { createRenderer, Simulate, renderIntoDocument } from 'react-addons-test-utils';
3+
import { Simulate, renderIntoDocument } from 'react-dom/test-utils';
4+
import { createRenderer } from 'react-test-renderer/shallow';
65
import Tags from '../src/component/js/Tags';
76
import App from './__fixtures__/App';
87

@@ -251,7 +250,8 @@ describe('Tags - removing', () => {
251250
beforeEach(() => {
252251
tags = renderIntoDocument(
253252
<App
254-
tags={TEST_TAGS} />
253+
tags={TEST_TAGS}
254+
deleteOnKeyPress={true} />
255255
);
256256

257257
const renderedDOM = findDOMNode(tags);
@@ -281,7 +281,7 @@ describe('Tags - removing', () => {
281281
input.value = '';
282282

283283
Simulate.change(input);
284-
Simulate.keyDown(input, {key: 'Delete', keyCode: 8, which: 8});
284+
Simulate.keyDown(input, {key: 'Delete', keyCode: 8, which: 8});
285285

286286
expect(tagContainer.children.length).toBe(1);
287287
expect(tagContainer.children[0].textContent).toContain(TEST_TAGS[0]);

0 commit comments

Comments
 (0)