Skip to content

Commit

Permalink
Enable eslint eqeqeq rule (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzyl authored Feb 15, 2024
1 parent e2964be commit 96085fa
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/basic/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import { fetchEmployeePageByAdUsernameAndLimit } from "./examples/fetchEmployeeP
import { fetchEmployeePageThin } from "./examples/fetchEmployeePageThin.js";
import { typeChecks } from "./typeChecks.js";

invariant(process.env.FOUNDRY_STACK != undefined);
invariant(process.env.FOUNDRY_USER_TOKEN != undefined);
invariant(process.env.FOUNDRY_STACK !== undefined);
invariant(process.env.FOUNDRY_USER_TOKEN !== undefined);

/**
* TLDR: If you're starting out, just use `client` and ignore ` clientCtx`.
Expand Down
2 changes: 2 additions & 0 deletions monorepo/eslint-config-sane/library.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ module.exports = {
rules: {
"@typescript-eslint/consistent-type-imports": "error",

eqeqeq: ["error", "always", { null: "never" }],

"header/header": [
2,
"block",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function legacyToModernSingleAggregationResult<
(accumulator, curValue) => {
const parts = curValue.name.split(".");
invariant(
parts.length == 2,
parts.length === 2,
"assumed we were getting a `${key}.${type}`",
);
if (!(parts[0] in accumulator)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function wireObjectTypeV2ToSdkObjectConst(
);

const imports = Array.from(uniqueLinkTargetTypes).filter(type =>
type != definition.apiName
type !== definition.apiName
).map(type => `import type { ${type}Def } from "./${type}${importExt}";`);

return `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function wireQueryDataTypeToQueryDataTypeDefinition<K extends string>(

// special case for a union where one half is nullable to skip the union step and just allow nulls directly
if (allowNulls && input.unionTypes.length === 2) {
const nonnull = input.unionTypes.find(t => t.type !== null);
const nonnull = input.unionTypes.find(t => t.type != null);
if (nonnull) {
return {
...wireQueryDataTypeToQueryDataTypeDefinition(nonnull),
Expand Down
4 changes: 2 additions & 2 deletions packages/legacy-client/src/client/net/getOnlyLinkedObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function getOnlyLinkedObject<
return result;
}

if (result.type == "ok" && result.value.length > 1) {
if (result.type === "ok" && result.value.length > 1) {
return createErrorResponse(
{
name: "Too many objects",
Expand All @@ -61,7 +61,7 @@ export async function getOnlyLinkedObject<
);
}

if (result.type == "ok" && result.value.length != 1) {
if (result.type === "ok" && result.value.length !== 1) {
return createErrorResponse(
{
name: "Object not found",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function createPrototype<
Object.defineProperty(proto, k, {
get: function() {
const client = this[OriginClient] as ClientContext<any>;
if (multiplicity == true) {
if (multiplicity === true) {
return createMultiLinkStep(
client,
objDef.apiName,
Expand Down
4 changes: 2 additions & 2 deletions packages/shared.test/src/handlers/loadObjectsEndpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ export const loadObjectsEndpoints: RestHandler<
}

const paginationParams = {
pageSize: req.url.searchParams.get("pageSize") === null
pageSize: req.url.searchParams.get("pageSize") == null
? undefined
: Number(req.url.searchParams.get("pageSize")),
pageToken: req.url.searchParams.get("pageToken") === null
pageToken: req.url.searchParams.get("pageToken") == null
? undefined
: (req.url.searchParams.get("pageToken") as string),
};
Expand Down

0 comments on commit 96085fa

Please sign in to comment.