Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJem committed Oct 21, 2022
1 parent 20fbdad commit e0d43ac
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 19 deletions.
47 changes: 47 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
module.exports = {
env: {
node: true,
jest: true,
browser: false,
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
sourceType: "module",
ecmaFeatures: {
jsx: false,
},
},
extends: [
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
],
plugins: ["@typescript-eslint", "simple-import-sort", "unused-imports"],
rules: {
"prettier/prettier": ["error"],
"import/prefer-default-export": "off",
"prefer-destructuring": "off",
"prefer-template": "off",
"no-console": "off",
"no-underscore-dangle": "off",
"no-nested-ternary": "off",
"no-restricted-syntax": "off",
"no-plusplus": "off",
"simple-import-sort/imports": "error",
"unused-imports/no-unused-imports": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-ts-ignore": "off",
},
ignorePatterns: ["build", "node_modules"],
overrides: [
{
files: ["**/*.js", "**/*.jsx"],
rules: {
"no-undef": "error",
},
},
],
};
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"printWidth": 120,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "all"
}
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"recommendations": [
"hashicorp.terraform",
"rvest.vs-code-prettier-eslint",
"dbaeumer.vscode-eslint",
"mquandalle.graphql",
Expand Down
22 changes: 13 additions & 9 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as pulumi from "@pulumi/pulumi";

import { handler } from "./src";

const GCP_REGION = "us-central1";
Expand All @@ -11,21 +12,24 @@ const BUCKET_NAME = `olympusdao-subgraph-cache-${pulumi.getStack()}`;

// Create a bucket to store the cached results
const storageBucket = new gcp.storage.Bucket(BUCKET_NAME, {
location: GCP_REGION,
uniformBucketLevelAccess: true,
versioning: { enabled: false },
location: GCP_REGION,
uniformBucketLevelAccess: true,
versioning: { enabled: false },
});

// Export the DNS name of the bucket
export const storageBucketName = storageBucket.url;

// Create a function
const tokenHolderFunction = new gcp.cloudfunctions.HttpCallbackFunction("token-holders", {
runtime: "nodejs14",
region: GCP_REGION,
callback: (_req: Express.Request, res: Express.Response) => {
handler();
},
runtime: "nodejs14",
region: GCP_REGION,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
callback: (req: Express.Request, res: Express.Response) => {
handler();
},
});

export const functionUrl = tokenHolderFunction.httpsTriggerUrl;

// TODO set up scheduling
18 changes: 9 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export type HandlerResult = {
status: number;
message: string;
}
status: number;
message: string;
};

export const handler = (): HandlerResult => {
console.log("etc etc");
console.log("etc etc");

return {
status: 200,
message: "",
}
}
return {
status: 200,
message: "",
};
};

0 comments on commit e0d43ac

Please sign in to comment.