@checkdigit/eslint-plugin 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +1 -1
- package/README.md +1 -1
- package/dist/file-path-comment.spec.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/no-card-numbers.spec.d.ts +1 -0
- package/dist/no-uuid.spec.d.ts +1 -0
- package/package.json +18 -14
- package/.github/workflows/ci.yml +0 -72
- package/.github/workflows/codeql-analysis.yml +0 -31
- package/.github/workflows/coverage.yml +0 -46
package/LICENSE.txt
CHANGED
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=/\d{15,19}/gmu,
|
|
1
|
+
"use strict";const e="CARD_NUMBER_FOUND",t="CARD_NUMBERS_FOUND",n=/\d{15,19}/gmu,o=["4111111111111111","111111111111111","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000"];function i(i,r,a,s){const l=i.match(n);if(null===l)return;const d=l.filter((e=>e.split("").reverse().map((e=>parseInt(e,10))).reduce(((e,t,n)=>{let o=t;return n%2==1&&(o*=2,o>9&&(o=o%10+1)),e+o}),0)%10==0&&-1===o.indexOf(e)&&"0"!==e[0]&&"1"!==e[0]&&"7"!==e[0]&&"8"!==e[0]&&"9"!==e[0]));1===d.length?void 0!==a?r.report({messageId:e,data:{number:d[0]},node:a}):void 0!==s&&r.report({messageId:e,data:{number:d[0]},loc:{start:s.start,end:s.end}}):d.length>1&&(void 0!==a?r.report({messageId:t,data:{numbers:l.join(", ")},node:a}):void 0!==s&&r.report({messageId:t,data:{numbers:l.join(", ")},loc:{start:s.start,end:s.end}}))}const r="UUID_FOUND",a="UUIDS_FOUND",s=/[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}/gmu;function l(e,t,n,o){const i=e.match(s);null!==i&&(1===i.length?void 0!==n?t.report({messageId:r,data:{uuid:i[0]??""},node:n}):void 0!==o&&t.report({messageId:r,data:{uuid:i[0]??""},loc:{start:o.start,end:o.end}}):i.length>1&&(void 0!==n?t.report({messageId:a,data:{uuids:i.join(", ")},node:n}):void 0!==o&&t.report({messageId:a,data:{uuids:i.join(", ")},loc:{start:o.start,end:o.end}})))}var d={rules:{"file-path-comment":{meta:{type:"suggestion",docs:{description:"Validate that first line of file is a path to the file",url:"https://github.com/checkdigit/eslint-plugin"},fixable:"code"},create(e){const t=e.getSourceCode().getLines()[0],n=e.getFilename().split("src/")[1];if(void 0===n)return{};if(t.startsWith("//")){const o=t.split("// ")[1];n!==o&&e.report({loc:{start:{line:0,column:0},end:{line:0,column:1}},message:"first line is a comment but is not a path to the file",fix:e=>e.replaceTextRange([0,t.length],`// ${n}`)})}else t.startsWith("/*")?e.report({loc:{start:{line:0,column:0},end:{line:0,column:1}},message:"first line cannot be a block comment",fix:e=>e.insertTextBeforeRange([0,0],`// ${n}\n\n`)}):e.report({loc:{start:{line:0,column:0},end:{line:0,column:1}},message:"first line is not a comment with the file path",fix:e=>e.insertTextBeforeRange([0,0],`// ${n}\n\n`)});return{}}},"no-card-numbers":{meta:{type:"problem",docs:{description:"Detects if a luhn passing card number",url:"https://github.com/checkdigit/eslint-plugin"},messages:{[e]:'Valid card number: "{{ number }}"',[t]:'Multiple valid card numbers found: "{{ numbers }}"'}},create:e=>(e.getSourceCode().getAllComments().forEach((t=>{void 0!==t.loc&&null!==t.loc&&i(t.value,e,void 0,t.loc)})),{Literal(t){if(void 0===t.value)return;if("string"!=typeof t.value&&"number"!=typeof t.value)return;i(`${t.value}`,e,t)},TemplateElement(t){t.value&&"string"==typeof t.value.cooked&&i(t.value.cooked,e,t)}})},"no-uuid":{meta:{type:"problem",docs:{description:"Detects if a string literal contains a UUID",url:"https://github.com/checkdigit/eslint-plugin"},messages:{[r]:'UUID found: "{{ uuid }}"',[a]:'Multiple UUIDs found: "{{ uuids }}"'}},create:e=>(e.getSourceCode().getAllComments().forEach((t=>{void 0!==t.loc&&null!==t.loc&&l(t.value,e,void 0,t.loc)})),{Literal(t){if(void 0===t.value)return;if("string"!=typeof t.value)return;l(`${t.value}`,e,t)},TemplateElement(t){t.value&&"string"==typeof t.value.cooked&&l(t.value.cooked,e,t)}})}},configs:{all:{rules:{"@checkdigit/no-card-numbers":"error","@checkdigit/file-path-comment":"error","@checkdigit/no-uuid":"error"}},recommended:{rules:{"@checkdigit/no-card-numbers":"error","@checkdigit/file-path-comment":"off","@checkdigit/no-uuid":"error"}}}};module.exports=d;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/no-card-numbers.ts","../src/no-uuid.ts","../src/index.ts","../src/file-path-comment.ts"],"sourcesContent":[null,null,null,null],"names":["cardNumberRegex","allowCardNumbers","checkForCardNumbers","value","context","node","loc","matches","match","cardNumbers","filter","split","reverse","map","digit","parseInt","reduce","previousValue","currentValue","index","indexOf","length","undefined","report","messageId","data","number","start","end","numbers","join","uuidRegex","checkForUuid","uuid","uuids","rules","meta","type","docs","description","url","fixable","create","firstLine","getSourceCode","getLines","expectedPath","getFilename","startsWith","actualComment","line","column","message","fix","fixer","replaceTextRange","insertTextBeforeRange","messages","CARD_NUMBER_FOUND","CARD_NUMBERS_FOUND","getAllComments","forEach","comment","Literal","TemplateElement","cooked","UUID_FOUND","UUIDS_FOUND","configs","all","recommended"],"mappings":"aAWA,MAEMA,EAAkB,eAClBC,EAAmB,CACvB,mBACA,kBACA,kBACA,mBACA,oBACA,qBACA,uBAyBF,SAASC,EAAoBC,EAAeC,EAA2BC,EAAaC,GAClF,MAAMC,EAAUJ,EAAMK,MAAMR,GAC5B,GAAgB,OAAZO,EACF,OAEF,MAAME,EAAcF,EAAQG,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3BmC,YAAa,CACXnC,MAAO,CACL,8BAA+B,QAC/B,gCAAiC,MACjC,sBAAuB"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/no-card-numbers.ts","../src/no-uuid.ts","../src/index.ts","../src/file-path-comment.ts"],"sourcesContent":["// no-card-numbers.ts\n\n/*\n * Copyright (c) 2021-2022 Check Digit, LLC\n *\n * This code is licensed under the MIT license (see LICENSE.txt for details).\n */\n\nimport type { Node, SourceLocation } from 'estree';\nimport type { Rule } from 'eslint';\n\nconst CARD_NUMBER_FOUND = 'CARD_NUMBER_FOUND';\nconst CARD_NUMBERS_FOUND = 'CARD_NUMBERS_FOUND';\nconst cardNumberRegex = /\\d{15,19}/gmu;\nconst allowCardNumbers = [\n '4111111111111111',\n '111111111111111',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n];\n\nfunction luhnCheck(cardNumber: string) {\n return (\n cardNumber\n .split('')\n .reverse()\n .map((digit) => parseInt(digit, 10))\n .reduce((previousValue, currentValue, index) => {\n let value = currentValue;\n if (index % 2 === 1) {\n value *= 2;\n // eslint-disable-next-line no-magic-numbers\n if (value > 9) {\n value = (value % 10) + 1;\n }\n }\n return previousValue + value;\n }, 0) %\n 10 ===\n 0\n );\n}\n\nfunction checkForCardNumbers(value: string, context: Rule.RuleContext, node?: Node, loc?: SourceLocation) {\n const matches = value.match(cardNumberRegex);\n if (matches === null) {\n return;\n }\n const cardNumbers = matches.filter(\n (match) =>\n luhnCheck(match) &&\n allowCardNumbers.indexOf(match) === -1 &&\n // any 16-digit number that begins with 0-1 or 7-9 is not a valid card number\n match[0] !== '0' &&\n match[0] !== '1' &&\n match[0] !== '7' &&\n match[0] !== '8' &&\n match[0] !== '9'\n );\n if (cardNumbers.length === 1) {\n if (node !== undefined) {\n context.report({\n messageId: CARD_NUMBER_FOUND,\n data: {\n number: cardNumbers[0] as string,\n },\n node,\n });\n } else if (loc !== undefined) {\n context.report({\n messageId: CARD_NUMBER_FOUND,\n data: {\n number: cardNumbers[0] as string,\n },\n loc: {\n start: loc.start,\n end: loc.end,\n },\n });\n }\n } else if (cardNumbers.length > 1) {\n if (node !== undefined) {\n context.report({\n messageId: CARD_NUMBERS_FOUND,\n data: {\n numbers: matches.join(', '),\n },\n node,\n });\n } else if (loc !== undefined) {\n context.report({\n messageId: CARD_NUMBERS_FOUND,\n data: {\n numbers: matches.join(', '),\n },\n loc: {\n start: loc.start,\n end: loc.end,\n },\n });\n }\n }\n}\n\nexport default {\n meta: {\n type: 'problem',\n docs: {\n description: 'Detects if a luhn passing card number',\n url: 'https://github.com/checkdigit/eslint-plugin',\n },\n messages: {\n [CARD_NUMBER_FOUND]: `Valid card number: \"{{ number }}\"`,\n [CARD_NUMBERS_FOUND]: `Multiple valid card numbers found: \"{{ numbers }}\"`,\n },\n },\n create(context) {\n const sourceCode = context.getSourceCode();\n const comments = sourceCode.getAllComments();\n\n comments.forEach((comment) => {\n if (comment.loc !== undefined && comment.loc !== null) {\n checkForCardNumbers(comment.value, context, undefined, comment.loc);\n }\n });\n return {\n Literal(node) {\n if (node.value === undefined) {\n return;\n }\n if (typeof node.value !== 'string' && typeof node.value !== 'number') {\n return;\n }\n const value = `${node.value}`;\n checkForCardNumbers(value, context, node);\n },\n TemplateElement(node) {\n if (!node.value) {\n return;\n }\n if (typeof node.value.cooked !== 'string') {\n return;\n }\n checkForCardNumbers(node.value.cooked, context, node);\n },\n };\n },\n} as Rule.RuleModule;\n","// no-uuid.ts\n\n/*\n * Copyright (c) 2022 Check Digit, LLC\n *\n * This code is licensed under the MIT license (see LICENSE.txt for details).\n */\n\nimport type { Node, SourceLocation } from 'estree';\nimport type { Rule } from 'eslint';\n\nconst UUID_FOUND = 'UUID_FOUND';\nconst UUIDS_FOUND = 'UUIDS_FOUND';\nconst uuidRegex = /[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}/gmu;\n\nfunction checkForUuid(value: string, context: Rule.RuleContext, node?: Node, loc?: SourceLocation) {\n const matches = value.match(uuidRegex);\n if (matches === null) {\n return;\n }\n if (matches.length === 1) {\n if (node !== undefined) {\n context.report({\n messageId: UUID_FOUND,\n data: {\n uuid: matches[0] ?? '',\n },\n node,\n });\n } else if (loc !== undefined) {\n context.report({\n messageId: UUID_FOUND,\n data: {\n uuid: matches[0] ?? '',\n },\n loc: {\n start: loc.start,\n end: loc.end,\n },\n });\n }\n } else if (matches.length > 1) {\n if (node !== undefined) {\n context.report({\n messageId: UUIDS_FOUND,\n data: {\n uuids: matches.join(', '),\n },\n node,\n });\n } else if (loc !== undefined) {\n context.report({\n messageId: UUIDS_FOUND,\n data: {\n uuids: matches.join(', '),\n },\n loc: {\n start: loc.start,\n end: loc.end,\n },\n });\n }\n }\n}\n\nexport default {\n meta: {\n type: 'problem',\n docs: {\n description: 'Detects if a string literal contains a UUID',\n url: 'https://github.com/checkdigit/eslint-plugin',\n },\n messages: {\n [UUID_FOUND]: `UUID found: \"{{ uuid }}\"`,\n [UUIDS_FOUND]: `Multiple UUIDs found: \"{{ uuids }}\"`,\n },\n },\n create(context) {\n const sourceCode = context.getSourceCode();\n const comments = sourceCode.getAllComments();\n\n comments.forEach((comment) => {\n if (comment.loc !== undefined && comment.loc !== null) {\n checkForUuid(comment.value, context, undefined, comment.loc);\n }\n });\n return {\n Literal(node) {\n if (node.value === undefined) {\n return;\n }\n if (typeof node.value !== 'string') {\n return;\n }\n const value = `${node.value}`;\n checkForUuid(value, context, node);\n },\n TemplateElement(node) {\n if (!node.value) {\n return;\n }\n if (typeof node.value.cooked !== 'string') {\n return;\n }\n checkForUuid(node.value.cooked, context, node);\n },\n };\n },\n} as Rule.RuleModule;\n","// index.ts\n\n/*\n * Copyright (c) 2021-2022 Check Digit, LLC\n *\n * This code is licensed under the MIT license (see LICENSE.txt for details).\n */\n\nimport filePathComment from './file-path-comment';\nimport noCardNumbers from './no-card-numbers';\nimport noUuid from './no-uuid';\n\nexport default {\n rules: {\n 'file-path-comment': filePathComment,\n 'no-card-numbers': noCardNumbers,\n 'no-uuid': noUuid,\n },\n configs: {\n all: {\n rules: {\n '@checkdigit/no-card-numbers': 'error',\n '@checkdigit/file-path-comment': 'error',\n '@checkdigit/no-uuid': 'error',\n },\n },\n recommended: {\n rules: {\n '@checkdigit/no-card-numbers': 'error',\n '@checkdigit/file-path-comment': 'off',\n '@checkdigit/no-uuid': 'error',\n },\n },\n },\n};\n","// file-path-comment.ts\n\nimport type { Rule } from 'eslint';\n\n/*\n * Copyright (c) 2021-2022 Check Digit, LLC\n *\n * This code is licensed under the MIT license (see LICENSE.txt for details).\n */\n\nexport default {\n meta: {\n type: 'suggestion',\n docs: {\n description: 'Validate that first line of file is a path to the file',\n url: 'https://github.com/checkdigit/eslint-plugin',\n },\n fixable: 'code',\n },\n create(context) {\n const firstLine = context.getSourceCode().getLines()[0] as string;\n const expectedPath = context.getFilename().split('src/')[1];\n\n if (expectedPath === undefined) {\n return {};\n }\n\n if (!firstLine.startsWith('//')) {\n if (firstLine.startsWith('/*')) {\n context.report({\n loc: {\n start: {\n line: 0,\n column: 0,\n },\n end: {\n line: 0,\n column: 1,\n },\n },\n message: 'first line cannot be a block comment',\n fix(fixer: Rule.RuleFixer) {\n return fixer.insertTextBeforeRange([0, 0], `// ${expectedPath}\\n\\n`);\n },\n });\n } else {\n context.report({\n loc: {\n start: {\n line: 0,\n column: 0,\n },\n end: {\n line: 0,\n column: 1,\n },\n },\n message: 'first line is not a comment with the file path',\n fix(fixer: Rule.RuleFixer) {\n return fixer.insertTextBeforeRange([0, 0], `// ${expectedPath}\\n\\n`);\n },\n });\n }\n } else {\n const actualComment = firstLine.split('// ')[1];\n if (expectedPath !== actualComment) {\n context.report({\n loc: {\n start: {\n line: 0,\n column: 0,\n },\n end: {\n line: 0,\n column: 1,\n },\n },\n message: 'first line is a comment but is not a path to the file',\n fix(fixer: Rule.RuleFixer) {\n return fixer.replaceTextRange([0, firstLine.length], `// ${expectedPath}`);\n },\n });\n }\n }\n\n return {};\n },\n} as Rule.RuleModule;\n"],"names":["CARD_NUMBER_FOUND","CARD_NUMBERS_FOUND","cardNumberRegex","allowCardNumbers","checkForCardNumbers","value","context","node","loc","matches","match","cardNumbers","filter","split","reverse","map","digit","parseInt","reduce","previousValue","currentValue","index","indexOf","length","undefined","report","messageId","data","number","start","end","numbers","join","UUID_FOUND","UUIDS_FOUND","uuidRegex","checkForUuid","uuid","uuids","rules","meta","type","docs","description","url","fixable","create","firstLine","getSourceCode","getLines","expectedPath","getFilename","startsWith","actualComment","line","column","message","fix","fixer","replaceTextRange","insertTextBeforeRange","messages","getAllComments","forEach","comment","Literal","TemplateElement","cooked","configs","all","recommended"],"mappings":"aAWA,MAAMA,EAAoB,oBACpBC,EAAqB,qBACrBC,EAAkB,eAClBC,EAAmB,CACvB,mBACA,kBACA,kBACA,mBACA,oBACA,qBACA,uBAyBF,SAASC,EAAoBC,EAAeC,EAA2BC,EAAaC,GAClF,MAAMC,EAAUJ,EAAMK,MAAMR,GAC5B,GAAgB,OAAZO,EACF,OAEF,MAAME,EAAcF,EAAQG,QACzBF,GACWA,EA1BTG,MAAM,IACNC,UACAC,KAAKC,GAAUC,SAASD,EAAO,MAC/BE,QAAO,CAACC,EAAeC,EAAcC,KACpC,IAAIhB,EAAQe,EAQZ,OAPIC,EAAQ,GAAM,IAChBhB,GAAS,EAELA,EAAQ,IACVA,EAASA,EAAQ,GAAM,IAGpBc,EAAgBd,CAAK,GAC3B,GACH,IACF,IAYuC,IAArCF,EAAiBmB,QAAQZ,IAEZ,MAAbA,EAAM,IACO,MAAbA,EAAM,IACO,MAAbA,EAAM,IACO,MAAbA,EAAM,IACO,MAAbA,EAAM,KAEiB,IAAvBC,EAAYY,YACDC,IAATjB,EACFD,EAAQmB,OAAO,CACbC,UAAW1B,EACX2B,KAAM,CACJC,OAAQjB,EAAY,IAEtBJ,cAEeiB,IAARhB,GACTF,EAAQmB,OAA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AKF,OAA4C,iBAAfE,EAAKF,MAChD,OAGFD,EADc,GAAGG,EAAKF,QACKC,EAASC,EACrC,EACD2D,gBAAgB3D,GACTA,EAAKF,OAGuB,iBAAtBE,EAAKF,MAAM8D,QAGtB/D,EAAoBG,EAAKF,MAAM8D,OAAQ7D,EAASC,EACjD,KEnIH,UDiDW,CACbiC,KAAM,CACJC,KAAM,UACNC,KAAM,CACJC,YAAa,8CACbC,IAAK,+CAEPiB,SAAU,CACR5B,CAACA,GAAa,2BACdC,CAACA,GAAc,wCAGnBY,OAAOxC,IACcA,EAAQ0C,gBACCc,iBAEnBC,SAASC,SACIxC,IAAhBwC,EAAQxD,KAAqC,OAAhBwD,EAAQxD,KACvC4B,EAAa4B,EAAQ3D,MAAOC,OAASkB,EAAWwC,EAAQxD,IACzD,IAEI,CACLyD,QAAQ1D,GACN,QAAmBiB,IAAfjB,EAAKF,MACP,OAEF,GAA0B,iBAAfE,EAAKF,MACd,OAGF+B,EADc,GAAG7B,EAAKF,QACFC,EAASC,EAC9B,EACD2D,gBAAgB3D,GACTA,EAAKF,OAGuB,iBAAtBE,EAAKF,MAAM8D,QAGtB/B,EAAa7B,EAAKF,MAAM8D,OAAQ7D,EAASC,EAC1C,MCvFL6D,QAAS,CACPC,IAAK,CACH9B,MAAO,CACL,8BAA+B,QAC/B,gCAAiC,QACjC,sBAAuB,UAG3B+B,YAAa,CACX/B,MAAO,CACL,8BAA+B,QAC/B,gCAAiC,MACjC,sBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkdigit/eslint-plugin",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Check Digit eslint plugins",
|
|
5
5
|
"prettier": "@checkdigit/prettier-config",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "git+https://github.com/checkdigit/eslint-plugin.git"
|
|
17
17
|
},
|
|
18
|
-
"author": "",
|
|
18
|
+
"author": "Check Digit, LLC",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/checkdigit/eslint-plugin/issues"
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"eslint": ">=8"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@checkdigit/jest-config": "^2.
|
|
29
|
-
"@checkdigit/prettier-config": "^3.
|
|
30
|
-
"@checkdigit/typescript-config": "^3.
|
|
31
|
-
"@types/eslint": "^8.
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
33
|
-
"@typescript-eslint/parser": "^5.
|
|
34
|
-
"eslint-config-prettier": "^8.
|
|
28
|
+
"@checkdigit/jest-config": "^2.2.1",
|
|
29
|
+
"@checkdigit/prettier-config": "^3.4.0",
|
|
30
|
+
"@checkdigit/typescript-config": "^3.3.0",
|
|
31
|
+
"@types/eslint": "^8.37.0",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
|
33
|
+
"@typescript-eslint/parser": "^5.59.7",
|
|
34
|
+
"eslint-config-prettier": "^8.8.0",
|
|
35
35
|
"eslint-plugin-deprecate": "^0.7.0",
|
|
36
|
-
"eslint-plugin-eslint-plugin": "^5.0
|
|
37
|
-
"eslint-plugin-import": "^2.
|
|
38
|
-
"eslint-plugin-no-only-tests": "^3.
|
|
36
|
+
"eslint-plugin-eslint-plugin": "^5.1.0",
|
|
37
|
+
"eslint-plugin-import": "^2.27.5",
|
|
38
|
+
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
39
39
|
"eslint-plugin-no-secrets": "^0.8.9",
|
|
40
40
|
"eslint-plugin-node": "^11.1.0",
|
|
41
|
-
"eslint-plugin-sonarjs": "^0.
|
|
41
|
+
"eslint-plugin-sonarjs": "^0.19.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"postversion": "git push && git push --tags",
|
|
@@ -55,5 +55,9 @@
|
|
|
55
55
|
},
|
|
56
56
|
"jest": {
|
|
57
57
|
"preset": "@checkdigit/jest-config"
|
|
58
|
-
}
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist",
|
|
61
|
+
"SECURITY.md"
|
|
62
|
+
]
|
|
59
63
|
}
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches:
|
|
6
|
-
- 'main'
|
|
7
|
-
|
|
8
|
-
env:
|
|
9
|
-
CI: true
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
pullRequestBuild:
|
|
13
|
-
name: Pull Request Build
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
strategy:
|
|
16
|
-
matrix:
|
|
17
|
-
node-version: [16.x, 18.x]
|
|
18
|
-
steps:
|
|
19
|
-
- uses: actions/checkout@v3
|
|
20
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
-
uses: actions/setup-node@v3
|
|
22
|
-
with:
|
|
23
|
-
node-version: ${{ matrix.node-version }}
|
|
24
|
-
cache: 'npm'
|
|
25
|
-
- name: Install dependencies
|
|
26
|
-
run: npm ci --ignore-scripts
|
|
27
|
-
env:
|
|
28
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
29
|
-
- name: Audit Signatures
|
|
30
|
-
run: npm audit signatures
|
|
31
|
-
env:
|
|
32
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
33
|
-
- name: Compile
|
|
34
|
-
run: npm run ci:compile
|
|
35
|
-
- name: Check Code Style
|
|
36
|
-
run: npm run ci:style
|
|
37
|
-
- name: Perform Linting
|
|
38
|
-
run: npm run ci:lint
|
|
39
|
-
- name: Run Tests
|
|
40
|
-
run: npm run ci:test
|
|
41
|
-
|
|
42
|
-
branchBuild:
|
|
43
|
-
runs-on: ubuntu-latest
|
|
44
|
-
name: Branch Build
|
|
45
|
-
strategy:
|
|
46
|
-
matrix:
|
|
47
|
-
node-version: [16.x, 18.x]
|
|
48
|
-
steps:
|
|
49
|
-
- uses: actions/checkout@v3
|
|
50
|
-
with:
|
|
51
|
-
ref: ${{ github.event.pull_request.head.sha }}
|
|
52
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
53
|
-
uses: actions/setup-node@v3
|
|
54
|
-
with:
|
|
55
|
-
node-version: ${{ matrix.node-version }}
|
|
56
|
-
cache: 'npm'
|
|
57
|
-
- name: Install dependencies
|
|
58
|
-
run: npm ci --ignore-scripts
|
|
59
|
-
env:
|
|
60
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
61
|
-
- name: Audit Signatures
|
|
62
|
-
run: npm audit signatures
|
|
63
|
-
env:
|
|
64
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
65
|
-
- name: Compile
|
|
66
|
-
run: npm run ci:compile
|
|
67
|
-
- name: Check Code Style
|
|
68
|
-
run: npm run ci:style
|
|
69
|
-
- name: Perform Linting
|
|
70
|
-
run: npm run ci:lint
|
|
71
|
-
- name: Run Tests
|
|
72
|
-
run: npm run ci:test
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
name: 'CodeQL'
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: ['main']
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: ['main']
|
|
8
|
-
schedule:
|
|
9
|
-
- cron: '44 8 * * 1'
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
analyze:
|
|
13
|
-
name: Analyze
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
permissions:
|
|
16
|
-
actions: read
|
|
17
|
-
contents: read
|
|
18
|
-
security-events: write
|
|
19
|
-
strategy:
|
|
20
|
-
fail-fast: false
|
|
21
|
-
matrix:
|
|
22
|
-
language: ['javascript']
|
|
23
|
-
steps:
|
|
24
|
-
- name: Checkout repository
|
|
25
|
-
uses: actions/checkout@v3
|
|
26
|
-
- name: Initialize CodeQL
|
|
27
|
-
uses: github/codeql-action/init@v2
|
|
28
|
-
with:
|
|
29
|
-
languages: ${{ matrix.language }}
|
|
30
|
-
- name: Perform CodeQL Analysis
|
|
31
|
-
uses: github/codeql-action/analyze@v2
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
name: Coverage
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches:
|
|
6
|
-
- 'main'
|
|
7
|
-
|
|
8
|
-
env:
|
|
9
|
-
CI: true
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
branchBuild:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
name: Branch Build
|
|
15
|
-
strategy:
|
|
16
|
-
matrix:
|
|
17
|
-
node-version: [16.x]
|
|
18
|
-
steps:
|
|
19
|
-
- uses: actions/checkout@v3
|
|
20
|
-
with:
|
|
21
|
-
ref: ${{ github.event.pull_request.head.sha }}
|
|
22
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
23
|
-
uses: actions/setup-node@v3
|
|
24
|
-
with:
|
|
25
|
-
node-version: ${{ matrix.node-version }}
|
|
26
|
-
cache: 'npm'
|
|
27
|
-
- name: Install dependencies
|
|
28
|
-
run: npm ci --ignore-scripts
|
|
29
|
-
env:
|
|
30
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
31
|
-
- name: Calculate Code Coverage
|
|
32
|
-
run: npm run ci:coverage
|
|
33
|
-
- name: Create Coverage Report for base branch
|
|
34
|
-
run: |
|
|
35
|
-
mv coverage/lcov.info coverage/lcov_head.info
|
|
36
|
-
git fetch
|
|
37
|
-
git checkout origin/${{ github.event.pull_request.base.ref }}
|
|
38
|
-
npm ci --ignore-scripts && npm run ci:coverage
|
|
39
|
-
env:
|
|
40
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
41
|
-
- name: Post Coverage Report
|
|
42
|
-
uses: checkdigit/github-actions/coverage-reporter@main
|
|
43
|
-
with:
|
|
44
|
-
lcov-file: 'coverage/lcov_head.info'
|
|
45
|
-
lcov-base: 'coverage/lcov.info'
|
|
46
|
-
delete-old-comments: true
|