Skip to content

Commit

Permalink
Enable some strict checks
Browse files Browse the repository at this point in the history
  • Loading branch information
gitKrystan committed Nov 15, 2023
1 parent ff5ac6c commit 93c38f4
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 16 deletions.
17 changes: 16 additions & 1 deletion config/eslint/typescript.cjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
function rules(config) {
return Object.assign(
{
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': false }],
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'no-loop-func': 'off',
'@typescript-eslint/no-loop-func': 'error',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'no-throw-literal': 'off',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-meaningless-void-operator': 'error',
'@typescript-eslint/no-throw-literal': 'error',
// Many failures for these; they seem intentional so I don't want to just auto-fix:
// '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
// '@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-includes': 'error',
// Auto-fix changes the types in some of these cases, which didn't seem safe:
// '@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
'@typescript-eslint/prefer-return-this-type': 'error',
'@typescript-eslint/prefer-ts-expect-error': 'error',
'prefer-const': 'error',
'prefer-rest-params': 'off',
Expand Down
2 changes: 1 addition & 1 deletion packages/graph/src/-private/-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function _deprecatedCompare<T>(
const finalState: T[] = [];

for (let i = 0, j = 0; i < iterationLength; i++) {
let adv: boolean = false;
let adv = false;
let member: T | undefined;

// accumulate anything added
Expand Down
2 changes: 1 addition & 1 deletion packages/graph/src/-private/-edge-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export function upgradeDefinition(
graph: Graph,
identifier: StableRecordIdentifier,
propertyName: string,
isImplicit: boolean = false
isImplicit = false
): EdgeDefinition | null {
const cache = graph._definitionCache;
const storeWrapper = graph.store;
Expand Down
2 changes: 1 addition & 1 deletion packages/graph/src/-private/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ export class Graph {
update(op: LocalRelationshipOperation, isRemote?: false): void;
update(
op: MergeOperation | LocalRelationshipOperation | RemoteRelationshipOperation | UnknownOperation,
isRemote: boolean = false
isRemote = false
): void {
assert(
`Cannot update an implicit relationship`,
Expand Down
4 changes: 2 additions & 2 deletions packages/graph/src/-private/operations/update-relationship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default function updateRelationshipOperation(graph: Graph, op: UpdateRela

const payload = op.value;

let hasRelationshipDataProperty: boolean = false;
let hasUpdatedLink: boolean = false;
let hasRelationshipDataProperty = false;
let hasUpdatedLink = false;

if (payload.meta) {
relationship.meta = payload.meta;
Expand Down
2 changes: 1 addition & 1 deletion packages/json-api/src/-private/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ function _isEmpty(peeked: CachedResource | undefined): boolean {
return (!isNew || isDeleted) && isEmpty;
}

function recordIsLoaded(cached: CachedResource | undefined, filterDeleted: boolean = false): boolean {
function recordIsLoaded(cached: CachedResource | undefined, filterDeleted = false): boolean {
if (!cached) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,13 +585,13 @@ function _flushPendingFetchForType(
_processCoalescedGroup(store, fetchMap, groups[i], adapter, modelName);
}
} else if (totalItems === 1) {
void _fetchRecord(store, adapter, pendingFetchItems[0]);
_fetchRecord(store, adapter, pendingFetchItems[0]);
}
}

pendingFetchMap.forEach((pendingFetchItems) => {
pendingFetchItems.forEach((pendingFetchItem) => {
void _fetchRecord(store, adapter, pendingFetchItem);
_fetchRecord(store, adapter, pendingFetchItem);
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/request/src/-private/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class ContextOwner {
response: ResponseInfo | null = null;
declare request: ImmutableRequestInfo;
declare enhancedRequest: ImmutableRequestInfo;
nextCalled: number = 0;
nextCalled = 0;
declare god: GodContext;
declare controller: AbortController;
declare requestId: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/store/src/-private/caches/instance-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class InstanceCache {
return reference;
}

recordIsLoaded(identifier: StableRecordIdentifier, filterDeleted: boolean = false) {
recordIsLoaded(identifier: StableRecordIdentifier, filterDeleted = false) {
const cache = this.cache;
if (!cache) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export default class NotificationManager {
}
buffer.push([value, key]);

void this._scheduleNotify();
this._scheduleNotify();
}

return hasSubscribers;
Expand Down
8 changes: 4 additions & 4 deletions packages/store/src/-private/record-arrays/identifier-array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ class IdentifierArray {
@type Boolean
*/
declare isUpdating: boolean;
isLoaded: boolean = true;
isDestroying: boolean = false;
isDestroyed: boolean = false;
isLoaded = true;
isDestroying = false;
isDestroyed = false;
_updatingPromise: Promise<IdentifierArray> | null = null;

[IS_COLLECTION] = true;
Expand Down Expand Up @@ -216,7 +216,7 @@ class IdentifierArray {
links: options.links || null,
meta: options.meta || null,
};
let transaction: boolean = false;
let transaction = false;

// when a mutation occurs
// we track all mutations within the call
Expand Down

0 comments on commit 93c38f4

Please sign in to comment.