Skip to content

Commit 30dc079

Browse files
committed
chore(copyright): add sync-header-years script and tests
chore(copyright): wire sync script into lefthook and add package scripts feat(eslint): add inline ping-copyright rule to eslint.config.mjs
1 parent eedcca7 commit 30dc079

8 files changed

Lines changed: 406 additions & 50 deletions

File tree

eslint.config.mjs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
2+
* Copyright (c) 2025 - 2026 Ping Identity Corporation. All rights reserved.
33
*
44
* This software may be modified and distributed under the terms
55
* of the MIT license. See the LICENSE file for details.
@@ -33,6 +33,48 @@ export default [
3333
'**/test-output',
3434
],
3535
},
36+
{
37+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.mjs', '**/*.cjs'],
38+
ignores: [
39+
'**/*.test.*',
40+
'**/*.spec.*',
41+
'**/vite.config.*',
42+
'**/vitest.config.*',
43+
'**/vitest.setup.*',
44+
'**/eslint.config.*',
45+
],
46+
plugins: {
47+
'local-rules': {
48+
rules: {
49+
'ping-copyright': {
50+
meta: {
51+
type: 'suggestion',
52+
messages: { missing: 'Missing Ping Identity copyright header.' },
53+
},
54+
create(context) {
55+
return {
56+
Program(node) {
57+
const src = context.getSourceCode();
58+
const comments = src.getAllComments();
59+
const first = comments[0];
60+
if (
61+
!first ||
62+
first.range[0] > 0 ||
63+
!/Copyright[\s\S]*Ping Identity/i.test(first.value)
64+
) {
65+
context.report({ node, messageId: 'missing' });
66+
}
67+
},
68+
};
69+
},
70+
},
71+
},
72+
},
73+
},
74+
rules: {
75+
'local-rules/ping-copyright': 'warn',
76+
},
77+
},
3678
...compat.extends('plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'),
3779
{
3880
plugins: {

lefthook.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ pre-commit:
22
commands:
33
nx-sync:
44
run: pnpm nx sync
5+
copyright-sync:
6+
run: node tools/copyright/sync-header-years.mjs --fix
7+
stage_fixed: true
58
nx-check:
69
run: pnpm nx affected -t typecheck lint build api-report --tui=false
710
stage_fixed: true

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"circular-dep-check": "madge --circular .",
2121
"clean": "shx rm -rf ./{coverage,dist,docs,node_modules,tmp}/ ./{packages,e2e}/*/{dist,node_modules}/ ./e2e/node_modules/ && git clean -fX -e \"!.env*,nx-cloud.env\" -e \"!**/GEMINI.md\"",
2222
"commit": "git cz",
23+
"copyright:check": "node tools/copyright/sync-header-years.mjs --check",
24+
"copyright:sync": "node tools/copyright/sync-header-years.mjs --fix",
2325
"commitlint": "commitlint --edit",
2426
"create-package": "nx g @nx/js:library",
2527
"format": "pnpm nx format:write",
@@ -45,7 +47,6 @@
4547
"path": "./node_modules/cz-conventional-changelog"
4648
}
4749
},
48-
"dependencies": {},
4950
"devDependencies": {
5051
"@changesets/changelog-github": "^0.6.0",
5152
"@changesets/cli": "^2.27.9",
@@ -55,6 +56,7 @@
5556
"@effect/cli": "catalog:effect",
5657
"@eslint/eslintrc": "^3.0.0",
5758
"@eslint/js": "~9.39.0",
59+
"@evilmartians/lefthook": "^2.1.4",
5860
"@nx/devkit": "22.6.5",
5961
"@nx/eslint": "22.6.5",
6062
"@nx/eslint-plugin": "22.6.5",
@@ -92,7 +94,6 @@
9294
"eslint-plugin-playwright": "^2.0.0",
9395
"eslint-plugin-prettier": "^5.2.3",
9496
"fast-check": "^4.0.0",
95-
"@evilmartians/lefthook": "^2.1.4",
9697
"jiti": "2.6.1",
9798
"jsdom": "27.4.0",
9899
"jsonc-eslint-parser": "^2.1.0",
@@ -104,9 +105,9 @@
104105
"shx": "^0.4.0",
105106
"swc-loader": "0.2.7",
106107
"ts-node": "10.9.2",
107-
"tsx": "^4.20.0",
108108
"ts-patch": "3.3.0",
109109
"tslib": "^2.5.0",
110+
"tsx": "^4.20.0",
110111
"typedoc": "^0.27.4",
111112
"typedoc-github-theme": "0.2.1",
112113
"typedoc-plugin-rename-defaults": "^0.7.2",

packages/davinci-client/api-report/davinci-client.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export function davinci<ActionType extends ActionTypes = ActionTypes>(input: {
270270
start: <QueryParams extends OutgoingQueryParams = OutgoingQueryParams>(options?: StartOptions<QueryParams> | undefined) => Promise<ContinueNode | StartNode | ErrorNode | FailureNode | SuccessNode>;
271271
update: <T extends SingleValueCollectors | MultiSelectCollector | ObjectValueCollectors | AutoCollectors>(collector: T) => Updater<T>;
272272
validate: (collector: SingleValueCollectors | ObjectValueCollectors | MultiValueCollectors | AutoCollectors) => Validator;
273-
poll: (collector: PollingCollector) => Poller;
273+
pollStatus: (collector: PollingCollector) => Poller;
274274
getClient: () => {
275275
status: "start";
276276
} | {

packages/davinci-client/api-report/davinci-client.types.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export function davinci<ActionType extends ActionTypes = ActionTypes>(input: {
270270
start: <QueryParams extends OutgoingQueryParams = OutgoingQueryParams>(options?: StartOptions<QueryParams> | undefined) => Promise<ContinueNode | StartNode | ErrorNode | FailureNode | SuccessNode>;
271271
update: <T extends SingleValueCollectors | MultiSelectCollector | ObjectValueCollectors | AutoCollectors>(collector: T) => Updater<T>;
272272
validate: (collector: SingleValueCollectors | ObjectValueCollectors | MultiValueCollectors | AutoCollectors) => Validator;
273-
poll: (collector: PollingCollector) => Poller;
273+
pollStatus: (collector: PollingCollector) => Poller;
274274
getClient: () => {
275275
status: "start";
276276
} | {

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)