Skip to content

Commit d291ea3

Browse files
author
Tyler Rockwood
committed
Format
1 parent 48e88de commit d291ea3

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

src/utils/detectors.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { useTopLevelImportPaths, useTopLevelImportPathPatterns } from './options'
1+
import {
2+
useTopLevelImportPaths,
3+
useTopLevelImportPathPatterns,
4+
} from './options'
25

36
const VALID_TOP_LEVEL_IMPORT_PATHS = [
47
'styled-components',
@@ -8,14 +11,17 @@ const VALID_TOP_LEVEL_IMPORT_PATHS = [
811
]
912

1013
export const isValidTopLevelImport = (x, state) => {
11-
const isValid = [...VALID_TOP_LEVEL_IMPORT_PATHS, ...useTopLevelImportPaths(state)].includes(x);
12-
if (isValid) return true;
14+
const isValid = [
15+
...VALID_TOP_LEVEL_IMPORT_PATHS,
16+
...useTopLevelImportPaths(state),
17+
].includes(x)
18+
if (isValid) return true
1319
for (const pattern of useTopLevelImportPathPatterns(state)) {
1420
if (pattern.test(x)) {
15-
return x;
21+
return x
1622
}
1723
}
18-
return false;
24+
return false
1925
}
2026

2127
const localNameCache = {}

src/utils/options.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ export const useDisplayName = state => getOption(state, 'displayName')
88
export const useTopLevelImportPaths = state =>
99
getOption(state, 'topLevelImportPaths', [])
1010
export const useTopLevelImportPathPatterns = state =>
11-
getOption(state, 'topLevelImportPathPatterns', [])
12-
.map((pattern) => new RegExp(pattern));
11+
getOption(state, 'topLevelImportPathPatterns', []).map(
12+
pattern => new RegExp(pattern)
13+
)
1314
export const useSSR = state => getOption(state, 'ssr', true)
1415
export const useFileName = state => getOption(state, 'fileName')
1516
export const useMinify = state => getOption(state, 'minify')

src/visitors/minify.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ export default t => (path, state) => {
1414
templateLiteral.quasis.map(x => x.value.raw)
1515
)
1616

17-
const [
18-
cookedValuesMinfified,
19-
eliminatedExpressionIndices,
20-
] = minifyCookedValues(templateLiteral.quasis.map(x => x.value.cooked))
17+
const [cookedValuesMinfified, eliminatedExpressionIndices] =
18+
minifyCookedValues(templateLiteral.quasis.map(x => x.value.cooked))
2119

2220
eliminatedExpressionIndices.forEach((expressionIndex, iteration) => {
2321
templateLiteral.expressions.splice(expressionIndex - iteration, 1)

0 commit comments

Comments
 (0)