Skip to content

Commit

Permalink
feat: update eslint + plugins + rule on types' import/export
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybarbet committed Feb 23, 2023
1 parent f964b39 commit 1051d11
Show file tree
Hide file tree
Showing 20 changed files with 724 additions and 557 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
"prettier"
],
"plugins": ["eslint-plugin-prefer-arrow", "@typescript-eslint", "simple-import-sort"],
"ignorePatterns": ["**/dist"],
"env": {
"es6": true,
"jest": true
},
"rules": {
"@typescript-eslint/consistent-type-exports": ["error", { "fixMixedExportsWithInlineTypeSpecifier": true }],
"@typescript-eslint/consistent-type-imports": ["error", { "fixStyle": "inline-type-imports" }],
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/interface-name-prefix": "off",
Expand Down
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"scripts": {
"build": "lerna run build",
"lint": "yarn lint:tsc && yarn lint:eslint && yarn lint:prettier",
"lint:ci": "yarn lint:eslint -f ./node_modules/@firmnav/eslint-github-actions-formatter/dist/formatter.js && yarn lint:prettier",
"lint:tsc": "lerna run lint:tsc",
"lint:eslint": "eslint --fix '**/*.ts'",
"lint:prettier": "prettier --write \"packages/**/*.{ts,json,md}\"",
Expand All @@ -18,18 +17,17 @@
"release:ci": "lerna publish --yes --no-private"
},
"devDependencies": {
"@firmnav/eslint-github-actions-formatter": "1.0.1",
"@typescript-eslint/eslint-plugin": "5.32.0",
"@typescript-eslint/parser": "5.32.0",
"@typescript-eslint/eslint-plugin": "5.53.0",
"@typescript-eslint/parser": "5.53.0",
"conventional-changelog-conventionalcommits": "5.0.0",
"eslint": "8.21.0",
"eslint-config-prettier": "8.5.0",
"eslint": "8.34.0",
"eslint-config-prettier": "8.6.0",
"eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-simple-import-sort": "7.0.0",
"eslint-plugin-simple-import-sort": "9.0.0",
"lerna": "5.3.0",
"nx": "14.5.2",
"patch-package": "6.4.7",
"prettier": "2.7.1",
"typescript": "4.7.4"
"prettier": "2.8.4",
"typescript": "4.9.5"
}
}
4 changes: 2 additions & 2 deletions packages/apple-api-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint:tsc": "yarn tsc -p tsconfig.json --noEmit --skipLibCheck"
},
"devDependencies": {
"@types/node": "18.6.3",
"typescript": "4.7.4"
"@types/node": "18.14.0",
"typescript": "4.9.5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @link https://developer.apple.com/documentation/appstorereceipts
*/

import { Environment } from './global.interface';
import { type Environment } from './global.interface';

type ValidReceipt = 0;

Expand Down
22 changes: 11 additions & 11 deletions packages/apple-api-types/src/app-store-server.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
*/

import {
AutoRenewStatus,
ExpirationIntent,
InAppOwnershipType,
NotificationSubtype,
NotificationType,
OfferType,
OrderLookupStatus,
PriceIncreaseStatus,
SubscriptionStatus,
Type,
type AutoRenewStatus,
type ExpirationIntent,
type InAppOwnershipType,
type NotificationSubtype,
type NotificationType,
type OfferType,
type OrderLookupStatus,
type PriceIncreaseStatus,
type SubscriptionStatus,
type Type,
} from './app-store-server.enum';
import { Environment } from './global.interface';
import { type Environment } from './global.interface';

/**
* @link https://developer.apple.com/documentation/appstoreserverapi/jwsdecodedheader
Expand Down
4 changes: 2 additions & 2 deletions packages/google-api-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint:tsc": "yarn tsc -p tsconfig.json --noEmit --skipLibCheck"
},
"devDependencies": {
"@types/node": "18.6.3",
"typescript": "4.7.4"
"@types/node": "18.14.0",
"typescript": "4.9.5"
}
}
2 changes: 1 addition & 1 deletion packages/google-api-types/src/rtdn.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @link https://developer.android.com/google/play/billing/rtdn-reference
*/

import { OneTimeProductNotificationType, SubscriptionNotificationType } from './rtdn.enum';
import { type OneTimeProductNotificationType, type SubscriptionNotificationType } from './rtdn.enum';

interface OneTimeProductNotification {
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/nest-iap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
},
"devDependencies": {
"@nestjs/common": "9.0.7",
"@types/node": "18.6.3",
"@types/node": "18.14.0",
"reflect-metadata": "0.1.13",
"rxjs": "7.5.6",
"typescript": "4.7.4"
"typescript": "4.9.5"
},
"peerDependencies": {
"@nestjs/common": "*"
Expand Down
4 changes: 2 additions & 2 deletions packages/nest-iap/src/iap.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DynamicModule, Module } from '@nestjs/common';
import { type DynamicModule, Module } from '@nestjs/common';

import { IAP_CONFIG, IAPConfig, IAPService } from './iap.service';
import { type IAPConfig, IAP_CONFIG, IAPService } from './iap.service';

@Module({})
export class IAPModule {
Expand Down
8 changes: 4 additions & 4 deletions packages/nest-iap/src/iap.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
AppleConfig,
AppleRequestBody,
GoogleConfig,
GoogleRequestBody,
type AppleConfig,
type AppleRequestBody,
type GoogleConfig,
type GoogleRequestBody,
verifyAppleReceipt,
verifyGoogleReceipt,
} from '@jeremybarbet/node-iap';
Expand Down
4 changes: 2 additions & 2 deletions packages/node-iap/example/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
type AppleVerifyResponse,
type GoogleVerifyResponse,
AppleEnvironment,
AppleVerifyResponse,
GoogleVerifyResponse,
verifyAppleReceipt,
verifyGoogleReceipt,
} from '../index';
Expand Down
26 changes: 13 additions & 13 deletions packages/node-iap/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { Environment as AppleEnvironment } from '@jeremybarbet/apple-api-types';
import {
AcknowledgePurchaseOrSubscription as GoogleAcknowledgePurchaseOrSubscription,
ProductPurchase as GoogleProductPurchase,
SubscriptionPurchase as GoogleSubscriptionPurchase,
type AcknowledgePurchaseOrSubscription as GoogleAcknowledgePurchaseOrSubscription,
type ProductPurchase as GoogleProductPurchase,
type SubscriptionPurchase as GoogleSubscriptionPurchase,
} from '@jeremybarbet/google-api-types';

