Skip to content

Commit

Permalink
Merge branch 'next' into infra/unicorn/prefer-export-from
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Nov 21, 2024
2 parents 09d0e8f + 56acea3 commit 24ff9bb
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 88 deletions.
1 change: 1 addition & 0 deletions .github/workflows/check-mergable-by-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ permissions: {}
jobs:
fail-by-blocking-label:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'merge_group' }}
steps:
- name: Check for blocking labels
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
name: Semantic Pull Request
if: ${{ github.event_name != 'merge_group' }}
steps:
- name: Validate PR title
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
Expand Down
8 changes: 3 additions & 5 deletions scripts/apidocs/processing/method.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import type {
ClassDeclaration,
ConstructorDeclaration,
FunctionDeclaration,
InterfaceDeclaration,
MethodDeclaration,
MethodSignature,
Project,
} from 'ts-morph';
import {
SyntaxKind,
type ConstructorDeclaration,
type MethodDeclaration,
} from 'ts-morph';
import { SyntaxKind } from 'ts-morph';
import { groupBy } from '../../../src/internal/group-by';
import { newProcessingError } from './error';
import type {
Expand Down
4 changes: 3 additions & 1 deletion scripts/apidocs/processing/parameter.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type {
JSDoc,
JSDocTag,
ParameterDeclaration,
PropertySignature,
Symbol,
Type,
TypeParameterDeclaration,
} from 'ts-morph';
import { type JSDoc, type JSDocTag, type ParameterDeclaration } from 'ts-morph';
import { exactlyOne, valueForKey } from '../utils/value-checks';
import { newProcessingError } from './error';
import {
Expand Down
10 changes: 4 additions & 6 deletions src/modules/word/filter-word-list-by-length.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ const STRATEGIES = {
'any-length': (wordList: ReadonlyArray<string>): string[] => {
return [...wordList];
},
} as const; /*
satisfies Record<
string, // Parameters<filterWordListByLength>[0]['strategy']
(wordList: string[], length: { min: number; max: number }) => string[]
} satisfies Record<
NonNullable<Parameters<typeof filterWordListByLength>[0]['strategy']>,
(wordList: string[], length: { min: number; max: number }) => string[]
>;
*/

/**
* Filters a string array for values with a matching length.
Expand All @@ -70,7 +68,7 @@ export function filterWordListByLength(options: {
}): string[] {
const { wordList, length, strategy = 'any-length' } = options;

if (length) {
if (length != null) {
const filter: (word: string) => boolean =
typeof length === 'number'
? (word) => word.length === length
Expand Down
12 changes: 6 additions & 6 deletions test/modules/commerce.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import validator from 'validator';
import { isISBN } from 'validator';
import { describe, expect, it } from 'vitest';
import { faker } from '../../src';
import { seededTests } from '../support/seeded-runs';
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('commerce', () => {
isbn,
'The expected match should be ISBN-13 with hyphens'
).toMatch(/^978-[01]-[\d-]{9}-\d$/);
expect(isbn).toSatisfy((isbn: string) => validator.isISBN(isbn, 13));
expect(isbn).toSatisfy((isbn: string) => isISBN(isbn, 13));
});

it('should return ISBN-10 with hyphen separators when passing variant 10 as argument', () => {
Expand All @@ -214,7 +214,7 @@ describe('commerce', () => {
isbn,
'The expected match should be ISBN-10 with hyphens'
).toMatch(/^[01]-[\d-]{9}-[\dX]$/);
expect(isbn).toSatisfy((isbn: string) => validator.isISBN(isbn, 10));
expect(isbn).toSatisfy((isbn: string) => isISBN(isbn, 10));
});

it('should return ISBN-13 with hyphen separators when passing variant 13 as argument', () => {
Expand All @@ -224,7 +224,7 @@ describe('commerce', () => {
isbn,
'The expected match should be ISBN-13 with hyphens'
).toMatch(/^978-[01]-[\d-]{9}-\d$/);
expect(isbn).toSatisfy((isbn: string) => validator.isISBN(isbn, 13));
expect(isbn).toSatisfy((isbn: string) => isISBN(isbn, 13));
});

it('should return ISBN-10 with space separators when passing variant 10 and space separators as argument', () => {
Expand All @@ -234,7 +234,7 @@ describe('commerce', () => {
isbn,
'The expected match should be ISBN-10 with space separators'
).toMatch(/^[01] [\d ]{9} [\dX]$/);
expect(isbn).toSatisfy((isbn: string) => validator.isISBN(isbn, 10));
expect(isbn).toSatisfy((isbn: string) => isISBN(isbn, 10));
});

it('should return ISBN-13 with space separators when passing space separators as argument', () => {
Expand All @@ -244,7 +244,7 @@ describe('commerce', () => {
isbn,
'The expected match should be ISBN-13 with space separators'
).toMatch(/^978 [01] [\d ]{9} \d$/);
expect(isbn).toSatisfy((isbn: string) => validator.isISBN(isbn, 13));
expect(isbn).toSatisfy((isbn: string) => isISBN(isbn, 13));
});
});
}
Expand Down
16 changes: 8 additions & 8 deletions test/modules/finance-iban.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import validator from 'validator';
import { isIBAN } from 'validator';
import { describe, expect, it } from 'vitest';
import { faker } from '../../src';
import { prettyPrintIban } from '../../src/modules/finance';
Expand All @@ -17,7 +17,7 @@ describe('finance_iban', () => {
});

expect(actual).toMatch(new RegExp(`^${country}`));
expect(actual).toSatisfy(validator.isIBAN);
expect(actual).toSatisfy(isIBAN);
});
});

Expand All @@ -41,7 +41,7 @@ describe('finance_iban', () => {
countryCode: 'GE',
});

expect(iban).toSatisfy(validator.isIBAN);
expect(iban).toSatisfy(isIBAN);

const ibanFormatted = prettyPrintIban(iban);
const bban = iban.substring(4) + iban.substring(0, 4);
Expand Down Expand Up @@ -104,7 +104,7 @@ describe('finance_iban', () => {
countryCode: 'PK',
});

expect(iban).toSatisfy(validator.isIBAN);
expect(iban).toSatisfy(isIBAN);

const ibanFormated = prettyPrintIban(iban);
const bban = iban.substring(4) + iban.substring(0, 4);
Expand Down Expand Up @@ -173,7 +173,7 @@ describe('finance_iban', () => {
countryCode: 'TR',
});

expect(iban).toSatisfy(validator.isIBAN);
expect(iban).toSatisfy(isIBAN);

const ibanFormated = prettyPrintIban(iban);
const bban = iban.substring(4) + iban.substring(0, 4);
Expand Down Expand Up @@ -246,7 +246,7 @@ describe('finance_iban', () => {
countryCode: 'AZ',
});

expect(iban).toSatisfy(validator.isIBAN);
expect(iban).toSatisfy(isIBAN);

const ibanFormated = prettyPrintIban(iban);
const bban = iban.substring(4) + iban.substring(0, 4);
Expand Down Expand Up @@ -308,7 +308,7 @@ describe('finance_iban', () => {
countryCode: 'CR',
});

expect(iban).toSatisfy(validator.isIBAN);
expect(iban).toSatisfy(isIBAN);

const ibanFormated = prettyPrintIban(iban);
const bban = iban.substring(4) + iban.substring(0, 4);
Expand Down Expand Up @@ -360,7 +360,7 @@ describe('finance_iban', () => {
});
const ibanFormated = prettyPrintIban(iban);

expect(iban).toSatisfy(validator.isIBAN);
expect(iban).toSatisfy(isIBAN);

expect(
28,
Expand Down
10 changes: 5 additions & 5 deletions test/modules/git.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import validator from 'validator';
import { isEmail, isHexadecimal, isSlug } from 'validator';
import { describe, expect, it } from 'vitest';
import { faker } from '../../src';
import { seededTests } from '../support/seeded-runs';
Expand All @@ -13,7 +13,7 @@ function isValidCommitAuthor(email: string): boolean {
// that contain unquoted characters like . output by Git so we need
// to quote the display name
const quotedEmail = email.replace(/^(.*) </, '"$1" <');
return validator.isEmail(quotedEmail, {
return isEmail(quotedEmail, {
require_display_name: true,
});
}
Expand Down Expand Up @@ -49,7 +49,7 @@ describe('git', () => {

expect(branch).toBeTruthy();
expect(branch).toBeTypeOf('string');
expect(branch).toSatisfy(validator.isSlug);
expect(branch).toSatisfy(isSlug);
});
});

Expand Down Expand Up @@ -145,7 +145,7 @@ describe('git', () => {

expect(commitSha).toBeTruthy();
expect(commitSha).toBeTypeOf('string');
expect(commitSha).toSatisfy(validator.isHexadecimal);
expect(commitSha).toSatisfy(isHexadecimal);
expect(commitSha).toHaveLength(40);
});

Expand All @@ -159,7 +159,7 @@ describe('git', () => {

expect(commitSha).toBeTruthy();
expect(commitSha).toBeTypeOf('string');
expect(commitSha).toSatisfy(validator.isHexadecimal);
expect(commitSha).toSatisfy(isHexadecimal);
expect(commitSha).toHaveLength(length);
}
);
Expand Down
Loading

0 comments on commit 24ff9bb

Please sign in to comment.