Skip to content

Commit b9a8c6b

Browse files
committed
remove flow from the codebase
1 parent efa808c commit b9a8c6b

16 files changed

Lines changed: 405 additions & 429 deletions

.eslintrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
"node": true,
77
"jest": true
88
},
9-
"plugins": [
10-
"flowtype"
11-
],
129
"rules": {
1310
"semi": [ 2, "never" ],
1411
"object-curly-newline": [ 0 ],

modules/generator/generatePluginList.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
/* @flow */
21
import pluginMap from './maps/pluginMap'
32

4-
export default function getRecommendedPlugins(
5-
browserList: Object
6-
): Array<string> {
3+
export default function getRecommendedPlugins(browserList) {
74
const recommendedPlugins = {}
85

96
for (const plugin in pluginMap) {

modules/generator/generatePrefixMap.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* @flow */
21
import { getSupport } from 'caniuse-api'
32

43
import propertyMap from './maps/propertyMap'
@@ -29,11 +28,7 @@ const flexPropsIE = [
2928
'flexBasis',
3029
]
3130

32-
function filterAndRemoveIfEmpty(
33-
map: Object,
34-
property: string,
35-
filter: Function
36-
): void {
31+
function filterAndRemoveIfEmpty(map, property, filter) {
3732
if (map[property]) {
3833
map[property] = map[property].filter(filter)
3934

@@ -43,7 +38,7 @@ function filterAndRemoveIfEmpty(
4338
}
4439
}
4540

46-
export default function generatePrefixMap(browserList: Object): Object {
41+
export default function generatePrefixMap(browserList) {
4742
const prefixMap = {}
4843

4944
for (const browser in prefixBrowserMap) {
@@ -54,15 +49,16 @@ export default function generatePrefixMap(browserList: Object): Object {
5449
const versions = getSupport(keyword)
5550

5651
for (let i = 0, len = keywordProperties.length; i < len; ++i) {
57-
if (versions[browser]){
52+
if (versions[browser]) {
5853
if (versions[browser].x >= browserList[browser]) {
59-
var property = keywordProperties[i];
54+
const property = keywordProperties[i]
55+
6056
if (!prefixMap[property]) {
61-
prefixMap[property] = [];
57+
prefixMap[property] = []
6258
}
6359

6460
if (prefixMap[property].indexOf(prefix) === -1) {
65-
prefixMap[property].push(prefix);
61+
prefixMap[property].push(prefix)
6662
}
6763
}
6864
}

modules/generator/index.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* @flow */
21
import generatePrefixMap from './generatePrefixMap'
32
import generatePluginList from './generatePluginList'
43

@@ -9,11 +8,7 @@ function generateImportString(plugin, compatibility) {
98
return `import ${plugin} from 'inline-style-prefixer/lib/plugins/${plugin}'`
109
}
1110

12-
export function generateFile(
13-
prefixMap: Object,
14-
pluginList: Array<string>,
15-
compatibility?: boolean
16-
) {
11+
export function generateFile(prefixMap, pluginList, compatibility) {
1712
const pluginImports = pluginList
1813
.map((plugin) => generateImportString(plugin, compatibility))
1914
.join('\n')
@@ -46,7 +41,7 @@ ${moduleExporter} {
4641
}`
4742
}
4843

49-
function saveFile(fileContent: string, path: string): void {
44+
function saveFile(fileContent, path) {
5045
/* eslint-disable global-require */
5146
const fs = require('fs')
5247
/* eslint-enable global-require */
@@ -60,23 +55,13 @@ function saveFile(fileContent: string, path: string): void {
6055
})
6156
}
6257

63-
type GenerationOption = {
64-
path?: string,
65-
compatibility?: boolean,
66-
plugins?: boolean,
67-
prefixMap?: boolean,
68-
}
69-
7058
const defaultOptions = {
7159
prefixMap: true,
7260
plugins: true,
7361
compatibility: false,
7462
}
7563

76-
export default function generateData(
77-
browserList: Object,
78-
userOptions: GenerationOption = {}
79-
) {
64+
export default function generateData(browserList, userOptions = {}) {
8065
const options = {
8166
...defaultOptions,
8267
...userOptions,

modules/plugins/filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const FILTER_REGEX = /filter\(/g
44
// http://caniuse.com/#feat=css-filter-function
55
const prefixes = ['-webkit-', '']
66

7-
export default function filter(property: string, value: any): ?Array<string> {
7+
export default function filter(property, value) {
88
if (
99
typeof value === 'string' &&
1010
!isPrefixedValue(value) &&

modules/plugins/flexboxOld.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* @flow */
21
const alternativeValues = {
32
'space-around': 'justify',
43
'space-between': 'justify',
@@ -15,11 +14,7 @@ const alternativeProps = {
1514
flexGrow: 'WebkitBoxFlex',
1615
}
1716

18-
export default function flexboxOld(
19-
property: string,
20-
value: any,
21-
style: Object
22-
): void {
17+
export default function flexboxOld(property, value, style) {
2318
if (property === 'flexDirection' && typeof value === 'string') {
2419
if (value.indexOf('column') > -1) {
2520
style.WebkitBoxOrient = 'vertical'

modules/plugins/gradient.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
/* @flow */
21
import isPrefixedValue from 'css-in-js-utils/lib/isPrefixedValue'
32

43
const prefixes = ['-webkit-', '-moz-', '']
54
const values = /linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/gi
65

7-
export default function gradient(property: string, value: any): ?Array<string> {
6+
export default function gradient(property, value) {
87
if (
98
typeof value === 'string' &&
109
!isPrefixedValue(value) &&

modules/plugins/grid.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
/* @flow */
2-
3-
function isSimplePositionValue(value: any) {
1+
function isSimplePositionValue(value) {
42
return typeof value === 'number' && !isNaN(value)
53
}
64

7-
function isComplexSpanValue(value: string) {
5+
function isComplexSpanValue(value) {
86
return typeof value === 'string' && value.includes('/')
97
}
108

@@ -16,13 +14,13 @@ const displayValues = {
1614
}
1715

1816
const propertyConverters = {
19-
alignSelf: (value: any, style: Object) => {
17+
alignSelf: (value, style) => {
2018
if (alignmentValues.indexOf(value) > -1) {
2119
style.msGridRowAlign = value
2220
}
2321
},
2422

25-
gridColumn: (value: any, style: Object) => {
23+
gridColumn: (value, style) => {
2624
if (isSimplePositionValue(value)) {
2725
style.msGridColumn = value
2826
} else if (isComplexSpanValue(value)) {
@@ -40,20 +38,20 @@ const propertyConverters = {
4038
}
4139
},
4240

43-
gridColumnEnd: (value: any, style: Object) => {
41+
gridColumnEnd: (value, style) => {
4442
const { msGridColumn } = style
4543
if (isSimplePositionValue(value) && isSimplePositionValue(msGridColumn)) {
4644
style.msGridColumnSpan = value - msGridColumn
4745
}
4846
},
4947

50-
gridColumnStart: (value: any, style: Object) => {
48+
gridColumnStart: (value, style) => {
5149
if (isSimplePositionValue(value)) {
5250
style.msGridColumn = value
5351
}
5452
},
5553

56-
gridRow: (value: any, style: Object) => {
54+
gridRow: (value, style) => {
5755
if (isSimplePositionValue(value)) {
5856
style.msGridRow = value
5957
} else if (isComplexSpanValue(value)) {
@@ -71,39 +69,35 @@ const propertyConverters = {
7169
}
7270
},
7371

74-
gridRowEnd: (value: any, style: Object) => {
72+
gridRowEnd: (value, style) => {
7573
const { msGridRow } = style
7674
if (isSimplePositionValue(value) && isSimplePositionValue(msGridRow)) {
7775
style.msGridRowSpan = value - msGridRow
7876
}
7977
},
8078

81-
gridRowStart: (value: any, style: Object) => {
79+
gridRowStart: (value, style) => {
8280
if (isSimplePositionValue(value)) {
8381
style.msGridRow = value
8482
}
8583
},
8684

87-
gridTemplateColumns: (value: any, style: Object) => {
85+
gridTemplateColumns: (value, style) => {
8886
style.msGridColumns = value
8987
},
9088

91-
gridTemplateRows: (value: any, style: Object) => {
89+
gridTemplateRows: (value, style) => {
9290
style.msGridRows = value
9391
},
9492

95-
justifySelf: (value: any, style: Object) => {
93+
justifySelf: (value, style) => {
9694
if (alignmentValues.indexOf(value) > -1) {
9795
style.msGridColumnAlign = value
9896
}
9997
},
10098
}
10199

102-
export default function grid(
103-
property: string,
104-
value: any,
105-
style: Object
106-
): ?Array<string> {
100+
export default function grid(property, value, style) {
107101
if (property === 'display' && value in displayValues) {
108102
return displayValues[value]
109103
}

modules/plugins/imageSet.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
/* @flow */
21
import isPrefixedValue from 'css-in-js-utils/lib/isPrefixedValue'
32

43
// http://caniuse.com/#feat=css-image-set
54
const prefixes = ['-webkit-', '']
65

7-
export default function imageSet(property: string, value: any): ?Array<string> {
6+
export default function imageSet(property, value) {
87
if (
98
typeof value === 'string' &&
109
!isPrefixedValue(value) &&

modules/plugins/logical.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* @flow */
21
const alternativeProps = {
32
marginBlockStart: ['WebkitMarginBefore'],
43
marginBlockEnd: ['WebkitMarginAfter'],
@@ -26,11 +25,7 @@ const alternativeProps = {
2625
borderInlineEndWidth: ['WebkitBorderEndWidth', 'MozBorderEndWidth'],
2726
}
2827

29-
export default function logical(
30-
property: string,
31-
value: any,
32-
style: Object
33-
): void {
28+
export default function logical(property, value, style) {
3429
if (Object.prototype.hasOwnProperty.call(alternativeProps, property)) {
3530
const alternativePropList = alternativeProps[property]
3631
for (let i = 0, len = alternativePropList.length; i < len; ++i) {

0 commit comments

Comments
 (0)