Skip to content

Commit

Permalink
Upgrade prettier and eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
dmattia authored Dec 4, 2023
1 parent 5b5ee0d commit ae51746
Show file tree
Hide file tree
Showing 54 changed files with 494 additions and 457 deletions.
5 changes: 0 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ module.exports = {

/**
* We prefer to use types instead of interfaces
*
* @see https://www.notion.so/transcend/Use-Type-instead-of-Interface-b3868d0885724b6894647018323a57b2
*/
'@typescript-eslint/prefer-interface': 0,
Expand All @@ -98,7 +97,6 @@ module.exports = {

/**
* We use a custom pre-commit for import orders
*
* @see pre_commit_hooks/ordered_imports.js
*/
'import/order': 0,
Expand Down Expand Up @@ -144,22 +142,19 @@ module.exports = {

/**
* Type signatures should be combined if possible:
*
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unified-signatures.md
*/
'@typescript-eslint/unified-signatures': ['error'],

/**
* Group overrides next to each other
*
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md
*/
'@typescript-eslint/adjacent-overload-signatures': ['error'],

/**
* Explicitly specify return types to functions. This improves type safety
* and also allows compiler to optimize
*
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
* @see https://www.notion.so/transcend/4ef10ad243b746d9b2a84f8bb4a1b01a?v=8eb2ce8c21d54b43a916e7f93a563950&p=36b3bd33e054443084d2759537e6423b
*/
Expand Down
496 changes: 270 additions & 226 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/glob-npm-7.2.3-2d866d17a5-59452a9202.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@
"devDependencies": {
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@yarnpkg/pnpify": "^4.0.1",
"@yarnpkg/sdks": "^3.1.0",
"chai": "^4.3.10",
"depcheck": "^1.4.7",
"eslint": "^8.55.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jsdoc": "^37.9.7",
"eslint-plugin-jsdoc": "^46.9.0",
"mocha": "^10.2.0",
"prettier": "^2.8.8",
"prettier": "^3.1.0",
"ts-node": "^10.9.1",
"typescript": "~5.3.2"
},
Expand Down
8 changes: 0 additions & 8 deletions src/Secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class Secret<T> {

/**
* Constructor
*
* @param value - The secret value
*/
constructor(value: T) {
Expand All @@ -26,7 +25,6 @@ export class Secret<T> {
* Ensure secrets are not coerced to their secret values.
*
* toJSON is called in cases like JSON.stringify(obj)
*
* @returns a redacted message
*/
public toJSON(): string {
Expand All @@ -35,7 +33,6 @@ export class Secret<T> {

/**
* Ensure secrets are not coerced to their secret values.
*
* @returns a redacted message
*/
public valueOf(): string {
Expand All @@ -46,7 +43,6 @@ export class Secret<T> {
* Ensure secrets are not coerced to their secret values.
*
* This is the method used by `console.log` on objects
*
* @returns a redacted message
*/
[Symbol.for('nodejs.util.inspect.custom')](): string {
Expand All @@ -55,7 +51,6 @@ export class Secret<T> {

/**
* Ensure secrets are not coerced to their secret values.
*
* @returns a redacted message
*/
public toLocaleString(): string {
Expand All @@ -64,7 +59,6 @@ export class Secret<T> {

/**
* Ensure secrets are not coerced to their secret values.
*
* @returns a redacted message
*/
public toString(): string {
Expand All @@ -74,7 +68,6 @@ export class Secret<T> {

/**
* Releases the secret for usage
*
* @returns the secret value
*/
public release(): T {
Expand All @@ -83,7 +76,6 @@ export class Secret<T> {

/**
* Apply a function to the secret value, and returns a new Secret with that value.
*
* @param transformFunc - Function to apply to the current value
* @returns the new secret for chaining other commands
*/
Expand Down
29 changes: 16 additions & 13 deletions src/secretValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,25 @@ import { decodeCodec } from '@transcend-io/type-utils';
*
* ```ts
* public toContext(): { user: UserLogContext; } {
* return {
* user: {
* id: this.id,
* name: new Secret(this.name),
* email: new Secret(this.email),
* },
* };
* return {
* user: {
* id: this.id,
* name: new Secret(this.name),
* email: new Secret(this.email),
* },
* };
* }
* ```
*
* and set the codec to be : secretValue:
*
* ```
* export const UserLogContext = t.type({
* id: dbModelId('user'),
* email: secretValue(t.string),
* name: secretValue(t.string),
* id: dbModelId('user'),
* email: secretValue(t.string),
* name: secretValue(t.string),
* });
* ```
*
* ```
* @param underlyingType - The underlying type of secret
* @returns The secret instance
*/
Expand All @@ -44,7 +43,11 @@ export function secretValue<T extends t.Any>(
typeof x === 'object' &&
!!x &&
x.constructor.name === 'Secret' &&
!!decodeCodec(underlyingType as any, (x as Secret<t.TypeOf<T>>).release()),
!!decodeCodec(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
underlyingType as any,
(x as Secret<t.TypeOf<T>>).release(),
),
(u, c) =>
pipe(
t.object.validate(u, c),
Expand Down
1 change: 0 additions & 1 deletion src/wrapSecrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Secretify, Secret } from './Secret';

/**
* Utility function to wrap values of an object as secrets
*
* @param obj - The object to modify
* @param secretKeys - The keys of the object that should be secrets
* @returns The object with values wrapped as secrets
Expand Down
Loading

0 comments on commit ae51746

Please sign in to comment.