@forge/lint
5.19.25.19.2-experimental-04cc2b9
out/lint/linters/storage-module-linter/storage-module-linter.js~
out/lint/linters/storage-module-linter/storage-module-linter.jsModified+21−20
Index: package/out/lint/linters/storage-module-linter/storage-module-linter.js
===================================================================
--- package/out/lint/linters/storage-module-linter/storage-module-linter.js
+++ package/out/lint/linters/storage-module-linter/storage-module-linter.js
@@ -20,30 +20,31 @@
const OBJECT_STORE_MODULE = 'objectStore';
const fixMissingModules = async (errors, warnings, state) => {
const currentModules = (await state.configFile.readConfig())?.modules ?? {};
const modulesToAdd = {};
- if (warnings.length) {
- const missingSQLModule = warnings.find((warning) => warning.metadata?.missingStorageModule === SQL_MODULE);
- const missingOsModule = warnings.find((warning) => warning.metadata?.missingStorageModule === OBJECT_STORE_MODULE);
- if (missingSQLModule && !currentModules.sql) {
- modulesToAdd.sql = [
- {
- key: 'db',
- engine: SqlEngine.mysql
- }
- ];
- }
- if (missingOsModule && !currentModules.objectStore) {
- modulesToAdd.objectStore = [
- {
- key: 'os',
- storageClass: ObjectStoreClass.standard
- }
- ];
- }
+ const missingSQLModule = errors.find((error) => error.metadata?.missingStorageModule === SQL_MODULE);
+ const missingOsModule = warnings.find((warning) => warning.metadata?.missingStorageModule === OBJECT_STORE_MODULE);
+ if (missingSQLModule && !currentModules.sql) {
+ modulesToAdd.sql = [
+ {
+ key: 'db',
+ engine: SqlEngine.mysql
+ }
+ ];
+ state.errorsFixed += 1;
+ }
+ if (missingOsModule && !currentModules.objectStore) {
+ modulesToAdd.objectStore = [
+ {
+ key: 'os',
+ storageClass: ObjectStoreClass.standard
+ }
+ ];
+ state.warningsFixed += 1;
+ }
+ if (Object.keys(modulesToAdd).length) {
const newModules = { ...currentModules, ...modulesToAdd };
await state.configFile.writeToConfigFile('modules', newModules);
- state.warningsFixed += Object.keys(modulesToAdd).length;
}
return state;
};
exports.fixMissingModules = fixMissingModules;