From 02f7623d0d4871145b86b00bbd4953ad911e2423 Mon Sep 17 00:00:00 2001 From: Andrew Gerard <63810935+agerard-godaddy@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:39:03 -0700 Subject: [PATCH] Pin GoDaddy ESLint packages with ESLint 8 compatability (#1019) * fix: pin godaddy eslint packages with eslint 8 compatability * docs: changelog --- packages/gasket-plugin-lint/CHANGELOG.md | 3 +++ packages/gasket-plugin-lint/lib/code-styles.js | 16 +++++++++++++--- .../gasket-plugin-lint/test/code-styles.test.js | 3 ++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/gasket-plugin-lint/CHANGELOG.md b/packages/gasket-plugin-lint/CHANGELOG.md index 6736335f0..419c51c3b 100644 --- a/packages/gasket-plugin-lint/CHANGELOG.md +++ b/packages/gasket-plugin-lint/CHANGELOG.md @@ -1,5 +1,7 @@ # `@gasket/plugin-lint` +- Pin GoDaddy ESLint packages with ESLint 8 compatability ([#1019]) + ### 7.1.0 - Aligned version releases across all packages @@ -124,3 +126,4 @@ [#482]: https://github.com/godaddy/gasket/pull/482 [#670]: https://github.com/godaddy/gasket/pull/670 [#937]: https://github.com/godaddy/gasket/pull/937 +[#1019]: https://github.com/godaddy/gasket/pull/1019 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' }); }),