diff --git a/package.json b/package.json index cfe95d9..a1f6e66 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@babel/core": "^7.9.6", "@commitlint/cli": "^8.3.5", "@commitlint/config-conventional": "^8.3.4", + "amex-jest-preset": "^7.0.0", "amex-jest-preset-react": "^6.1.0", "babel-jest": "^26.1.0", "babel-preset-amex": "^2.1.0", @@ -43,7 +44,8 @@ "eslint-plugin-jest": "^27.6.0", "eslint-plugin-jest-dom": "^4.0.1", "husky": "^4.0.10", - "jest": "^25.1.0", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", "lerna": "^3.22.1", "lockfile-lint": "^4.1.0", "prettier": "^2.8.4", diff --git a/packages/holocron-module-register-webpack-plugin/HolocronModuleRegisterPlugin.js b/packages/holocron-module-register-webpack-plugin/HolocronModuleRegisterPlugin.js index e4b98c7..6e70af6 100644 --- a/packages/holocron-module-register-webpack-plugin/HolocronModuleRegisterPlugin.js +++ b/packages/holocron-module-register-webpack-plugin/HolocronModuleRegisterPlugin.js @@ -34,7 +34,7 @@ HolocronModuleRegisterPlugin.prototype.apply = function apply(compiler) { // descend into the source and inject the registration within the iife // The last two symbols are always the closing of the iife, then a `;` // Therefore, insert the registration immediately before the iife closes - // eslint-disable-next-line no-underscore-dangle, max-len -- webpack + // eslint-disable-next-line no-underscore-dangle -- webpack source._source._children.splice(-2, 0, `;Holocron.registerModule("${moduleName}", ${holocronModuleName});`); }); }); diff --git a/packages/holocron-module-register-webpack-plugin/__tests__/HolocronModuleRegisterPlugin.spec.js b/packages/holocron-module-register-webpack-plugin/__tests__/HolocronModuleRegisterPlugin.spec.js index 6bc88b5..6e485e9 100644 --- a/packages/holocron-module-register-webpack-plugin/__tests__/HolocronModuleRegisterPlugin.spec.js +++ b/packages/holocron-module-register-webpack-plugin/__tests__/HolocronModuleRegisterPlugin.spec.js @@ -111,7 +111,7 @@ describe('HolocronModuleRegisterPlugin', () => { expect(fileContents.startsWith('/******/ (() => { // webpackBootstrap')).toBe(true); expect(fileContents).toContain('const ModuleWithAsyncImport = () =>'); expect(fileContents).toContain('Holocron.registerModule("some-module", SomeModule);'); - // eslint-disable-next-line max-len -- long assignment + const asyncChunkContents = fs.readFileSync(path.join(buildPath, `async-import.${outputFileName}`)).toString(); expect(asyncChunkContents).toContain('() => \'Hello, world\''); expect(asyncChunkContents).not.toContain('Holocron.registerModule("some-module"'); diff --git a/packages/holocron-module-route/__tests__/__snapshots__/ModuleRouteUtils.spec.jsx.snap b/packages/holocron-module-route/__tests__/__snapshots__/ModuleRouteUtils.spec.jsx.snap index 2d4d417..1e3b0ae 100644 --- a/packages/holocron-module-route/__tests__/__snapshots__/ModuleRouteUtils.spec.jsx.snap +++ b/packages/holocron-module-route/__tests__/__snapshots__/ModuleRouteUtils.spec.jsx.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ModuleRouteUtils addToRouteProps should add props and replace old props with new ones 1`] = ` -Object { - "props": Object { +{ + "props": { "changed": "new", "new": "prop", "unchanged": "value", @@ -12,21 +12,21 @@ Object { `; exports[`ModuleRouteUtils createModuleRoute getChildRoutes should get the child routes 1`] = ` -Array [ - Object { +[ + { "indexRoute": "index", "moduleName": "another-module", "path": "another", - "props": Object { - "store": Object { + "props": { + "store": { "dispatch": [MockFunction] { - "calls": Array [ - Array [ + "calls": [ + [ Promise {}, ], ], - "results": Array [ - Object { + "results": [ + { "type": "return", "value": Promise {}, }, @@ -39,9 +39,9 @@ Array [ `; exports[`ModuleRouteUtils createModuleRoute getComponent should get the module 1`] = ` -Object { - "childRoutes": Array [ - Object { +{ + "childRoutes": [ + { "indexRoute": "index", "moduleName": "another-module", "path": "another", @@ -51,7 +51,7 @@ Object { `; exports[`ModuleRouteUtils createModuleRoute should create a valid module route 1`] = ` -Object { +{ "default": "value", "getChildRoutes": [Function], "getComponent": [Function], @@ -64,7 +64,7 @@ Object { `; exports[`ModuleRouteUtils createModuleRoute should not add moduleRoute props if no moduleName is present 1`] = ` -Object { +{ "default": "value", "hello": "world", "title": "test", @@ -72,9 +72,9 @@ Object { `; exports[`ModuleRouteUtils createModuleRouteFromElement should convert a jsx ModuleRoute to a valid module route 1`] = ` -Object { - "childRoutes": Array [ - Object { +{ + "childRoutes": [ + { "getChildRoutes": [Function], "getComponent": [Function], "getIndexRoute": [Function], @@ -98,7 +98,7 @@ Object { `; exports[`ModuleRouteUtils createModuleRouteFromElement should not add childRoutes if the only children are not valid elements 1`] = ` -Object { +{ "getChildRoutes": [Function], "getComponent": [Function], "getIndexRoute": [Function], @@ -111,9 +111,9 @@ Object { `; exports[`ModuleRouteUtils passChildrenProps should pass props to children 1`] = ` -Array [ - Object { - "props": Object { +[ + { + "props": { "hello": "world", }, }, @@ -121,11 +121,11 @@ Array [ `; exports[`ModuleRouteUtils passChildrenProps should pass the store to a function that creates routes 1`] = ` -Array [ - Object { - "props": Object { +[ + { + "props": { "state": "Hello world", - "store": Object { + "store": { "getState": [Function], }, }, @@ -133,4 +133,4 @@ Array [ ] `; -exports[`ModuleRouteUtils passChildrenProps should return an empty array if no routes are provided 1`] = `Array []`; +exports[`ModuleRouteUtils passChildrenProps should return an empty array if no routes are provided 1`] = `[]`; diff --git a/packages/holocron/__tests__/__snapshots__/RenderModule.spec.jsx.snap b/packages/holocron/__tests__/__snapshots__/RenderModule.spec.jsx.snap index 83861ae..4277379 100644 --- a/packages/holocron/__tests__/__snapshots__/RenderModule.spec.jsx.snap +++ b/packages/holocron/__tests__/__snapshots__/RenderModule.spec.jsx.snap @@ -3,7 +3,7 @@ exports[`RenderModule should pass children to the module 1`] = `
@@ -20,7 +20,7 @@ exports[`RenderModule should pass props to the module 1`] = `
@@ -54,8 +54,8 @@ exports[`RenderModule should render a module 1`] = ` `; exports[`RenderModule should warn and render null when it cannot find a module in registry 1`] = ` -Array [ - Array [ +[ + [ "Module not-in-module-map was not found in the holocron module registry", ], ] @@ -64,13 +64,13 @@ Array [ exports[`RenderModule should warn and render null when it cannot find a module in registry 2`] = ` `; exports[`RenderModule should warn and render null when module is not loaded 1`] = ` -Array [ - Array [ +[ + [ "Module not-in-module-map was not found in the holocron module registry", ], ] @@ -79,6 +79,6 @@ Array [ exports[`RenderModule should warn and render null when module is not loaded 2`] = ` `; diff --git a/packages/holocron/__tests__/__snapshots__/holocronModule.spec.jsx.snap b/packages/holocron/__tests__/__snapshots__/holocronModule.spec.jsx.snap index 27d2c14..14f9bf7 100644 --- a/packages/holocron/__tests__/__snapshots__/holocronModule.spec.jsx.snap +++ b/packages/holocron/__tests__/__snapshots__/holocronModule.spec.jsx.snap @@ -1,23 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`holocronModule executeLoadModuleData should call loadModuleData with correct args 1`] = ` -Array [ - Array [ - Object { +[ + [ + { "fetchClient": [MockFunction], - "module": Object { + "module": { "displayName": "FakeComponent", }, - "ownProps": Object {}, - "store": Object { + "ownProps": {}, + "store": { "dispatch": [MockFunction] { - "calls": Array [ - Array [ + "calls": [ + [ [Function], ], ], - "results": Array [ - Object { + "results": [ + { "type": "return", "value": Promise {}, }, @@ -66,8 +66,8 @@ exports[`holocronModule should provide the module state as a plain JS prop if a `; exports[`holocronModule should warn if a reducer is set but no name 1`] = ` -Array [ - Array [ +[ + [ "The Holocron Config in 'HolocronModule(undefined)' requires a 'name' when passing a 'reducer'. The 'reducer' will not be added to the Redux Store without a 'name'.", ], diff --git a/packages/holocron/__tests__/__snapshots__/index.spec.js.snap b/packages/holocron/__tests__/__snapshots__/index.spec.js.snap index fbbb7ee..8bb1faf 100644 --- a/packages/holocron/__tests__/__snapshots__/index.spec.js.snap +++ b/packages/holocron/__tests__/__snapshots__/index.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`public API should not have anything removed 1`] = ` -Object { +{ "RenderModule": [Function], "clearModulesUsingExternals": [Function], "composeModules": [Function], diff --git a/packages/holocron/__tests__/__snapshots__/loadModule.node.spec.js.snap b/packages/holocron/__tests__/__snapshots__/loadModule.node.spec.js.snap index e89f706..21e554b 100644 --- a/packages/holocron/__tests__/__snapshots__/loadModule.node.spec.js.snap +++ b/packages/holocron/__tests__/__snapshots__/loadModule.node.spec.js.snap @@ -18,8 +18,8 @@ Retrying (3)..." `; exports[`loadModule.node loading a module retries 4`] = ` -"Holocron module \\"awesome\\" at \\"https://example.com/cdn/awesome/1.0.0/awesome.node.js\\" failed to execute. - [Error Message]: \\"test error, like a socket disconnect\\" +"Holocron module "awesome" at "https://example.com/cdn/awesome/1.0.0/awesome.node.js" failed to execute. + [Error Message]: "test error, like a socket disconnect" Please fix any errors and wait for it to be reloaded." `; diff --git a/packages/holocron/__tests__/__snapshots__/moduleRegistry.spec.js.snap b/packages/holocron/__tests__/__snapshots__/moduleRegistry.spec.js.snap index 1ddf61e..fa2793f 100644 --- a/packages/holocron/__tests__/__snapshots__/moduleRegistry.spec.js.snap +++ b/packages/holocron/__tests__/__snapshots__/moduleRegistry.spec.js.snap @@ -11,7 +11,7 @@ exports[`moduleRegistry should maintain a block list 2`] = `"https://example.com exports[`moduleRegistry should register modules 1`] = ` Immutable.Map { - "good-module": Object { + "good-module": { "$$typeof": Symbol(react.memo), "WrappedComponent": [Function], "compare": null, @@ -22,7 +22,7 @@ Immutable.Map { `; exports[`moduleRegistry should register modules 2`] = ` -Object { +{ "$$typeof": Symbol(react.memo), "WrappedComponent": [Function], "compare": null, diff --git a/packages/holocron/__tests__/__snapshots__/publicHolocronModule.spec.js.snap b/packages/holocron/__tests__/__snapshots__/publicHolocronModule.spec.js.snap index f745bc1..d18ffb5 100644 --- a/packages/holocron/__tests__/__snapshots__/publicHolocronModule.spec.js.snap +++ b/packages/holocron/__tests__/__snapshots__/publicHolocronModule.spec.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`publicHolocronModule should add holocron config properties to component 1`] = ` -Object { +{ "displayName": "FakeComponent", - "holocron": Object { + "holocron": { "load": [Function], "loadModuleData": [Function], "mergeProps": [Function], @@ -17,9 +17,9 @@ Object { `; exports[`publicHolocronModule should attach empty holocron config to component without args 1`] = ` -Object { +{ "displayName": "FakeComponent", - "holocron": Object {}, + "holocron": {}, "name": "FakeComponent", } `; diff --git a/packages/holocron/__tests__/__snapshots__/updateModuleRegistry.spec.js.snap b/packages/holocron/__tests__/__snapshots__/updateModuleRegistry.spec.js.snap index 3b8d1a5..46f5e3a 100644 --- a/packages/holocron/__tests__/__snapshots__/updateModuleRegistry.spec.js.snap +++ b/packages/holocron/__tests__/__snapshots__/updateModuleRegistry.spec.js.snap @@ -18,17 +18,17 @@ Immutable.Map { `; exports[`updateModuleRegistry should resolve with the new versions of the changed modules 1`] = ` -Object { - "another-module": Object { - "browser": Object { +{ + "another-module": { + "browser": { "integrity": "7764", "url": "https://example.com/cdn/another-module/2.5.6/another-module.browser.js", }, - "legacyBrowser": Object { + "legacyBrowser": { "integrity": "34566", "url": "https://example.com/cdn/another-module/2.5.6/another-module.legacy.browser.js", }, - "node": Object { + "node": { "integrity": "4556", "url": "https://example.com/cdn/another-module/2.5.6/another-module.node.js", }, @@ -37,17 +37,17 @@ Object { `; exports[`updateModuleRegistry should resolve with the new versions of the changed modules if the current module registry is empty 1`] = ` -Object { - "another-module": Object { - "browser": Object { +{ + "another-module": { + "browser": { "integrity": "7764", "url": "https://example.com/cdn/another-module/2.5.6/another-module.browser.js", }, - "legacyBrowser": Object { + "legacyBrowser": { "integrity": "34566", "url": "https://example.com/cdn/another-module/2.5.6/another-module.legacy.browser.js", }, - "node": Object { + "node": { "integrity": "4556", "url": "https://example.com/cdn/another-module/2.5.6/another-module.node.js", }, @@ -107,8 +107,8 @@ Immutable.Map { `; exports[`updateModuleRegistry should update the modules in the registry: modules 1`] = ` -Object { - "another-module": Object { +{ + "another-module": { "$$typeof": Symbol(react.memo), "WrappedComponent": [Function], "compare": null, diff --git a/packages/holocron/__tests__/externalRegistry.spec.jsx b/packages/holocron/__tests__/externalRegistry.spec.jsx index 2bd8b04..511fe9a 100644 --- a/packages/holocron/__tests__/externalRegistry.spec.jsx +++ b/packages/holocron/__tests__/externalRegistry.spec.jsx @@ -60,23 +60,23 @@ describe('externalRegistry', () => { expect(externalRegistry.getRequiredExternalsRegistry()) .toMatchInlineSnapshot(` - Object { - "child-module-a": Object { - "that-dep": Object { + { + "child-module-a": { + "that-dep": { "integrity": "12345hash", "name": "that-dep", "semanticRange": "^2.2.0", "version": "2.3.1", }, - "this-version": Object { + "this-version": { "integrity": "12345hash", "name": "this-version", "semanticRange": "^1.2.0", "version": "1.2.3", }, }, - "child-module-b": Object { - "this-version": Object { + "child-module-b": { + "this-version": { "integrity": "123456hash", "name": "this-version", "semanticRange": "^1.2.0", @@ -118,15 +118,15 @@ describe('externalRegistry', () => { expect(externalRegistry.getRequiredExternals(moduleName)) .toMatchInlineSnapshot(` - Array [ - Object { + [ + { "integrity": "12345hash", "moduleName": "child-module-a", "name": "some-dep", "semanticRange": "^1.2.0", "version": "1.2.3", }, - Object { + { "integrity": "123456hash", "moduleName": "child-module-a", "name": "that-dep", @@ -139,7 +139,10 @@ describe('externalRegistry', () => { it('returns empty array when no externals are provided', () => { const moduleName = 'child-module-a'; - externalRegistry.setModulesRequiredExternals({ moduleName, externals: undefined }); + externalRegistry.setModulesRequiredExternals({ + moduleName, + externals: undefined, + }); expect(externalRegistry.getRequiredExternals(moduleName)).toEqual([]); }); }); @@ -150,7 +153,7 @@ describe('externalRegistry', () => { expect( externalRegistry.getUnregisteredRequiredExternals(moduleName) - ).toMatchInlineSnapshot('Array []'); + ).toMatchInlineSnapshot('[]'); externalRegistry.setModulesRequiredExternals({ moduleName, @@ -178,8 +181,8 @@ describe('externalRegistry', () => { expect(externalRegistry.getUnregisteredRequiredExternals(moduleName)) .toMatchInlineSnapshot(` - Array [ - Object { + [ + { "integrity": "123456hash", "moduleName": "child-module-a", "name": "that-dep", @@ -192,7 +195,7 @@ describe('externalRegistry', () => { externalRegistry.registerExternal({ name: 'that-dep', version: '1.2.4' }); expect( externalRegistry.getUnregisteredRequiredExternals(moduleName) - ).toMatchInlineSnapshot('Array []'); + ).toMatchInlineSnapshot('[]'); }); it('does not accidentally match different registered version', () => { @@ -217,8 +220,8 @@ describe('externalRegistry', () => { expect(externalRegistry.getUnregisteredRequiredExternals(moduleName)) .toMatchInlineSnapshot(` - Array [ - Object { + [ + { "integrity": "12345hash", "moduleName": "child-module-a", "name": "some-dep", @@ -250,12 +253,12 @@ describe('externalRegistry', () => { }); expect(externalRegistry.getRegisteredExternals()).toMatchInlineSnapshot(` - Object { - "some-dep": Object { + { + "some-dep": { "1.2.3": [Function], "2.0.0": [Function], }, - "that-dep": Object { + "that-dep": { "0.0.1-alpha.0.1": [Function], }, } @@ -364,9 +367,9 @@ describe('externalRegistry', () => { externalRegistry.clearModulesRequiredExternals('child-module-a'); expect(externalRegistry.getRequiredExternalsRegistry()) .toMatchInlineSnapshot(` - Object { - "child-module-b": Object { - "this-version": Object { + { + "child-module-b": { + "this-version": { "integrity": "123456hash", "name": "this-version", "semanticRange": "^1.2.0", diff --git a/packages/holocron/__tests__/loadModule.node.spec.js b/packages/holocron/__tests__/loadModule.node.spec.js index c886dec..7a30a31 100644 --- a/packages/holocron/__tests__/loadModule.node.spec.js +++ b/packages/holocron/__tests__/loadModule.node.spec.js @@ -742,7 +742,7 @@ describe('loadModule.node', () => { moduleUrl ); }); - // eslint-disable-next-line max-len -- long test name + it(`does not add \`${moduleName}\` to block list if \`shouldBlockModuleReload\` is 'true' and in development`, async () => { expect.assertions(4); @@ -794,7 +794,8 @@ describe('loadModule.node', () => { statusText: 'OK', json: () => '{ "requiredExternals": {} }', ok: true, - })); + }) + ); mockFetch.mockImplementationOnce( makeFetchMock({ fetchText: moduleString }) @@ -848,14 +849,16 @@ describe('loadModule.node', () => { ], }), ok: true, - })); + }) + ); mockFetch.mockImplementationOnce(() => Promise.resolve({ status: 200, statusText: 'OK', text: () => 'external fallback code', ok: true, - })); + }) + ); mockFetch.mockImplementationOnce( makeFetchMock({ fetchText: moduleString }) @@ -921,7 +924,8 @@ describe('loadModule.node', () => { }, }), ok: true, - })); + }) + ); mockFetch.mockImplementationOnce( makeFetchMock({ fetchText: moduleString }) ); @@ -971,7 +975,8 @@ describe('loadModule.node', () => { }, }), ok: true, - })); + }) + ); mockFetch.mockImplementationOnce( makeFetchMock({ fetchText: moduleString }) ); @@ -1026,7 +1031,8 @@ describe('loadModule.node', () => { }, }), ok: true, - })); + }) + ); mockFetch.mockImplementationOnce( makeFetchMock({ fetchText: moduleString }) ); @@ -1074,7 +1080,8 @@ describe('loadModule.node', () => { }, }, }), - })); + }) + ); // load module const loadModule = load({ @@ -1131,13 +1138,15 @@ describe('loadModule.node', () => { }, }), ok: true, - })); + }) + ); mockFetch.mockImplementation(() => Promise.resolve({ ok: true, status: 200, text: () => JSON.stringify({}), - })); + }) + ); const loadModule = load({ fetch: mockFetch, @@ -1207,7 +1216,8 @@ describe('loadModule.node', () => { statusText: 'OK', text: () => 'external fallback code', ok: true, - })); + }) + ); // mock fetch for module code mockFetch.mockImplementationOnce( @@ -1239,9 +1249,9 @@ describe('loadModule.node', () => { expect(externalRegistry.getRequiredExternalsRegistry()) .toMatchInlineSnapshot(` - Object { - "awesome": Object { - "lodash": Object { + { + "awesome": { + "lodash": { "browserIntegrity": "1234-browser", "name": "lodash", "nodeIntegrity": "1234-node", @@ -1272,7 +1282,8 @@ describe('loadModule.node', () => { // does not have moduleConfig file. mockFetch.mockImplementationOnce(() => Promise.resolve({ status: 404, - })); + }) + ); // mock fetch for module mockFetch.mockImplementationOnce( diff --git a/packages/holocron/__tests__/updateModuleRegistry.spec.js b/packages/holocron/__tests__/updateModuleRegistry.spec.js index 8d79427..3ad91d8 100644 --- a/packages/holocron/__tests__/updateModuleRegistry.spec.js +++ b/packages/holocron/__tests__/updateModuleRegistry.spec.js @@ -485,7 +485,6 @@ describe('updateModuleRegistry', () => { }); it('resolves with accepted and rejected modules when detailedResponse is selected', async () => { - // eslint-disable-next-line max-len -- arrow function const mockLoadModule = async (moduleName, moduleVersion) => `new ${moduleName}@${moduleVersion}`; jest.spyOn(console, 'error').mockImplementation((x) => x); // occurs first time updateModuleRegistry is called @@ -574,7 +573,6 @@ describe('updateModuleRegistry', () => { }); it('should not throw if any of the modules fail to load', async () => { - // eslint-disable-next-line max-len -- arrow function const mockLoadModule = async (moduleName, moduleVersion) => `new ${moduleName}@${moduleVersion}`; jest.spyOn(console, 'error').mockImplementation((x) => x); @@ -647,7 +645,6 @@ describe('updateModuleRegistry', () => { expect(console.error).toHaveBeenCalled(); }); it('should not throw if any of the modules fail to load - empty module map', async () => { - // eslint-disable-next-line max-len -- arrow function const mockLoadModule = async (moduleName, moduleVersion) => `new ${moduleName}@${moduleVersion}`; jest.spyOn(console, 'error').mockImplementation((x) => x); diff --git a/packages/holocron/src/ducks/compose.js b/packages/holocron/src/ducks/compose.js index a07ef69..99bce4f 100644 --- a/packages/holocron/src/ducks/compose.js +++ b/packages/holocron/src/ducks/compose.js @@ -53,7 +53,6 @@ export function composeModules(moduleConfigs) { return Promise.resolve(); }) .catch((error) => { - // eslint-disable-next-line max-len -- long message console.error(`Error while attempting to call 'load' or 'loadModuleData' inside composeModules for ${name}.`, error); if (error.abortComposeModules) throw error; return error; diff --git a/packages/holocron/src/ducks/load.js b/packages/holocron/src/ducks/load.js index eec7230..7df3ff7 100644 --- a/packages/holocron/src/ducks/load.js +++ b/packages/holocron/src/ducks/load.js @@ -134,7 +134,6 @@ export function loadModule(moduleName) { } if (!moduleData) { - // eslint-disable-next-line max-len -- long message const moduleLoadError = new Error(`Could not load Module ${moduleName} because it does not exist in the Module Version Map`); dispatch(moduleLoadFailed(moduleName, moduleLoadError)); return Promise.reject(moduleLoadError); @@ -142,7 +141,7 @@ export function loadModule(moduleName) { if (modules) { const module = getModule(moduleName, modules); - // eslint-disable-next-line max-len -- ternary operator + loadPromise = module ? Promise.resolve(module) : Promise.reject(new Error(`Module ${moduleName} was not preloaded on server`)); } else { // eslint-disable-next-line import/extensions -- include extension diff --git a/packages/holocron/src/holocronModule.jsx b/packages/holocron/src/holocronModule.jsx index e85c6a4..4a0b2b9 100644 --- a/packages/holocron/src/holocronModule.jsx +++ b/packages/holocron/src/holocronModule.jsx @@ -80,7 +80,6 @@ export async function executeLoadingFunctions({ setStatus('loaded'); } } catch (error) { - // eslint-disable-next-line max-len -- long message console.error(`Error while attempting to call 'load' or 'loadModuleData' inside Holocron module ${componentName}.`, error); if (mounted) { setStatus('error'); @@ -157,7 +156,7 @@ export default function holocronModule({ let mapModuleStateToProps = mapStateToProps; if (reducer && !name) { - // eslint-disable-next-line max-len, no-console -- long message + // eslint-disable-next-line no-console -- long message console.warn(`The Holocron Config in '${getModuleDisplayName(getModuleName(WrappedComponent, name))}' requires a 'name' when passing a 'reducer'.\nThe 'reducer' will not be added to the Redux Store without a 'name'.`); } diff --git a/packages/holocron/src/loadModule.node.js b/packages/holocron/src/loadModule.node.js index b0c59f4..c09e6a3 100644 --- a/packages/holocron/src/loadModule.node.js +++ b/packages/holocron/src/loadModule.node.js @@ -71,7 +71,7 @@ const fetchAsset = async (assetUrl, parseAsJson) => { if (tries > maxRetries) { throw err; } - // eslint-disable-next-line max-len, no-console -- long message + // eslint-disable-next-line no-console -- long message console.warn(`Encountered error fetching module at ${assetUrl}: ${err.message}\nRetrying (${tries})...`); return fetchAssetAttempt(tries + 1); @@ -103,7 +103,7 @@ const fetchNodeModule = async (url, integrity, context) => { moduleString, { algorithms: ['sha256', 'sha384'] } ).toString(); - // eslint-disable-next-line max-len -- long message + assert(integrity === actualSRI, `SRI for module at ${url} must match SRI in module map.\n Expected ${integrity}, received ${actualSRI}`); } @@ -164,13 +164,11 @@ const validateLegacyRequiredExternals = ({ const providedExternal = providedExternals && providedExternals[externalName]; if (!providedExternal) { - // eslint-disable-next-line max-len -- long message messages.push(`External '${externalName}' is required by ${moduleName}, but is not provided by the root module`); } else if (!validateExternal({ providedVersion: providedExternal.version, requestedRange: requestedExternalVersion, })) { - // eslint-disable-next-line max-len -- long message const failedExternalMessage = `${externalName}@${requestedExternalVersion} is required by ${moduleName}, but the root module provides ${providedExternal.version}`; if (process.env.ONE_DANGEROUSLY_ACCEPT_BREAKING_EXTERNALS) { // eslint-disable-next-line no-console -- console necissary for warning @@ -218,7 +216,6 @@ const validateRequiredExternals = ({ const fallbackBlockedByRootModule = !!providedExternal && !providedExternal.fallbackEnabled; if (!providedExternal) { - // eslint-disable-next-line max-len -- long message messages.push(`External '${externalName}' is required by ${moduleName}, but is not provided by the root module`); if (!enableUnlistedExternalFallbacks) { moduleCanBeSafelyLoaded = false; @@ -229,7 +226,6 @@ const validateRequiredExternals = ({ requestedRange: semanticRange, }) ) { - // eslint-disable-next-line max-len -- long message messages.push(`${externalName}@${semanticRange} is required by ${moduleName}, but the root module provides ${providedExternal.version}`); if (fallbackBlockedByRootModule) { diff --git a/packages/holocron/src/publicHolocronModule.jsx b/packages/holocron/src/publicHolocronModule.jsx index 0eed075..c31b0da 100644 --- a/packages/holocron/src/publicHolocronModule.jsx +++ b/packages/holocron/src/publicHolocronModule.jsx @@ -3,7 +3,7 @@ import { getModuleName } from './holocronModule'; // TODO remove this public holocronModule in next major version export default function holocronModule(holocronConfig = {}) { return function addHolocronConfig(WrappedComponent) { - // eslint-disable-next-line no-console, max-len -- console necissary for error logging + // eslint-disable-next-line no-console -- console necissary for error logging console.warn(`'holocronModule' has been deprecated in favor of the Holocron Config API. Please migrate to Holocron Config API in ${getModuleName(WrappedComponent)}.`); // Need to pass through to the new Holocron Config API // eslint-disable-next-line no-param-reassign -- reassign with new config api diff --git a/packages/holocron/src/updateModuleRegistry.js b/packages/holocron/src/updateModuleRegistry.js index 06574c1..db1cd7a 100644 --- a/packages/holocron/src/updateModuleRegistry.js +++ b/packages/holocron/src/updateModuleRegistry.js @@ -62,10 +62,10 @@ export default async function updateModuleRegistry({ const brokenUrl = nextModuleMap.modules[moduleName].node.url; if (currentModuleMap.modules && currentModuleMap.modules[moduleName]) { const previousUrl = currentModuleMap.modules[moduleName].node.url; - // eslint-disable-next-line no-console, max-len -- console necissary for error logging + // eslint-disable-next-line no-console -- console necissary for error logging console.error(`There was an error loading module ${moduleName} at ${brokenUrl}. Reverting back to ${previousUrl}`, e); } else { - // eslint-disable-next-line no-console, max-len -- console necissary for error logging + // eslint-disable-next-line no-console -- console necissary for error logging console.error(`There was an error loading module ${moduleName} at ${brokenUrl}. Ignoring ${moduleName} until next module map poll.`, e); } rejectedModules[moduleName] = {