diff --git a/tests/main/.eslintrc.cjs b/tests/main/.eslintrc.cjs index d684313d796..fea89270c47 100644 --- a/tests/main/.eslintrc.cjs +++ b/tests/main/.eslintrc.cjs @@ -27,7 +27,28 @@ module.exports = { overrides: [ node.config(), node.defaults(), + typescript.defaults(), + // files converted to strict must pass these rules before they can be removed from + // the files list here + // see https://github.com/emberjs/data/issues/6233#issuecomment-849279594 typescript.defaults({ + files: [ + './tests/helpers/accessors.ts', + './tests/integration/identifiers/configuration-test.ts', + './tests/integration/identifiers/lid-reflection-test.ts', + './tests/integration/identifiers/new-records-test.ts', + './tests/integration/identifiers/polymorphic-scenarios-test.ts', + './tests/integration/identifiers/record-identifier-for-test.ts', + './tests/integration/identifiers/scenarios-test.ts', + './tests/integration/model-errors-test.ts', + './tests/integration/record-data/record-data-errors-test.ts', + './tests/integration/record-data/record-data-state-test.ts', + './tests/integration/record-data/record-data-test.ts', + './tests/integration/record-data/store-wrapper-test.ts', + './tests/integration/relationships/rollback-test.ts', + './tests/integration/request-state-service-test.ts', + './tests/unit/custom-class-support/custom-class-model-test.ts', + ], rules: { '@typescript-eslint/no-unsafe-assignment': 'off', '@typescript-eslint/no-unsafe-call': 'off', diff --git a/tests/main/tests/integration/identifiers/scenarios-test.ts b/tests/main/tests/integration/identifiers/scenarios-test.ts index 6a736aa9f96..7ac690d5a3a 100644 --- a/tests/main/tests/integration/identifiers/scenarios-test.ts +++ b/tests/main/tests/integration/identifiers/scenarios-test.ts @@ -1,4 +1,3 @@ - import EmberObject, { set } from '@ember/object'; import { module, test } from 'qunit'; @@ -16,12 +15,7 @@ import { setIdentifierUpdateMethod, } from '@ember-data/store'; import type { GenerationMethod, ResourceData } from '@ember-data/store/-types/q/identifier'; -import type { - Identifier, - IdentifierBucket, - StableIdentifier, - StableRecordIdentifier, -} from '@warp-drive/core-types/identifier'; +import type { IdentifierBucket, StableIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier'; function isNonEmptyString(str: unknown): str is string { return typeof str === 'string' && str.length > 0; @@ -35,17 +29,14 @@ module('Integration | Identifiers - scenarios', function (hooks) { setupTest(hooks); module('Secondary Cache based on an attribute', function (innerHooks) { - const calls = { - findRecord: 0, - queryRecord: 0, - }; + let calls; let isQuery = false; let secondaryCache: { id: { [key: string]: string }; username: { [key: string]: string }; }; class TestSerializer extends EmberObject { - normalizeResponse(_, __, payload: unknown) { + normalizeResponse(_, __, payload) { return payload; } } @@ -93,10 +84,15 @@ module('Integration | Identifiers - scenarios', function (hooks) { owner.register('serializer:application', TestSerializer); owner.register('model:user', User); + calls = { + findRecord: 0, + queryRecord: 0, + }; + let localIdInc = 9000; secondaryCache = { - id: Object.create(null) as Record, - username: Object.create(null) as Record, + id: Object.create(null), + username: Object.create(null), }; const generationMethod: GenerationMethod = (resource: unknown, bucket: IdentifierBucket) => { if (bucket !== 'record') { @@ -246,14 +242,11 @@ module('Integration | Identifiers - scenarios', function (hooks) { }); module('Secondary Cache using an attribute as an alternate id', function (innerHooks) { - const calls = { - findRecord: 0, - queryRecord: 0, - }; + let calls; let isQuery = false; let secondaryCache: { [key: string]: string }; class TestSerializer extends EmberObject { - normalizeResponse(_, __, payload: unknown) { + normalizeResponse(_, __, payload) { return payload; } } @@ -301,8 +294,13 @@ module('Integration | Identifiers - scenarios', function (hooks) { owner.register('serializer:application', TestSerializer); owner.register('model:user', User); + calls = { + findRecord: 0, + queryRecord: 0, + }; + let localIdInc = 9000; - secondaryCache = Object.create(null) as Record; + secondaryCache = Object.create(null); function lidForUser(resource: ResourceData | { type: string }): string { if ('type' in resource && resource.type === 'user') { @@ -661,7 +659,7 @@ module('Integration | Identifiers - scenarios', function (hooks) { }); }; - function updateUsernameCache(identifier: Identifier, oldUsername: string, newUsername: string) { + function updateUsernameCache(identifier, oldUsername, newUsername) { if (secondaryCache[oldUsername] !== identifier.lid) { throw new Error(`Incorrect username update`); } @@ -670,7 +668,7 @@ module('Integration | Identifiers - scenarios', function (hooks) { } secondaryCache[newUsername] = identifier.lid; } - function commitUsernameUpdate(identifier: Identifier, oldUsername: string, newUsername: string) { + function commitUsernameUpdate(identifier, oldUsername, newUsername) { if (secondaryCache[oldUsername] === identifier.lid) { delete secondaryCache[oldUsername]; }