mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Fix style
This commit is contained in:
parent
e7b831fc09
commit
eb24d5067c
@ -9,6 +9,7 @@
|
||||
"extends": ["eslint-config-postcss", "prettier"],
|
||||
"plugins": ["prettier"],
|
||||
"rules": {
|
||||
"no-unused-vars": [2, {"args": "all", "argsIgnorePattern": "^_"}],
|
||||
"prettier/prettier": [
|
||||
"error",
|
||||
{
|
||||
|
||||
@ -1249,8 +1249,8 @@ test('more than two config objects can be resolved', () => {
|
||||
customBackgroundOne: '#bada55',
|
||||
},
|
||||
textDecorationColor: {
|
||||
orange: 'orange'
|
||||
}
|
||||
orange: 'orange',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -1270,7 +1270,7 @@ test('more than two config objects can be resolved', () => {
|
||||
backgroundColor: {
|
||||
customBackgroundTwo: '#facade',
|
||||
},
|
||||
textDecorationColor: theme => theme('colors')
|
||||
textDecorationColor: theme => theme('colors'),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -1292,7 +1292,7 @@ test('more than two config objects can be resolved', () => {
|
||||
}),
|
||||
textDecorationColor: {
|
||||
lime: 'lime',
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -1316,12 +1316,7 @@ test('more than two config objects can be resolved', () => {
|
||||
},
|
||||
}
|
||||
|
||||
const result = resolveConfig([
|
||||
firstConfig,
|
||||
secondConfig,
|
||||
thirdConfig,
|
||||
defaultConfig
|
||||
])
|
||||
const result = resolveConfig([firstConfig, secondConfig, thirdConfig, defaultConfig])
|
||||
|
||||
expect(result).toEqual({
|
||||
prefix: '-',
|
||||
@ -1363,4 +1358,4 @@ test('more than two config objects can be resolved', () => {
|
||||
backgroundColor: ['responsive', 'hover', 'focus'],
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -8,7 +8,7 @@ function updateSource(nodes, source) {
|
||||
}
|
||||
|
||||
export default function(
|
||||
config,
|
||||
_config,
|
||||
{ base: pluginBase, components: pluginComponents, utilities: pluginUtilities }
|
||||
) {
|
||||
return function(css) {
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
import some from 'lodash/some'
|
||||
import mergeWith from 'lodash/mergeWith'
|
||||
import assignWith from 'lodash/assignWith'
|
||||
import isFunction from 'lodash/isFunction'
|
||||
import isUndefined from 'lodash/isUndefined'
|
||||
import defaults from 'lodash/defaults'
|
||||
import map from 'lodash/map'
|
||||
import reduce from 'lodash/reduce'
|
||||
import get from 'lodash/get'
|
||||
import toPath from 'lodash/toPath'
|
||||
import negateValue from './negateValue'
|
||||
|
||||
@ -28,29 +27,30 @@ function value(valueToResolve, ...args) {
|
||||
}
|
||||
|
||||
function mergeThemes(themes) {
|
||||
const theme = (({ extend, ...t }) => t)(themes.reduce((merged, t) => {
|
||||
return defaults(merged, t)
|
||||
}, {}))
|
||||
|
||||
// In order to resolve n config objects, we combine all of their `extend` properties
|
||||
// into arrays instead of objects so they aren't overridden.
|
||||
const extend = themes.reduce((merged, { extend }) => {
|
||||
return mergeWith(merged, extend, (mergedValue, extendValue) => {
|
||||
if (isUndefined(mergedValue)) {
|
||||
return [extendValue]
|
||||
}
|
||||
|
||||
if (Array.isArray(mergedValue)) {
|
||||
return [...mergedValue, extendValue]
|
||||
}
|
||||
|
||||
return [mergedValue, extendValue]
|
||||
})
|
||||
}, {})
|
||||
const theme = (({ extend: _, ...t }) => t)(
|
||||
themes.reduce((merged, t) => {
|
||||
return defaults(merged, t)
|
||||
}, {})
|
||||
)
|
||||
|
||||
return {
|
||||
...theme,
|
||||
extend,
|
||||
|
||||
// In order to resolve n config objects, we combine all of their `extend` properties
|
||||
// into arrays instead of objects so they aren't overridden.
|
||||
extend: themes.reduce((merged, { extend }) => {
|
||||
return mergeWith(merged, extend, (mergedValue, extendValue) => {
|
||||
if (isUndefined(mergedValue)) {
|
||||
return [extendValue]
|
||||
}
|
||||
|
||||
if (Array.isArray(mergedValue)) {
|
||||
return [...mergedValue, extendValue]
|
||||
}
|
||||
|
||||
return [mergedValue, extendValue]
|
||||
})
|
||||
}, {}),
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +97,10 @@ function resolveFunctionKeys(object) {
|
||||
export default function resolveConfig(configs) {
|
||||
return defaults(
|
||||
{
|
||||
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(map(configs, 'theme')))),
|
||||
// Need to get a default empty object if the config has no theme
|
||||
theme: resolveFunctionKeys(
|
||||
mergeExtensions(mergeThemes(map(configs, t => get(t, 'theme', {}))))
|
||||
),
|
||||
variants: (firstVariants => {
|
||||
return Array.isArray(firstVariants)
|
||||
? firstVariants
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user