Skip to content

Commit 1e0eaa2

Browse files
committed
style(*): format everything
1 parent 5c7e867 commit 1e0eaa2

28 files changed

+93
-131
lines changed

.commitlintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
extends:
2-
- "@commitlint/config-angular"
2+
- '@commitlint/config-angular'
33
rules:
44
'header-max-length': [2, 'always', 100]

.github/workflows/copilot-setup-steps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
22
# The copilot-setup-steps.yml workflow won't trigger unless it's present on your main branch.
3-
name: "Copilot Setup Steps"
3+
name: 'Copilot Setup Steps'
44

55
# Automatically run the setup steps when they are changed to allow for easy validation, and
66
# allow manual testing through the repository's "Actions" tab
@@ -33,4 +33,4 @@ jobs:
3333
cache: 'npm'
3434

3535
- name: GitHub registry Auth & Install Dependencies
36-
run: npm ci
36+
run: npm ci

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
name: Check for execution
3333
uses: shiftcode/[email protected]
3434
with:
35-
skipOnCommitMsg: "[skip_build]"
35+
skipOnCommitMsg: '[skip_build]'
3636
githubToken: ${{ secrets.GITHUB_TOKEN }}
3737
test:
3838
runs-on: ubuntu-latest

README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,37 @@
22

33
Public helper packages with commonly used utilities / helpers.
44

