Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ module.exports = {
"require-atomic-updates": "off", // This rule is so noisy and isn't useful: https://github.com/eslint/eslint/issues/11899
"require-jsdoc": "off", // This rule is deprecated and superseded by jsdoc/require-jsdoc.
"valid-jsdoc": "off", // This is deprecated but included in recommended configs.

"brikke/no-undeclared-imports": [
"error",
{
excludedFilePatterns: ["**/scripts/**/*", `update-notifier-cjs.d.ts`],
excludedModules: [
/node:/,
"express-serve-static-core", // We rely on just the types, and the package breaks our build.
],
},
],
"no-prototype-builtins": "warn", // TODO(bkendall): remove, allow to error.
"no-useless-escape": "warn", // TODO(bkendall): remove, allow to error.
"prefer-promise-reject-errors": "warn", // TODO(bkendall): remove, allow to error.
Expand Down Expand Up @@ -107,7 +116,7 @@ module.exports = {
sourceType: "module",
warnOnUnsupportedTypeScriptVersion: false,
},
plugins: ["prettier", "@typescript-eslint", "jsdoc"],
plugins: ["prettier", "@typescript-eslint", "jsdoc", "brikke"],
settings: {
jsdoc: {
tagNamePreference: {
Expand Down
37 changes: 31 additions & 6 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
"eslint": "^8.56.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-brikke": "^2.2.2",
"eslint-plugin-jsdoc": "^48.0.1",
"eslint-plugin-prettier": "^5.1.3",
"firebase": "^9.16.0",
Expand All @@ -240,6 +241,7 @@
"nyc": "^15.1.0",
"openapi-merge": "^1.0.23",
"openapi-typescript": "^4.5.0",
"openapi3-ts": "^3.2.0",
"prettier": "^3.2.4",
"proxy": "^1.0.2",
"puppeteer": "^19.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/emulator/storage/apis/gcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import { Upload, UploadNotActiveError } from "../upload";
import { ForbiddenError, NotFoundError } from "../errors";
import { reqBodyToBuffer } from "../../shared/request";
import { Query } from "express-serve-static-core";
import type { Query } from "express-serve-static-core";

export function createCloudEndpoints(emulator: StorageEmulator): Router {

Check warning on line 21 in src/emulator/storage/apis/gcloud.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
// eslint-disable-next-line new-cap
const gcloudStorageAPI = Router();
// Use Admin StorageLayer to ensure Firebase Rules validation is skipped.
Expand All @@ -44,11 +44,11 @@
}

const resJson = res.json.bind(res);
res.json = (...args: any[]) => {

Check warning on line 47 in src/emulator/storage/apis/gcloud.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
console.log("-- response:");
args.forEach((data) => console.log(JSON.stringify(data, undefined, 2)));

return resJson.call(res, ...args);

Check warning on line 51 in src/emulator/storage/apis/gcloud.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe spread of an `any` array type
};

const resSendStatus = res.sendStatus.bind(res);
Expand Down Expand Up @@ -77,7 +77,7 @@
next();
});

gcloudStorageAPI.get("/b", async (req, res) => {

Check warning on line 80 in src/emulator/storage/apis/gcloud.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promise returned in function argument where a void return was expected
res.json({
kind: "storage#buckets",
items: await adminStorageLayer.listBuckets(),
Expand All @@ -90,7 +90,7 @@
"/download/storage/v1/b/:bucketId/o/:objectId",
"/storage/v1/b/:bucketId/o/:objectId",
],
async (req, res) => {

Check warning on line 93 in src/emulator/storage/apis/gcloud.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promise returned in function argument where a void return was expected
let getObjectResponse: GetObjectResponse;
try {
getObjectResponse = await adminStorageLayer.getObject({
Expand All @@ -114,7 +114,7 @@
},
);

gcloudStorageAPI.patch("/b/:bucketId/o/:objectId", async (req, res) => {

Check warning on line 117 in src/emulator/storage/apis/gcloud.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promise returned in function argument where a void return was expected
let updatedMetadata: StoredFileMetadata;
try {
updatedMetadata = await adminStorageLayer.updateObjectMetadata({
Expand All @@ -134,7 +134,7 @@
return res.json(new CloudStorageObjectMetadata(updatedMetadata));
});

gcloudStorageAPI.get(["/b/:bucketId/o", "/storage/v1/b/:bucketId/o"], async (req, res) => {

Check warning on line 137 in src/emulator/storage/apis/gcloud.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promise returned in function argument where a void return was expected
let listResponse: ListObjectsResponse;
// TODO validate that all query params are single strings and are not repeated.
try {
Expand Down Expand Up @@ -162,7 +162,7 @@

gcloudStorageAPI.delete(
["/b/:bucketId/o/:objectId", "/storage/v1/b/:bucketId/o/:objectId"],
async (req, res) => {

Check warning on line 165 in src/emulator/storage/apis/gcloud.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promise returned in function argument where a void return was expected
try {
await adminStorageLayer.deleteObject({
bucketId: req.params.bucketId,
Expand All @@ -181,7 +181,7 @@
},
);

gcloudStorageAPI.put("/upload/storage/v1/b/:bucketId/o", async (req, res) => {

Check warning on line 184 in src/emulator/storage/apis/gcloud.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promise returned in function argument where a void return was expected
if (!req.query.upload_id) {
res.sendStatus(400);
return;
Expand Down Expand Up @@ -213,7 +213,7 @@
return res.json(new CloudStorageObjectMetadata(metadata));
});

gcloudStorageAPI.post("/b/:bucketId/o/:objectId/acl", async (req, res) => {

Check warning on line 216 in src/emulator/storage/apis/gcloud.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promise returned in function argument where a void return was expected
// TODO(abehaskins) Link to a doc with more info
EmulatorLogger.forEmulator(Emulators.STORAGE).log(
"WARN_ONCE",
Expand Down
Loading