Skip to content

Commit

Permalink
fix(package): add linting for typescript files
Browse files Browse the repository at this point in the history
EME-5329

Co-authored-by: Gabor Nemeth <gabor.nemeth@emarsys.com>
  • Loading branch information
2 people authored and ngabor84 committed Sep 2, 2022
1 parent e1804d0 commit 122c473
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
7 changes: 6 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
"mocha": true,
"es6": true
},
"parser": "babel-eslint",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"impliedStrict": true
}
},
"globals": {
"expect": true
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Requests with Escher authentication",
"scripts": {
"test": "mocha --require ts-node/register ./src --recursive",
"lint": "eslint ./src",
"lint": "eslint ./src/**/*.{ts,js}",
"build": "rm -rf dist && tsc --project ./tsconfig.json",
"semantic-release": "CI=true semantic-release"
},
Expand Down Expand Up @@ -34,7 +34,7 @@
},
"devDependencies": {
"@types/node": "18.7.8",
"babel-eslint": "10.1.0",
"@typescript-eslint/parser": "5.35.1",
"chai": "4.3.6",
"chai-subset": "1.6.0",
"eslint": "7.21.0",
Expand Down
19 changes: 11 additions & 8 deletions src/escher-auth.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
declare module 'escher-auth' {
export type KeyDB = (key: string) => string;

export type EscherRequest = {
method: string;
host: string;
Expand All @@ -23,12 +21,17 @@ declare module 'escher-auth' {
} & Record<string, unknown>;

export default class Escher {
constructor(configToMerge?: Config);
// eslint-disable-next-line no-unused-vars
constructor(configToMerge: Config);
// eslint-disable-next-line no-unused-vars
static create(configToMerge?: Config): Escher;
public preSignUrl(url: string, expirationInSec: number): string;
public signRequest(requestOptions: ExtendedRequestOption, body?: string | Buffer, headersToSign?: string[]): EscherRequest;
public authenticate(request: EscherRequest, keyDb: KeyDB, mandatorySignedHeaders?: string[]): string;
public validateRequest(request: EscherRequest, body?: string | Buffer): void;
public validateMandatorySignedHeaders(mandatorySignedHeaders?: string[]): void;
public signRequest(
// eslint-disable-next-line no-unused-vars,no-undef
requestOptions: ExtendedRequestOption,
// eslint-disable-next-line no-unused-vars
body?: string | Buffer,
// eslint-disable-next-line no-unused-vars
headersToSign?: string[]
): EscherRequest;
}
}
1 change: 0 additions & 1 deletion src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { EscherRequestOption } from './requestOption';
export { EscherRequestOption } from './requestOption';
import { RequestWrapper, ExtendedRequestOption, TransformedResponse } from './wrapper';
export { TransformedResponse } from './wrapper';
import { EscherRequestError } from './requestError';
export { EscherRequestError } from './requestError';
import { createLogger } from '@emartech/json-logger';
const logger = createLogger('suiterequest');
Expand Down

0 comments on commit 122c473

Please sign in to comment.