Skip to content

Commit 3fefb7b

Browse files
authored
Merge pull request #86 from shiftcode/#7-next
#7 next
2 parents 290c24b + 01d7655 commit 3fefb7b

14 files changed

Lines changed: 2417 additions & 528 deletions

File tree

‎package-lock.json‎

Lines changed: 2372 additions & 502 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/airtable-syncer/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@shiftcode/airtable-syncer",
3-
"version": "1.0.1",
3+
"version": "1.0.2-pr7.2",
44
"description": "base utils and services to export airtable and upload to S3",
55
"repository": "https://github.com/shiftcode/sc-commons-public",
66
"license": "MIT",

‎packages/airtable-syncer/src/services/airtable-fetcher.service.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class AirtableFetcher {
134134
}
135135

136136
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
137-
const cachedRecordsMap: Map<string, AirtableIdRecord> = <any>this.cache.get(map.tableName)!.items
137+
const cachedRecordsMap: Map<string, AirtableIdRecord> = this.cache.get(map.tableName)!.items
138138

139139
if (ids && Array.isArray(ids) && ids.length) {
140140
// filter only required ids

‎packages/branch-utilities/README.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ Utilities for branch info depending on env (GitHub Workflow or Local)
66

77
## Stage Name Concept
88

9-
the stageId is extracted from the branchname by the pattern `/^#(\d+)-(.*)/`
9+
the stageId is extracted from the branchname by the pattern `/^#?(\d+)-(.*)/`
1010

1111
- When Master --> `master`
12+
- When `main` --> `main`
1213
- When Local or nonPr github workflow --> `xx#{stageId}`
1314
- When Github PR --> `pr#{stageId}`
15+
- the `#` is optional in the branchname; if present, it is stripped from the stageId.
16+
- the branch name may contain a directory like prefix, e.g. `feature/#72-ok` or `copilot/123-fix-a-thing`

‎packages/branch-utilities/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@shiftcode/branch-utilities",
3-
"version": "6.0.0",
3+
"version": "6.1.0-pr7.4",
44
"description": "Utilities for local and ci to get branch name and stage",
55
"repository": "https://github.com/shiftcode/sc-commons-public",
66
"license": "MIT",

‎packages/branch-utilities/src/lib/base.utils.spec.ts‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ describe('base utils', () => {
1515
SC_OVERRIDE_BRANCH_NAME: undefined,
1616
SC_OVERRIDE_IS_PR: undefined,
1717
}
18-
expect(getBranchInfo(env, 'master')).toEqual(<BranchInfo>{
18+
expect(getBranchInfo(env, 'master')).toEqual({
1919
stage: 'master',
2020
isPr: false,
2121
isProd: true,
2222
name: 'master',
2323
branchName: 'master',
24-
})
24+
} satisfies BranchInfo)
2525
})
2626

