diff --git a/packages/gasket-plugin-lint/lib/code-styles.js b/packages/gasket-plugin-lint/lib/code-styles.js index 33f93b6a7..f8134c2a4 100644 --- a/packages/gasket-plugin-lint/lib/code-styles.js +++ b/packages/gasket-plugin-lint/lib/code-styles.js @@ -27,15 +27,25 @@ const godaddy = { configName = 'godaddy-flow'; } + // limit the supported version ranges + const versionRanges = { + 'godaddy': '^7.1.1', + 'godaddy-react': '^9.1.0', + 'godaddy-flow': '^6.0.2', + 'godaddy-react-flow': '^6.0.2', + '@godaddy/eslint-plugin-react-intl': '^1.3.0', + 'stylelint-config-godaddy': '^0.6.0' + }; + pkg.add( 'devDependencies', - await gatherDevDeps(`eslint-config-${configName}`) + await gatherDevDeps(`eslint-config-${configName}@${versionRanges[configName]}`) ); pkg.add('eslintConfig', { extends: [configName] }); if (hasReactIntl) { const pluginName = '@godaddy/eslint-plugin-react-intl'; - const deps = await gatherDevDeps(pluginName); + const deps = await gatherDevDeps(`${pluginName}@${versionRanges[pluginName]}`); // only add the plugin to avoid stomping config version pkg.add('devDependencies', { [pluginName]: deps[pluginName] @@ -50,7 +60,7 @@ const godaddy = { if (addStylelint) { const stylelintName = 'stylelint-config-godaddy'; - pkg.add('devDependencies', await gatherDevDeps(stylelintName)); + pkg.add('devDependencies', await gatherDevDeps(`${stylelintName}@${versionRanges[stylelintName]}`)); pkg.add('stylelint', { extends: [stylelintName] }); } diff --git a/packages/gasket-plugin-lint/test/code-styles.test.js b/packages/gasket-plugin-lint/test/code-styles.test.js index 5700339ad..630b601b5 100644 --- a/packages/gasket-plugin-lint/test/code-styles.test.js +++ b/packages/gasket-plugin-lint/test/code-styles.test.js @@ -15,8 +15,9 @@ describe('code styles', () => { }; utils = { gatherDevDeps: jest.fn().mockImplementation(dep => { + const depName = /^@?[^@]+/.exec(dep)[0]; return Promise.resolve({ - [dep]: '*', + [depName]: '*', example: 'latest' }); }),