diff --git a/.changeset/silent-steaks-chew.md b/.changeset/silent-steaks-chew.md new file mode 100644 index 000000000..18725edc9 --- /dev/null +++ b/.changeset/silent-steaks-chew.md @@ -0,0 +1,5 @@ +--- +'@hypermod/validator': patch +--- + +Fixes usage of fetchConfig to account for undefined. Now errors should be reported correctly diff --git a/.changeset/slimy-mangos-refuse.md b/.changeset/slimy-mangos-refuse.md new file mode 100644 index 000000000..582abc5ff --- /dev/null +++ b/.changeset/slimy-mangos-refuse.md @@ -0,0 +1,5 @@ +--- +'@hypermod/fetcher': patch +--- + +Correctly types fetchConfig function to correctly show that this function can return `undefined` diff --git a/.changeset/wild-pigs-care.md b/.changeset/wild-pigs-care.md new file mode 100644 index 000000000..4ce333297 --- /dev/null +++ b/.changeset/wild-pigs-care.md @@ -0,0 +1,5 @@ +--- +'@hypermod/mod-atlaskit__textfield': patch +--- + +Removes unused variables diff --git a/community/hypermod/src/defineInlineTest-to-applyTransform/transform.ts b/community/hypermod/src/defineInlineTest-to-applyTransform/transform.ts index ac8e0d2cf..e59841cf4 100644 --- a/community/hypermod/src/defineInlineTest-to-applyTransform/transform.ts +++ b/community/hypermod/src/defineInlineTest-to-applyTransform/transform.ts @@ -102,7 +102,8 @@ function transformDefineInlineTestCalls( path.node.callee.property.name === 'defineInlineTest'), ) .forEach(path => { - const [transformerOpts, input, output, description] = path.node.arguments; + const [transformerOpts, _configOpts, input, output, description] = + path.node.arguments; const transformer = j(transformerOpts).find(j.ObjectProperty, { key: { name: 'default' }, diff --git a/packages/fetcher/src/index.spec.ts b/packages/fetcher/src/index.spec.ts index 91a89e3d8..9fd72464b 100644 --- a/packages/fetcher/src/index.spec.ts +++ b/packages/fetcher/src/index.spec.ts @@ -109,13 +109,13 @@ describe('fetcher', () => { require: jest.fn().mockReturnValue(mockConfig), }; - const { filePath, config } = await fetchPackage( + const configMeta = await fetchPackage( 'fake-package', mockPackageManager as unknown as PluginManager, ); - expect(config).toEqual(mockConfig); - expect(filePath).toEqual(mockFilePath); + expect(configMeta!.config).toEqual(mockConfig); + expect(configMeta!.filePath).toEqual(mockFilePath); }); it('should throw if fetching fails', async () => { @@ -148,13 +148,15 @@ describe('fetcher', () => { }), }; - const { config, filePath } = await fetchRemotePackage( + const configMeta = await fetchRemotePackage( 'fake-package', mockPackageManager as unknown as PluginManager, ); - expect(config).toEqual(mockConfig); - expect(filePath).toEqual(mockBasePath + '/hypermod.config.js'); + expect(configMeta!.config).toEqual(mockConfig); + expect(configMeta!.filePath).toEqual( + mockBasePath + '/hypermod.config.js', + ); }); it('should throw if fetching fails', async () => { @@ -181,13 +183,13 @@ describe('fetcher', () => { }), }; - const { config, filePath } = await fetchRemotePackage( + const configMeta = await fetchRemotePackage( 'fake-package', mockPackageManager as unknown as PluginManager, ); - expect(config).toEqual(mockConfig); - expect(filePath).toEqual(mockBasePath + '/index.js'); + expect(configMeta!.config).toEqual(mockConfig); + expect(configMeta!.filePath).toEqual(mockBasePath + '/index.js'); }); it('throws if entrypoint-based config does not contain a valid config (and there are no config files available elsewhere)', async () => { diff --git a/scripts/docs.ts b/scripts/docs.ts index 0c7db6b6e..b2cb780f7 100644 --- a/scripts/docs.ts +++ b/scripts/docs.ts @@ -73,13 +73,13 @@ async function main() { const directories = communityCodemods.filter(dir => junk.not(dir)); for (const dir of directories) { - const { config } = await fetchConfig(path.join(COMMUNITY_PATH, dir)); + const configMeta = await fetchConfig(path.join(COMMUNITY_PATH, dir)); - if (!config) { + if (!configMeta || !configMeta.config) { throw new Error(`Unable to locate config for path: ${dir}`); } - data.push({ name: dir, config }); + data.push({ name: dir, config: configMeta.config }); } cleanTargetDir(DOCS_PATH);