2727
test('works locally when not master', () => {
@@ -53,9 +53,9 @@ describe('base utils', () => {
5353
const env: Partial<GithubActionEnv & CustomGitHubContext> = {
5454
GITHUB_ACTIONS: 'true',
5555
GITHUB_EVENT_NAME: 'push',
56-
GITHUB_CONTEXT: JSON.stringify(<Partial<GitHubContext>>{
56+
GITHUB_CONTEXT: JSON.stringify({
5757
ref: 'refs/heads/master',
58-
}),
58+
} satisfies Partial<GitHubContext>),
5959
}
6060
expect(getBranchInfo(env)).toEqual({
6161
branchName: 'master',
@@ -72,13 +72,13 @@ describe('base utils', () => {
7272
SC_OVERRIDE_BRANCH_NAME: '#1313-on-branch-to-override-them-all',
7373
SC_OVERRIDE_IS_PR: 'true',
7474
}
75-
expect(getBranchInfo(env, 'master')).toEqual(<BranchInfo>{
75+
expect(getBranchInfo(env, 'master')).toEqual({
7676
stage: 'pr1313',
7777
isPr: true,
7878
isProd: false,
7979
name: 'on-branch-to-override-them-all',
8080
branchName: '#1313-on-branch-to-override-them-all',
81-
})
81+
} satisfies BranchInfo)
8282
})
8383
})
8484

@@ -94,6 +94,16 @@ describe('base utils', () => {
9494

9595
expect(parseBranchName('#72- whatever').branchId).toBe(72)
9696
expect(parseBranchName('feature/#72-ok').branchId).toBe(72)
97+
expect(parseBranchName('1-foobar')).toEqual({ branchId: 1, branchName: 'foobar' } satisfies ReturnType<
98+
typeof parseBranchName
99+
>)
100+
expect(parseBranchName('feat/42-foo-bar-baz')).toEqual({
101+
branchId: 42,
102+
branchName: 'foo-bar-baz',
103+
} satisfies ReturnType<typeof parseBranchName>)
104+
expect(parseBranchName('007-oh-james')).toEqual({ branchId: 7, branchName: 'oh-james' } satisfies ReturnType<
105+
typeof parseBranchName
106+
>)
97107
})
98108

99109
test('works for github copilot created branches', () => {
@@ -107,8 +117,10 @@ describe('base utils', () => {
107117

108118
test('throws when invalid pattern', () => {
109119
expect(() => parseBranchName('whrjwe')).toThrow()
110-
expect(() => parseBranchName('copilot/123-fix')).toThrow()
111120
expect(() => parseBranchName('feat/copilot/fix-123')).toThrow()
121+
expect(() => parseBranchName('/42-foo')).toThrow()
122+
expect(() => parseBranchName('fix-7-issues')).toThrow()
123+
expect(() => parseBranchName('fix7-issues')).toThrow()
112124
})
113125
})
114126

‎packages/branch-utilities/src/lib/base.utils.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const REGEX_MAIN = /^main$/
1313
* @example #123-my-feature -> { id: '123', name: 'my-feature' }
1414
* @example feature/#456-yanr -> { id: '456', name: 'yanr' }
1515
*/
16-
const REGEX_BRANCH_NAME_DEFAULT = /^[a-z]*\/?#(?<id>\d+)-(?<name>.*)$/
16+
const REGEX_BRANCH_NAME_DEFAULT = /^(?:[a-z]+\/)?#?(?<id>\d+)-(?<name>.*)$/
1717
/**
1818
* regex to match the branch convention github copilot uses with the following named capture groups: id, name
1919
* @example copilot/fix-789 -> { id: '789', name: 'fix' }
@@ -153,7 +153,7 @@ export function parseBranchName(branchName: string): { branchId: number; branchN
153153
}
154154
} else {
155155
throw new Error(
156-
`given branch name ${branchName} does not match our convention #<one or more digit>-<branch-name-with-kebap-case>`,
156+
`given branch name ${branchName} does not match our conventions: [<lowercase-prefix>/][#]<digits>-<name> or copilot/<name>-<digits>`,
157157
)
158158
}
159159
}

‎packages/eslint-config-recommended/package.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@shiftcode/eslint-config-recommended",
3-
"version": "7.0.0",
3+
"version": "8.0.0-pr7.2",
44
"description": "default shiftcode config for eslint",
55
"repository": "https://github.com/shiftcode/sc-commons-public",
66
"license": "MIT",
@@ -28,19 +28,19 @@
2828
},
2929
"dependencies": {
3030
"@eslint/js": "^9.37.0",
31-
"@shiftcode/eslint-plugin-rules": "^6.0.0",
31+
"@shiftcode/eslint-plugin-rules": "^6.0.1-pr7.1",
3232
"eslint": "^9.37.0",
3333
"eslint-config-prettier": "^10.1.8",
3434
"eslint-plugin-import": "^2.32.0",
3535
"eslint-plugin-simple-import-sort": "^12.1.1",
36-
"eslint-plugin-unused-imports": "^4.2.0",
37-
"typescript-eslint": "8.46.0"
36+
"eslint-plugin-unused-imports": "^4.4.1",
37+
"typescript-eslint": "8.67.0"
3838
},
3939
"devDependencies": {
40-
"angular-eslint": "^20.5.1"
40+
"angular-eslint": "~21.3.1"
4141
},
4242
"peerDependencies": {
43-
"angular-eslint": "^20.5.1 || ^21.0.0"
43+
"angular-eslint": "^21.3.0 || ^22.0.0"
4444
},
4545
"peerDependenciesMeta": {
4646
"angular-eslint": {

‎packages/eslint-config-recommended/src/angular/index.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export function defineScAngularConfig(...configs: Parameters<typeof defineConfig
3636
return defineScTsConfig(
3737
{
3838
files: ['**/*.ts'],
39-
// @ts-expect-error angular fck it up
4039
extends: [eslintAngular.configs.tsRecommended],
4140
processor: eslintAngular.processInlineTemplates,
4241
rules: {
@@ -45,9 +44,11 @@ export function defineScAngularConfig(...configs: Parameters<typeof defineConfig
4544
'@angular-eslint/sort-lifecycle-methods': 'error',
4645
'@angular-eslint/no-lifecycle-call': 'error',
4746
'@angular-eslint/prefer-output-readonly': 'error',
47+
'@angular-eslint/prefer-output-emitter-ref': 'error',
4848
'@angular-eslint/no-host-metadata-property': 'off',
4949
'@angular-eslint/prefer-host-metadata-property': 'error',
5050
'@angular-eslint/no-queries-metadata-property': 'error',
51+
'@angular-eslint/computed-must-return': 'error',
5152

5253
'@angular-eslint/use-lifecycle-interface': 'error',
5354
'@angular-eslint/use-pipe-transform-interface': 'error',
@@ -93,6 +94,8 @@ export function defineScAngularConfig(...configs: Parameters<typeof defineConfig
9394
'@angular-eslint/template/no-negated-async': 'error',
9495
'@angular-eslint/template/no-empty-control-flow': 'error',
9596
'@angular-eslint/template/prefer-at-empty': 'error',
97+
'@angular-eslint/template/prefer-class-binding': 'error',
98+
'@angular-eslint/template/no-non-null-assertion': 'error',
9699

97100
// some very basic a11y rules
98101
'@angular-eslint/template/elements-content': 'error',

‎packages/eslint-config-recommended/src/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export function defineScTsConfig(...configs: Parameters<typeof defineConfig>): R
5757
'simple-import-sort/exports': 'error',
5858
'no-console': 'error',
5959
'max-classes-per-file': 'error',
60+
'object-shorthand': 'error',
6061
curly: 'error',
6162
eqeqeq: 'error',
6263
},

0 commit comments

Comments
 (0)