import {
Config as AppleConfig,
DataResponse as AppleDataResponse,
RequestBody as AppleRequestBody,
StatusResponse as AppleStatusResponse,
type Config as AppleConfig,
type DataResponse as AppleDataResponse,
type RequestBody as AppleRequestBody,
type StatusResponse as AppleStatusResponse,
type VerifyResponse as AppleVerifyResponse,
verify as verifyAppleReceipt,
VerifyResponse as AppleVerifyResponse,
} from './src/apple';
import {
Config as GoogleConfig,
DataResponse as GoogleDataResponse,
RequestBody as GoogleRequestBody,
StatusResponse as GoogleStatusResponse,
type Config as GoogleConfig,
type DataResponse as GoogleDataResponse,
type RequestBody as GoogleRequestBody,
type StatusResponse as GoogleStatusResponse,
type VerifyResponse as GoogleVerifyResponse,
verify as verifyGoogleReceipt,
VerifyResponse as GoogleVerifyResponse,
} from './src/google';

export {
Expand Down
4 changes: 2 additions & 2 deletions packages/node-iap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"@jeremybarbet/google-api-types": "1.3.5"
},
"devDependencies": {
"@types/node": "18.6.3",
"@types/node": "18.14.0",
"axios": "0.27.2",
"google-auth-library": "8.1.1",
"ts-node": "10.9.1",
"typescript": "4.7.4"
"typescript": "4.9.5"
},
"peerDependencies": {
"axios": "*",
Expand Down
8 changes: 4 additions & 4 deletions packages/node-iap/src/apple/apple.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Environment, errors, ResponseBody } from '@jeremybarbet/apple-api-types';
import { type ResponseBody, Environment, errors } from '@jeremybarbet/apple-api-types';
import axios from 'axios';

import { ErrorResponse } from '../types/common';
import { type ErrorResponse } from '../types/common';

import { endpoints } from './apple.constants';
import { ErrorStatus, handleResponse } from './apple.utils';
import { Config, RequestBody, VerifyResponse } from './config.interface';
import { type ErrorStatus, handleResponse } from './apple.utils';
import { type Config, type RequestBody, type VerifyResponse } from './config.interface';

export const verify = async ({ transactionReceipt }: RequestBody, config: Config): Promise<VerifyResponse> => {
const { environment = Environment.PRODUCTION, password, excludeOldTransactions = true } = config;
Expand Down
2 changes: 1 addition & 1 deletion packages/node-iap/src/apple/apple.utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { errors, internalDataAccessErrors, ResponseBody, successes } from '@jeremybarbet/apple-api-types';
import { type ResponseBody, errors, internalDataAccessErrors, successes } from '@jeremybarbet/apple-api-types';

export type SuccessStatus = keyof typeof successes;
export type ErrorStatus = keyof typeof errors;
Expand Down
4 changes: 2 additions & 2 deletions packages/node-iap/src/apple/config.interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Environment, ResponseBody } from '@jeremybarbet/apple-api-types';
import { type Environment, type ResponseBody } from '@jeremybarbet/apple-api-types';

import { ErrorStatus, SuccessStatus } from './apple.utils';
import { type ErrorStatus, type SuccessStatus } from './apple.utils';

export interface Config {
/**
Expand Down
6 changes: 3 additions & 3 deletions packages/node-iap/src/google/config.interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
AcknowledgePurchaseOrSubscription,
ProductPurchase,
SubscriptionPurchase,
type AcknowledgePurchaseOrSubscription,
type ProductPurchase,
type SubscriptionPurchase,
} from '@jeremybarbet/google-api-types';

export interface Config {
Expand Down
10 changes: 5 additions & 5 deletions packages/node-iap/src/google/google.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
AcknowledgePurchaseOrSubscription,
ProductPurchase,
SubscriptionPurchase,
type AcknowledgePurchaseOrSubscription,
type ProductPurchase,
type SubscriptionPurchase,
} from '@jeremybarbet/google-api-types';
import { JWT } from 'google-auth-library';

import { ErrorResponse } from '../types/common';
import { type ErrorResponse } from '../types/common';

import { Config, RequestBody, VerifyResponse } from './config.interface';
import { type Config, type RequestBody, type VerifyResponse } from './config.interface';
import { buildEndpoint } from './google.utils';

const getResource = async <T = SubscriptionPurchase | ProductPurchase>(url: string, client: JWT) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/node-iap/src/google/google.utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RequestBody } from './config.interface';
import { type RequestBody } from './config.interface';
import { endpoints } from './google.constants';

const replaceInUrl = (url: string, extraReplace: [string, string], { packageName, token }: RequestBody) =>
Expand Down
Loading

0 comments on commit 1051d11

Please sign in to comment.