From 33e5546e9bd8380d28dd26491b35cf12e2edb036 Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Fri, 11 Oct 2019 14:29:38 -0400 Subject: [PATCH] Fix style --- __tests__/modifyConfig.test.js | 32 ++++++++++++++++---------------- __tests__/processPlugins.test.js | 4 ++-- __tests__/resolveConfig.test.js | 24 ++++++++++++------------ __tmp_4/tailwind.config.js | 12 ++++++------ src/util/resolveConfig.js | 5 ++++- 5 files changed, 40 insertions(+), 37 deletions(-) diff --git a/__tests__/modifyConfig.test.js b/__tests__/modifyConfig.test.js index 618838c5a..78d189c94 100644 --- a/__tests__/modifyConfig.test.js +++ b/__tests__/modifyConfig.test.js @@ -7,7 +7,7 @@ test('plugins can add new theme values', () => { corePlugins: [], plugins: [ { - modifyConfig: function(config) { + modifyConfig(config) { return { ...config, theme: { @@ -17,26 +17,26 @@ test('plugins can add new theme values', () => { '90': '90deg', '180': '180deg', '270': '270deg', - } - } + }, + }, } }, - handler: function({ addUtilities, theme }) { - addUtilities(Object.entries(theme('rotate')).map(([key, value]) => { - return { - [`.rotate-${key}`]: { - transform: `rotate(${value})`, - }, - } - })) + handler({ addUtilities, theme }) { + addUtilities( + Object.entries(theme('rotate')).map(([key, value]) => { + return { + [`.rotate-${key}`]: { + transform: `rotate(${value})`, + }, + } + }) + ) }, - } - ] + }, + ], }), ]) - .process('@tailwind utilities;', - { from: undefined } - ) + .process('@tailwind utilities;', { from: undefined }) .then(result => { const expected = ` .rotate-0 { diff --git a/__tests__/processPlugins.test.js b/__tests__/processPlugins.test.js index 2c323ed6c..ae8aad847 100644 --- a/__tests__/processPlugins.test.js +++ b/__tests__/processPlugins.test.js @@ -1211,7 +1211,7 @@ test('plugins can be provided as an object with a handler function', () => { const { components, utilities } = processPlugins( [ { - handler: function({ addUtilities }) { + handler({ addUtilities }) { addUtilities({ '.object-fill': { 'object-fit': 'fill', @@ -1224,7 +1224,7 @@ test('plugins can be provided as an object with a handler function', () => { }, }) }, - } + }, ], makeConfig() ) diff --git a/__tests__/resolveConfig.test.js b/__tests__/resolveConfig.test.js index cd9d9dc73..a61923098 100644 --- a/__tests__/resolveConfig.test.js +++ b/__tests__/resolveConfig.test.js @@ -1363,15 +1363,15 @@ test('plugin config modifications are applied', () => { const userConfig = { plugins: [ { - modifyConfig: function (config) { + modifyConfig(config) { return { ...config, - prefix: 'tw-' + prefix: 'tw-', } }, - handler: function () {} - } - ] + handler() {}, + }, + ], } const defaultConfig = { @@ -1391,7 +1391,7 @@ test('plugin config modifications are applied', () => { } const result = resolveConfig([userConfig, defaultConfig]) - + expect(result).toEqual({ prefix: 'tw-', important: false, @@ -1415,15 +1415,15 @@ test('user config takes precedence over plugin config modifications', () => { prefix: 'user-', plugins: [ { - modifyConfig: function (config) { + modifyConfig(config) { return { ...config, - prefix: 'plugin-' + prefix: 'plugin-', } }, - handler: function () {} - } - ] + handler() {}, + }, + ], } const defaultConfig = { @@ -1443,7 +1443,7 @@ test('user config takes precedence over plugin config modifications', () => { } const result = resolveConfig([userConfig, defaultConfig]) - + expect(result).toEqual({ prefix: 'user-', important: false, diff --git a/__tmp_4/tailwind.config.js b/__tmp_4/tailwind.config.js index 42791f2cf..ed20e570d 100644 --- a/__tmp_4/tailwind.config.js +++ b/__tmp_4/tailwind.config.js @@ -1,7 +1,7 @@ module.exports = { - theme: { - screens: { - mobile: '400px', - }, - }, - } \ No newline at end of file + theme: { + screens: { + mobile: '400px', + }, + }, +} diff --git a/src/util/resolveConfig.js b/src/util/resolveConfig.js index dc649816b..414b896bb 100644 --- a/src/util/resolveConfig.js +++ b/src/util/resolveConfig.js @@ -103,7 +103,10 @@ function resolveFunctionKeys(object) { } export default function resolveConfig([userConfig, defaultConfig]) { - const modifiedDefaultConfig = applyPluginConfigModifications(defaultConfig, get(userConfig, 'plugins', [])) + const modifiedDefaultConfig = applyPluginConfigModifications( + defaultConfig, + get(userConfig, 'plugins', []) + ) const configs = [userConfig, modifiedDefaultConfig] return defaults(