5+
> [![@shiftcode/branch-utilities](https://img.shields.io/github/package-json/v/shiftcode/sc-commons-public?filename=packages%2Fbranch-utilities%2Fpackage.json&label=%40shiftcode%2Fbranch-utilities)](packages/branch-utilities) \
6+
> functions to read information about the current branch either locally or inside Github actions.
57
6-
>[![@shiftcode/branch-utilities](https://img.shields.io/github/package-json/v/shiftcode/sc-commons-public?filename=packages%2Fbranch-utilities%2Fpackage.json&label=%40shiftcode%2Fbranch-utilities)](packages/branch-utilities) \
7-
>functions to read information about the current branch either locally or inside Github actions.
8+
> [![@shiftcode/eslint-config-recommended](https://img.shields.io/github/package-json/v/shiftcode/sc-commons-public?filename=packages%2Feslint-config-recommended%2Fpackage.json&label=%40shiftcode%2Feslint-config-recommended)](packages/eslint-config-recommended) \
9+
> Our recommended config for eslint. We provide two versions, one for usage in node projects and one for Angular.
810
9-
>[![@shiftcode/eslint-config-recommended](https://img.shields.io/github/package-json/v/shiftcode/sc-commons-public?filename=packages%2Feslint-config-recommended%2Fpackage.json&label=%40shiftcode%2Feslint-config-recommended)](packages/eslint-config-recommended) \
10-
>Our recommended config for eslint. We provide two versions, one for usage in node projects and one for Angular.
11+
> [![@shiftcode/eslint-plugin-rules](https://img.shields.io/github/package-json/v/shiftcode/sc-commons-public?filename=packages%2Feslint-plugin-rules%2Fpackage.json&label=%40shiftcode%2Feslint-plugin-rules)](packages/eslint-plugin-rules) \
12+
> Contains some custom es lint rules. Those are used in our recommended eslint config.
1113
12-
>[![@shiftcode/eslint-plugin-rules](https://img.shields.io/github/package-json/v/shiftcode/sc-commons-public?filename=packages%2Feslint-plugin-rules%2Fpackage.json&label=%40shiftcode%2Feslint-plugin-rules)](packages/eslint-plugin-rules) \
13-
>Contains some custom es lint rules. Those are used in our recommended eslint config.
14-
15-
>[![@shiftcode/publish-helper](https://img.shields.io/github/package-json/v/shiftcode/sc-commons-public?filename=packages%2Fpublish-helper%2Fpackage.json&label=%40shiftcode%2Fpublish-helper)](packages/publish-helper)\
16-
>scripts to prepare and publish libs inside mono-repos with lerna
14+
> [![@shiftcode/publish-helper](https://img.shields.io/github/package-json/v/shiftcode/sc-commons-public?filename=packages%2Fpublish-helper%2Fpackage.json&label=%40shiftcode%2Fpublish-helper)](packages/publish-helper)\
15+
> scripts to prepare and publish libs inside mono-repos with lerna
1716
18-
>[![@shiftcode/utilities](https://img.shields.io/github/package-json/v/shiftcode/sc-commons-public?filename=packages%2Futilities%2Fpackage.json&label=%40shiftcode%2Futilities)](packages/utilities)\
19-
>various utility functions, constants and helper types - usable in Node and Browsers
17+
> [![@shiftcode/utilities](https://img.shields.io/github/package-json/v/shiftcode/sc-commons-public?filename=packages%2Futilities%2Fpackage.json&label=%40shiftcode%2Futilities)](packages/utilities)\
18+
> various utility functions, constants and helper types - usable in Node and Browsers
2019
2120
## Usage
21+
2222
Add a `.npmrc` file to the root of your project:
23+
2324
```
2425
@shiftcode:registry=https://npm.pkg.github.com
2526
```
2627

2728
## Quick Start
28-
* `npm i`
29-
* `npm run build`
30-
* start developing
3129

30+
- `npm i`
31+
- `npm run build`
32+
- start developing
3233

3334
## Versioning
35+
3436
When opening a PR lerna publishes a new prerelease version with the preId `-prXX.{COUNT}`.
3537
By creating this version lerna creates a commit with the updated versions in the package.json. It does not update the `peerDependencies` versions.
3638

@@ -39,26 +41,31 @@ After merging the PR back to the master a new release is published with the grad
3941
> ensure your branch is named correctly by the convention `#XX-name` where `XX` is your github issue number.
4042
4143
### Hint
44+
4245
If it happens that you already have another commit locally, before updating the branch with this `build(release):..` commit:
43-
> use `rebase` instead of `merge`
4446

47+
> use `rebase` instead of `merge`
4548
4649
## Anatomy of the repo
4750

4851
We use lerna to manage the packages.
52+
4953
- For lerna to know the topological order of packages, we define the dependencies between the packages in each individual package as `devDependency`
5054
- For testing reasons we compile against the source code to run tests without prior compiling of the source, this requires `tsconfig.paths` definitions and also `moduleNameMapper` in `jest.config.js`
5155

5256
## ES Version
57+
5358
We support two runtimes: `node` and `latest browser versions`.
5459

5560
### Node 22
56-
Node 22 (which is also supported by AWS Lambda) supports [97%](https://node.green/#ES2022) of `es2022` features
61+
62+
Node 22 (which is also supported by AWS Lambda) supports [97%](https://node.green/#ES2022) of `es2022` features
5763
(no version supports 100%) and [100%](https://node.green/#ES2023) of `es2023` features.
5864
The only `es2022` feature that is currently not supported and needs a polyfill when using it is
59-
[RegExp Match Indices (shows up in flags)](https://node.green/#ES2022-features-RegExp-Match-Indices---hasIndices-----d--flag-) (see [2ality blog](https://2ality.com/2019/12/regexp-match-indices.html) for insights).
65+
[RegExp Match Indices (shows up in flags)](https://node.green/#ES2022-features-RegExp-Match-Indices---hasIndices-----d--flag-) (see [2ality blog](https://2ality.com/2019/12/regexp-match-indices.html) for insights).
6066
Polyfill can be found here: https://www.npmjs.com/package/regexp-match-indices.
6167

6268
### Browser
69+
6370
For modern browsers the latest fully supported version is `es2023` (see [can-i-use](https://caniuse.com/?search=es2023))
6471
which therefore is the target for `@shiftcode/utilities` package (see [package README](./packages/utilities/README.md)).

packages/branch-utilities/tsconfig.jest.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,5 @@
33
"compilerOptions": {
44
"baseUrl": "./"
55
},
6-
"include": [
7-
"src/**/*.spec.ts",
8-
"test/**/*.ts"
9-
]
6+
"include": ["src/**/*.spec.ts", "test/**/*.ts"]
107
}
11-

packages/branch-utilities/tsconfig.lint.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
"baseUrl": "./",
55
"types": ["jest", "node"]
66
},
7-
"include": [
8-
"src/**/*.ts",
9-
"test/**/*.ts"
10-
],
7+
"include": ["src/**/*.ts", "test/**/*.ts"],
118
"exclude": []
129
}
13-

packages/eslint-config-recommended/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
> 🎯 Target runtime: es2023 ([Node >= 20](https://node.green/#ES2023))
44
5-
65
This module provides an eslint default rule-set configuration for shiftcode projects.
76

87
### remark
8+
99
By using this module, the [@shiftcode/eslint-plugin-rules](../eslint-plugin-rules) module will be automatically installed
1010
as dependency.
1111

1212
## usage
13+
1314
the module only exports a single function `defineScTsConfig` which can be used to create the eslint configuration.
1415
it is basically a wrapper around the new eslint `defineConfig` function but already includes the setup for typescript,
1516
some rules with default configurations and will ensure the prettier rules (disabling formatting rules) are included at last.
@@ -32,13 +33,13 @@ export default defineScTsConfig(
3233
rules: {
3334
'@typescript-eslint/explicit-function-return-type': 'error',
3435
},
35-
}
36+
},
3637
)
3738
```
3839

3940
## Additional configurations
4041

41-
Additionally on the submodule `/angular` the `defineScAngularConfig` function is exported
42+
Additionally on the submodule `/angular` the `defineScAngularConfig` function is exported
4243
which includes angular-specific rules and configurations.
4344

4445
```js
@@ -59,7 +60,7 @@ export default defineScAngularConfig(
5960
rules: {
6061
'@angular-eslint/component-selector': ['error', { type: 'element', prefix: 'gf', style: 'kebab-case' }],
6162
},
62-
}
63+
},
6364
)
6465
```
6566

packages/eslint-config-recommended/tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66
"declarationDir": "./dist",
77
"types": ["node"]
88
},
9-
"include": [
10-
"src/**/*.ts"
11-
]
9+
"include": ["src/**/*.ts"]
1210
}

packages/eslint-config-recommended/tsconfig.lint.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
"@shiftcode/eslint-plugin-rules": ["../eslint-plugin-rules/src/index.ts"]
88
}
99
},
10-
"include": [
11-
"src/**/*.ts",
12-
"test/**/*.ts"
13-
],
10+
"include": ["src/**/*.ts", "test/**/*.ts"],
1411
"exclude": []
1512
}
16-

packages/eslint-plugin-rules/README.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ import eslintScPlugin from '@shiftcode/eslint-plugin-rules'
1414

1515
export default defineConfig(
1616
// ...
17-
{
18-
files: ['*.ts'],
19-
extends: [eslintScPlugin.configs.recommended],
20-
rules: {
21-
'@shiftcode/import-denylist': [ // former TSLint rule: "import-blacklist"
22-
'error',
23-
{
24-
patterns: [
25-
/aws-cdk-lib\/core/,
26-
/\.\/(core|models|shared|static)\/.*/, // use app/* instead
27-
/^app\/core/, // disallow importing from self
28-
/^somewhat\/.*/, // import filename must never start with "somewhat"
29-
/example$/, // import filename must never end with "example"
30-
// etc ...
31-
],
32-
},
33-
],
34-
},
17+
{
18+
files: ['*.ts'],
19+
extends: [eslintScPlugin.configs.recommended],
20+
rules: {
21+
'@shiftcode/import-denylist': [
22+
'error',
23+
{
24+
patterns: [
25+
/aws-cdk-lib\/core/,
26+
/\.\/(core|models|shared|static)\/.*/, // use app/* instead
27+
/^app\/core/, // disallow importing from self
28+
/^somewhat\/.*/, // import filename must never start with "somewhat"
29+
/example$/, // import filename must never end with "example"
30+
// etc ...
31+
],
32+
},
33+
],
3534
},
35+
},
3636

3737
// ...
3838
)
@@ -46,12 +46,12 @@ import eslintScPlugin from '@shiftcode/eslint-plugin-rules'
4646
export default defineConfig({
4747
files: ['**/*.ts'],
4848
plugins: {
49-
'@shiftcode': eslintScPlugin
49+
'@shiftcode': eslintScPlugin,
5050
},
5151
rules: {
5252
'@shiftcode/prefix-builtin-module-import': 'error',
5353
// ...
54-
}
54+
},
5555
})
5656
```
5757

@@ -72,17 +72,20 @@ This can potentially be replaced by using [no-restricted-imports](https://eslint
7272
- example configuration: see above
7373

7474
### prefix-builtin-module-import
75+
7576
This rule ensures all node builtin modules are imported with the `node:` prefix.
7677

7778
- <span style="color: orange">note: this rule is already included by [@shiftcode/eslint-config-recommended](../eslint-config-recommended)</span>
7879

79-
8080
✅ Correct
81+
8182
```js
8283
import { writeFile } from 'node:fs/promises'
8384
import crypto from 'node:crypto'
8485
```
86+
8587
❌ Incorrect
88+
8689
```js
8790
import { writeFile } from 'fs/promises'
8891
import crypto from 'crypto'

0 commit comments

Comments
 (0)