Skip to content
Open
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
60 changes: 0 additions & 60 deletions eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2466,66 +2466,6 @@
"count": 1
}
},
"packages/permission-controller/src/Caveat.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 9
}
},
"packages/permission-controller/src/Caveat.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 1
}
},
"packages/permission-controller/src/PermissionController.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 57
},
"no-new": {
"count": 1
}
},
"packages/permission-controller/src/PermissionController.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 8
},
"@typescript-eslint/prefer-enum-initializers": {
"count": 4
},
"no-restricted-syntax": {
"count": 25
}
},
"packages/permission-controller/src/SubjectMetadataController.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 2
}
},
"packages/permission-controller/src/SubjectMetadataController.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 1
},
"@typescript-eslint/prefer-nullish-coalescing": {
"count": 4
},
"no-restricted-syntax": {
"count": 4
}
},
"packages/permission-controller/src/errors.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 3
}
},
"packages/permission-controller/src/rpc-methods/requestPermissions.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 1
}
},
"packages/permission-controller/src/utils.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 1
}
},
"packages/permission-log-controller/src/PermissionLogController.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 4
Expand Down
18 changes: 9 additions & 9 deletions packages/permission-controller/src/Caveat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import * as errors from './errors';

describe('decorateWithCaveats', () => {
it('decorates a method with caveat', async () => {
const methodImplementation = () => [1, 2, 3];
const methodImplementation = (): number[] => [1, 2, 3];

const caveatSpecifications = {
reverse: {
type: 'reverse',
decorator:
(method: () => Promise<unknown[]>, _caveat: Caveat<string, null>) =>
async () => {
async (): Promise<unknown[]> => {
return (await method()).reverse();
},
},
Expand Down Expand Up @@ -41,22 +41,22 @@ describe('decorateWithCaveats', () => {
});

it('decorates a method with multiple caveats', async () => {
const methodImplementation = () => [1, 2, 3];
const methodImplementation = (): number[] => [1, 2, 3];

const caveatSpecifications = {
reverse: {
type: 'reverse',
decorator:
(method: () => Promise<unknown[]>, _caveat: Caveat<string, null>) =>
async () => {
async (): Promise<unknown[]> => {
return (await method()).reverse();
},
},
slice: {
type: 'slice',
decorator:
(method: () => Promise<unknown[]>, caveat: Caveat<string, number>) =>
async () => {
async (): Promise<unknown[]> => {
return (await method()).slice(0, caveat.value);
},
},
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('decorateWithCaveats', () => {
});

it('returns the unmodified method implementation if there are no caveats', () => {
const methodImplementation = () => [1, 2, 3];
const methodImplementation = (): number[] => [1, 2, 3];

const permission: PermissionConstraint = {
id: 'foo',
Expand All @@ -109,14 +109,14 @@ describe('decorateWithCaveats', () => {
});

it('throws an error if the caveat type is unrecognized', () => {
const methodImplementation = () => [1, 2, 3];
const methodImplementation = (): number[] => [1, 2, 3];

const caveatSpecifications = {
reverse: {
type: 'reverse',
decorator:
(method: () => Promise<unknown[]>, _caveat: Caveat<string, null>) =>
async () => {
async (): Promise<unknown[]> => {
return (await method()).reverse();
},
},
Expand Down Expand Up @@ -144,7 +144,7 @@ describe('decorateWithCaveats', () => {
});

it('throws an error if no decorator is present', async () => {
const methodImplementation = () => [1, 2, 3];
const methodImplementation = (): number[] => [1, 2, 3];

const caveatSpecifications = {
reverse: {
Expand Down
2 changes: 1 addition & 1 deletion packages/permission-controller/src/Caveat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export function decorateWithCaveats<

let decorated = async (
args: Parameters<RestrictedMethod<RestrictedMethodParameters, Json>>[0],
) => methodImplementation(args);
): Promise<Json> => methodImplementation(args);

for (const caveat of caveats) {
const specification =
Expand Down
Loading
Loading