From 7ed1e9145e2bd20ae860c53a2b6d0d4a40327a53 Mon Sep 17 00:00:00 2001 From: Nick Rutten <2504906+nickrttn@users.noreply.github.com> Date: Thu, 2 Nov 2023 10:04:58 +0100 Subject: [PATCH 1/2] Port to ESM --- package.json | 6 +-- packages/abbr/package.json | 7 +--- packages/analyze-step/package.json | 7 +--- packages/analyze-step/src/analyzeStep.ts | 34 +++++++++-------- packages/enrich-tweet/package.json | 7 +--- packages/file-exists/package.json | 7 +--- packages/format-duration-ms/package.json | 7 +--- packages/has-property/package.json | 7 +--- packages/post/package.json | 9 ++--- packages/post/src/post.ts | 4 +- packages/pr/package.json | 7 +--- packages/prd/package.json | 7 +--- packages/prettier-bytes/package.json | 3 +- packages/slugify/package.json | 7 +--- packages/sort-assembly/package.json | 3 +- packages/sort-assembly/src/sortAssembly.ts | 13 +++++-- packages/sort-object-by-prio/package.json | 7 +--- .../src/sortObjectByPrio.ts | 3 +- packages/sort-object/package.json | 7 +--- packages/sort-result-meta/package.json | 7 +--- .../sort-result-meta/src/sortResultMeta.ts | 2 +- packages/sort-result/package.json | 8 +--- packages/sort-result/src/sortResult.ts | 3 +- packages/trigger-pager/package.json | 3 +- packages/trigger-pager/src/triggerPager.ts | 15 ++++---- tsconfig.json | 27 +++++++++----- yarn.lock | 37 ++++--------------- 27 files changed, 106 insertions(+), 148 deletions(-) diff --git a/package.json b/package.json index 701c3fb..93342e6 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,8 @@ "@types/inflection": "^1.13.1", "@types/jest": "^29.0.0", "@types/node": "^18.7.14", - "@typescript-eslint/eslint-plugin": "^5.36.1", - "@typescript-eslint/parser": "^5.36.1", + "@typescript-eslint/eslint-plugin": "^5.62.0", + "@typescript-eslint/parser": "^5.62.0", "eslint": "^8.23.0", "eslint-config-prettier": "^8.8.0", "eslint-config-transloadit": "^2.0.0", @@ -58,6 +58,6 @@ "prettier": "^2.8.6", "replace-require-with-import": "^2.1.0", "sucrase": "^3.25.0", - "typescript": "^4.8.2" + "typescript": "^5.2.2" } } diff --git a/packages/abbr/package.json b/packages/abbr/package.json index ff813e0..ff3a0ac 100644 --- a/packages/abbr/package.json +++ b/packages/abbr/package.json @@ -9,15 +9,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/abbr" }, + "type": "module", "main": "dist/abbr.js", - "typings": "dist/abbr.d.ts", + "types": "dist/abbr.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/analyze-step/package.json b/packages/analyze-step/package.json index 154a218..9eff8dc 100644 --- a/packages/analyze-step/package.json +++ b/packages/analyze-step/package.json @@ -9,15 +9,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/analyze-step" }, + "type": "module", "main": "dist/analyzeStep.js", - "typings": "dist/analyzeStep.d.ts", + "types": "dist/analyzeStep.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/analyze-step/src/analyzeStep.ts b/packages/analyze-step/src/analyzeStep.ts index c4b9c02..b325e6b 100644 --- a/packages/analyze-step/src/analyzeStep.ts +++ b/packages/analyze-step/src/analyzeStep.ts @@ -21,7 +21,7 @@ function humanJoin(array: string[], reduce = true, glueword = 'and'): string { } } - if (countedArray.length === 1) { + if (countedArray.length === 1 && typeof countedArray[0] === 'string') { return countedArray[0] } @@ -67,9 +67,9 @@ function humanFilter(step: FileFilterStep): string { for (const type of types) { collection[type] = collection[type] || [] if (typeof step[type] === 'string') { - collection[type].push(`Filter by code evaluation`) + collection[type]?.push(`Filter by code evaluation`) } else if (step[type] && Array.isArray(step[type])) { - for (const [key, operator, val] of Object.values(step[type])) { + for (const [key, operator, val] of Object.values(step[type]!)) { const template = clone(templates[operator]) if (!template) { throw new Error( @@ -145,7 +145,7 @@ function humanFilter(step: FileFilterStep): string { humanDescr = humanDescr.replace('wi2th', 'with') } - collection[type].push(humanDescr) + collection[type]?.push(humanDescr) lastTemplate = template } } @@ -211,11 +211,11 @@ function humanDimensions(step: StepWithDimensions): string { if ('width' in step && 'height' in step) { str += ` to ${step.width}×${step.height}` - } else if ('width' in step) { + } else if (step.width) { str += ` to ${step.width} pixels wide` - } else if ('height' in step) { + } else if (step.height) { str += ` to ${step.height} pixels high` - } else if ('crop' in step) { + } else if (step.crop) { str += ` to ${step.crop.x2 - step.crop.x1}×${step.crop.y2 - step.crop.y1} starting at ${ step.crop.x1 }×${step.crop.y1} from the top left` @@ -233,6 +233,8 @@ type ExtraMeta = { } function humanPreset(step: PresetStep, extrameta: ExtraMeta = {}): string { + if (!step.preset) return '' + let str = inflect.humanize(step.preset.replace(/[-_]/g, ' ')) if (str.match(/^ipad/i)) { @@ -278,6 +280,8 @@ type FormatStep = { } function humanFormat(step: FormatStep): string { + if (!step.format) return '' + let str = inflect.humanize(step.format.replace(/[-_]/g, ' ')) if (str.match(/^webp/i)) { @@ -309,9 +313,9 @@ export default function humanize(step: Step, robots: Robots, extrameta: ExtraMet let str = `` const robot = robots[step.robot] - str = robot.purpose_words + str = robot?.purpose_words ?? '' - if (robot.rname === '/video/encode') { + if (robot?.rname === '/video/encode') { if (JSON.stringify(step).match(/watermark/)) { str = `Watermark videos` } else if (get(step, 'ffmpeg.t') && get(step, 'ffmpeg.ss')) { @@ -358,7 +362,7 @@ export default function humanize(step: Step, robots: Robots, extrameta: ExtraMet } } - if (robot.rname === '/audio/encode') { + if (robot?.rname === '/audio/encode') { if (has(step, 'ffmpeg.ss') && has(step, 'ffmpeg.t')) { str = `Take a ${get(step, 'ffmpeg.t')}s clip out of audio at a specified offset` } else if ( @@ -382,7 +386,7 @@ export default function humanize(step: Step, robots: Robots, extrameta: ExtraMet } } - if (robot.rname === '/video/adaptive') { + if (robot?.rname === '/video/adaptive') { if (step.technique === 'hls') { str = `Convert videos to HLS` } else if (step.technique === 'dash') { @@ -390,7 +394,7 @@ export default function humanize(step: Step, robots: Robots, extrameta: ExtraMet } } - if (robot.rname === '/video/merge') { + if (robot?.rname === '/video/merge') { const types = JSONPath({ path: '$..as', json: step }) if (types.length) { str = `Merge ${humanJoin(types)} to create a new video` @@ -399,11 +403,11 @@ export default function humanize(step: Step, robots: Robots, extrameta: ExtraMet } } - if (robot.rname === '/file/filter') { + if (robot?.rname === '/file/filter') { str = humanFilter(step as FileFilterStep) } - if (robot.rname === '/audio/artwork') { + if (robot?.rname === '/audio/artwork') { if (get(step, 'method') === 'insert') { str = `Insert audio artwork` } else { @@ -411,7 +415,7 @@ export default function humanize(step: Step, robots: Robots, extrameta: ExtraMet } } - if (robot.rname === '/image/resize') { + if (robot?.rname === '/image/resize') { if ('watermark_url' in step) { str = `Watermark images` } else if ('sepia' in step) { diff --git a/packages/enrich-tweet/package.json b/packages/enrich-tweet/package.json index 252a9c9..9be3579 100644 --- a/packages/enrich-tweet/package.json +++ b/packages/enrich-tweet/package.json @@ -10,15 +10,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/enrich-tweet" }, + "type": "module", "main": "dist/enrichTweet.js", - "typings": "dist/enrichTweet.d.ts", + "types": "dist/enrichTweet.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/file-exists/package.json b/packages/file-exists/package.json index a8c35ae..0fcd305 100644 --- a/packages/file-exists/package.json +++ b/packages/file-exists/package.json @@ -10,15 +10,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/file-exists" }, + "type": "module", "main": "dist/fileExists.js", - "typings": "dist/fileExists.d.ts", + "types": "dist/fileExists.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/format-duration-ms/package.json b/packages/format-duration-ms/package.json index 9241830..fea00d1 100644 --- a/packages/format-duration-ms/package.json +++ b/packages/format-duration-ms/package.json @@ -9,15 +9,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/format-duration-ms" }, + "type": "module", "main": "dist/formatDurationMs.js", - "typings": "dist/formatDurationMs.d.ts", + "types": "dist/formatDurationMs.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/has-property/package.json b/packages/has-property/package.json index 08c819c..397a280 100644 --- a/packages/has-property/package.json +++ b/packages/has-property/package.json @@ -10,15 +10,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/has-property" }, + "type": "module", "main": "dist/has-property.js", - "typings": "dist/has-property.d.ts", + "types": "dist/has-property.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/post/package.json b/packages/post/package.json index 596e188..12cdfc1 100644 --- a/packages/post/package.json +++ b/packages/post/package.json @@ -9,15 +9,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/post" }, - "bin": "./post.js", - "typings": "dist/post.d.ts", + "type": "module", + "bin": "dist/post.js", + "types": "dist/post.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/post/src/post.ts b/packages/post/src/post.ts index c1227e1..20be533 100644 --- a/packages/post/src/post.ts +++ b/packages/post/src/post.ts @@ -19,7 +19,9 @@ async function post(): Promise { throw new Error(`Dir does not exist: '${postDir.replace(process.cwd(), '.')}'`) } - const mysqlNow = new Date().toISOString().replace('T', ' ').split('.')[0].split(' ')[0] + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const mysqlNow = new Date().toISOString().replace('T', ' ').split('.')[0]!.split(' ')[0]! + // eslint-disable-next-line no-unused-vars const [dateY, datem] = mysqlNow.split('-') const answers = await inquirer.prompt([ diff --git a/packages/pr/package.json b/packages/pr/package.json index 5f5cc74..4ce168f 100644 --- a/packages/pr/package.json +++ b/packages/pr/package.json @@ -10,15 +10,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/pr" }, + "type": "module", "main": "dist/pr.js", - "typings": "dist/pr.d.ts", + "types": "dist/pr.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/prd/package.json b/packages/prd/package.json index aa5b426..cff5f09 100644 --- a/packages/prd/package.json +++ b/packages/prd/package.json @@ -10,15 +10,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/prd" }, + "type": "module", "main": "dist/prd.js", - "typings": "dist/prd.d.ts", + "types": "dist/prd.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/prettier-bytes/package.json b/packages/prettier-bytes/package.json index a03c0d1..2ae4487 100644 --- a/packages/prettier-bytes/package.json +++ b/packages/prettier-bytes/package.json @@ -10,8 +10,9 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/prettier-bytes" }, + "type": "module", "main": "dist/prettierBytes.js", - "typings": "dist/prettierBytes.d.ts", + "types": "dist/prettierBytes.d.ts", "files": [ "dist" ], diff --git a/packages/slugify/package.json b/packages/slugify/package.json index d240804..f482fda 100644 --- a/packages/slugify/package.json +++ b/packages/slugify/package.json @@ -10,15 +10,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/slugify" }, + "type": "module", "main": "dist/slugify.js", - "typings": "dist/slugify.d.ts", + "types": "dist/slugify.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/sort-assembly/package.json b/packages/sort-assembly/package.json index 9347b81..5e81d1f 100644 --- a/packages/sort-assembly/package.json +++ b/packages/sort-assembly/package.json @@ -10,8 +10,9 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/sort-assembly" }, + "type": "module", "main": "dist/sortAssembly.js", - "typings": "dist/sortAssembly.d.ts", + "types": "dist/sortAssembly.d.ts", "files": [ "dist" ], diff --git a/packages/sort-assembly/src/sortAssembly.ts b/packages/sort-assembly/src/sortAssembly.ts index 4909544..76c4b2c 100644 --- a/packages/sort-assembly/src/sortAssembly.ts +++ b/packages/sort-assembly/src/sortAssembly.ts @@ -8,21 +8,26 @@ export default function sortAssembly>(assembly z: ['uploads', 'results'], }) - if ('results' in sorted && typeof sorted.results === 'object') { + if (sorted.results && typeof sorted.results === 'object') { for (const stepName of Object.keys(sorted.results)) { if (!hasProperty(sorted.results, stepName)) continue const result = sorted.results[stepName] + if (!result || typeof result !== 'object') continue for (const i of Object.keys(result)) { if (!hasProperty(result, i)) continue - result[i] = sortResult(result[i]) + const value = result[i] + if (!value || typeof value !== 'object') continue + result[i] = sortResult(value) } } } - if ('uploads' in sorted) { + if (sorted.uploads) { for (const i of Object.keys(sorted.uploads)) { if (!hasProperty(sorted.uploads, i)) continue - sorted.uploads[i] = sortResult(sorted.uploads[i]) + const upload = sorted.uploads[i] + if (!upload || typeof upload !== 'object') continue + sorted.uploads[i] = sortResult(upload) } } diff --git a/packages/sort-object-by-prio/package.json b/packages/sort-object-by-prio/package.json index d326afd..e8c74f3 100644 --- a/packages/sort-object-by-prio/package.json +++ b/packages/sort-object-by-prio/package.json @@ -10,15 +10,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/sort-object-by-prio" }, + "type": "module", "main": "dist/sortObjectByPrio.js", - "typings": "dist/sortObjectByPrio.d.ts", + "types": "dist/sortObjectByPrio.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/sort-object-by-prio/src/sortObjectByPrio.ts b/packages/sort-object-by-prio/src/sortObjectByPrio.ts index 318d186..47d0bd0 100644 --- a/packages/sort-object-by-prio/src/sortObjectByPrio.ts +++ b/packages/sort-object-by-prio/src/sortObjectByPrio.ts @@ -14,7 +14,8 @@ export default function sortObjectByPrio>( for (const [prefix, items] of Object.entries(prefixes)) { let i = 0 for (const matcher of items) { - const modifier = parseInt(String(prefix === '_' ? prefixes[prefix].length - i : i), 10) + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const modifier = parseInt(String(prefix === '_' ? prefixes[prefix]!.length - i : i), 10) const numOfPrefix = 3 + modifier const strPref = new Array(numOfPrefix).join(prefix) diff --git a/packages/sort-object/package.json b/packages/sort-object/package.json index aa5971f..d0cc410 100644 --- a/packages/sort-object/package.json +++ b/packages/sort-object/package.json @@ -10,15 +10,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/sort-object" }, + "type": "module", "main": "dist/sortObject.js", - "typings": "dist/sortObject.d.ts", + "types": "dist/sortObject.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/sort-result-meta/package.json b/packages/sort-result-meta/package.json index 2ca9d64..85b7d03 100644 --- a/packages/sort-result-meta/package.json +++ b/packages/sort-result-meta/package.json @@ -10,15 +10,12 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/sort-result-meta" }, + "type": "module", "main": "dist/sortResultMeta.js", - "typings": "dist/sortResultMeta.d.ts", + "types": "dist/sortResultMeta.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/sort-result-meta/src/sortResultMeta.ts b/packages/sort-result-meta/src/sortResultMeta.ts index 1020b60..7298f12 100644 --- a/packages/sort-result-meta/src/sortResultMeta.ts +++ b/packages/sort-result-meta/src/sortResultMeta.ts @@ -12,7 +12,7 @@ function isObject(obj: unknown): obj is Record { } export default function sortResultMeta(meta: T): T { - if (hasProperty(meta, 'faces')) { + if (meta.faces) { for (const key of Object.keys(meta.faces)) { if (!hasProperty(meta.faces, key)) continue diff --git a/packages/sort-result/package.json b/packages/sort-result/package.json index 11db160..0252bf3 100644 --- a/packages/sort-result/package.json +++ b/packages/sort-result/package.json @@ -10,21 +10,17 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/sort-result" }, + "type": "module", "main": "dist/sortResult.js", - "typings": "dist/sortResult.d.ts", + "types": "dist/sortResult.d.ts", "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" }, "dependencies": { - "@transloadit/has-property": "^0.0.1", "@transloadit/sort-object-by-prio": "^0.1.3", "@transloadit/sort-result-meta": "^0.1.3" } diff --git a/packages/sort-result/src/sortResult.ts b/packages/sort-result/src/sortResult.ts index a86af29..e0ed9b2 100644 --- a/packages/sort-result/src/sortResult.ts +++ b/packages/sort-result/src/sortResult.ts @@ -1,4 +1,3 @@ -import { hasProperty } from '@transloadit/has-property' import sortObjectByPrio from '@transloadit/sort-object-by-prio' import sortResultMeta from '@transloadit/sort-result-meta' @@ -8,7 +7,7 @@ export default function sortResult(result: T): T { z: ['meta'], }) - if (hasProperty(sorted, 'meta')) { + if (sorted.meta && typeof sorted.meta === 'object') { sorted.meta = sortResultMeta(sorted.meta) } diff --git a/packages/trigger-pager/package.json b/packages/trigger-pager/package.json index 305c47b..0d25bf6 100644 --- a/packages/trigger-pager/package.json +++ b/packages/trigger-pager/package.json @@ -10,8 +10,9 @@ "url": "git://github.com/transloadit/monolib.git", "directory": "packages/trigger-pager" }, + "type": "module", "main": "dist/triggerPager.js", - "typings": "dist/triggerPager.d.ts", + "types": "dist/triggerPager.d.ts", "files": [ "dist" ], diff --git a/packages/trigger-pager/src/triggerPager.ts b/packages/trigger-pager/src/triggerPager.ts index 1c03cf1..5b3d5f6 100644 --- a/packages/trigger-pager/src/triggerPager.ts +++ b/packages/trigger-pager/src/triggerPager.ts @@ -1,5 +1,4 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const { api } = require('@pagerduty/pdjs') +import { api } from '@pagerduty/pdjs' const PRIORITY_P1 = 'PUTY3A1' const DUPLICATE_INCIDENT_MESSAGE = 'matching dedup key already exists' @@ -7,7 +6,7 @@ const DUPLICATE_INCIDENT_MESSAGE = 'matching dedup key already exists' export type TriggerPagerOptions = { description: string from?: string - incidentKey?: string + incidentKey: string serviceId?: string title: string token?: string @@ -15,13 +14,13 @@ export type TriggerPagerOptions = { } const triggerPager = async ({ - token, - serviceId, - incidentKey, - urgency = 'high', + description, from = 'tim.koschuetzki@transloadit.com', + incidentKey, + serviceId, title = incidentKey, - description, + token, + urgency = 'high', }: TriggerPagerOptions): Promise => { const res = await api({ token }).post('/incidents', { headers: { diff --git a/tsconfig.json b/tsconfig.json index 573a0b7..116f803 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,25 @@ { "compilerOptions": { - "module": "commonjs", - "declaration": true, - "noImplicitAny": true, - "removeComments": true, - "noLib": false, - "emitDecoratorMetadata": true, "esModuleInterop": true, - "experimentalDecorators": true, - "target": "es6", - "sourceMap": true, + "forceConsistentCasingInFileNames": true, "skipLibCheck": true, + "target": "es2022", + "verbatimModuleSyntax": true, + "allowJs": false, + "resolveJsonModule": true, + "moduleDetection": "force", + + "strict": true, + "noUncheckedIndexedAccess": true, + + "module": "NodeNext", + "moduleResolution": "NodeNext", + + "declaration": true, + "sourceMap": true, + + "experimentalDecorators": true, + "lib": ["es2022"], "types": ["node", "jest"] }, diff --git a/yarn.lock b/yarn.lock index d09616d..60565f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1487,7 +1487,7 @@ __metadata: open-in-editor: "npm:^2.2.0" title: "npm:^3.4.2" bin: - post: ./post.js + post: dist/post.js languageName: unknown linkType: soft @@ -1556,7 +1556,6 @@ __metadata: version: 0.0.0-use.local resolution: "@transloadit/sort-result@workspace:packages/sort-result" dependencies: - "@transloadit/has-property": "npm:^0.0.1" "@transloadit/sort-object-by-prio": "npm:^0.1.3" "@transloadit/sort-result-meta": "npm:^0.1.3" languageName: unknown @@ -1809,7 +1808,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.36.1": +"@typescript-eslint/eslint-plugin@npm:^5.62.0": version: 5.62.0 resolution: "@typescript-eslint/eslint-plugin@npm:5.62.0" dependencies: @@ -1833,7 +1832,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.36.1": +"@typescript-eslint/parser@npm:^5.62.0": version: 5.62.0 resolution: "@typescript-eslint/parser@npm:5.62.0" dependencies: @@ -7217,8 +7216,8 @@ __metadata: "@types/inflection": "npm:^1.13.1" "@types/jest": "npm:^29.0.0" "@types/node": "npm:^18.7.14" - "@typescript-eslint/eslint-plugin": "npm:^5.36.1" - "@typescript-eslint/parser": "npm:^5.36.1" + "@typescript-eslint/eslint-plugin": "npm:^5.62.0" + "@typescript-eslint/parser": "npm:^5.62.0" eslint: "npm:^8.23.0" eslint-config-prettier: "npm:^8.8.0" eslint-config-transloadit: "npm:^2.0.0" @@ -7242,7 +7241,7 @@ __metadata: replace: "npm:1.2.1" replace-require-with-import: "npm:^2.1.0" sucrase: "npm:^3.25.0" - typescript: "npm:^4.8.2" + typescript: "npm:^5.2.2" languageName: unknown linkType: soft @@ -9904,7 +9903,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:>=3 < 6": +"typescript@npm:>=3 < 6, typescript@npm:^5.2.2": version: 5.2.2 resolution: "typescript@npm:5.2.2" bin: @@ -9914,17 +9913,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^4.8.2": - version: 4.9.5 - resolution: "typescript@npm:4.9.5" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 5f6cad2e728a8a063521328e612d7876e12f0d8a8390d3b3aaa452a6a65e24e9ac8ea22beb72a924fd96ea0a49ea63bb4e251fb922b12eedfb7f7a26475e5c56 - languageName: node - linkType: hard - -"typescript@patch:typescript@npm%3A>=3 < 6#optional!builtin": +"typescript@patch:typescript@npm%3A>=3 < 6#optional!builtin, typescript@patch:typescript@npm%3A^5.2.2#optional!builtin": version: 5.2.2 resolution: "typescript@patch:typescript@npm%3A5.2.2#optional!builtin::version=5.2.2&hash=f3b441" bin: @@ -9934,16 +9923,6 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A^4.8.2#optional!builtin": - version: 4.9.5 - resolution: "typescript@patch:typescript@npm%3A4.9.5#optional!builtin::version=4.9.5&hash=289587" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: e3333f887c6829dfe0ab6c1dbe0dd1e3e2aeb56c66460cb85c5440c566f900c833d370ca34eb47558c0c69e78ced4bfe09b8f4f98b6de7afed9b84b8d1dd06a1 - languageName: node - linkType: hard - "uglify-js@npm:^3.1.4": version: 3.17.4 resolution: "uglify-js@npm:3.17.4" From 201481311da796f3522e9b952ac70da14fc792f6 Mon Sep 17 00:00:00 2001 From: Nick Rutten <2504906+nickrttn@users.noreply.github.com> Date: Thu, 2 Nov 2023 10:11:54 +0100 Subject: [PATCH 2/2] Linting fixes --- packages/enrich-tweet/src/enrichTweet.ts | 4 ++-- packages/prettier-bytes/package.json | 4 ---- packages/sort-assembly/package.json | 4 ---- packages/trigger-pager/package.json | 4 ---- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/enrich-tweet/src/enrichTweet.ts b/packages/enrich-tweet/src/enrichTweet.ts index df66b9a..6ded8dd 100644 --- a/packages/enrich-tweet/src/enrichTweet.ts +++ b/packages/enrich-tweet/src/enrichTweet.ts @@ -13,7 +13,7 @@ async function tryUnshorten(url: string, unshorten: boolean): Promise { } type Tweet = { - full_text: string + full_text?: string entities?: { urls: { display_url: string @@ -38,7 +38,7 @@ export default async function enrichTweet( ): Promise { if (!tweet) return - let text = tweet.full_text + let text = tweet.full_text ?? '' // Expand URLs if (tweet.entities && tweet.entities.urls.length) { diff --git a/packages/prettier-bytes/package.json b/packages/prettier-bytes/package.json index 2ae4487..f2a0f5b 100644 --- a/packages/prettier-bytes/package.json +++ b/packages/prettier-bytes/package.json @@ -16,10 +16,6 @@ "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/sort-assembly/package.json b/packages/sort-assembly/package.json index 5e81d1f..6652a33 100644 --- a/packages/sort-assembly/package.json +++ b/packages/sort-assembly/package.json @@ -16,10 +16,6 @@ "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/trigger-pager/package.json b/packages/trigger-pager/package.json index 0d25bf6..926825b 100644 --- a/packages/trigger-pager/package.json +++ b/packages/trigger-pager/package.json @@ -16,10 +16,6 @@ "files": [ "dist" ], - "directories": { - "lib": "dist", - "test": "dist" - }, "scripts": { "tsc": "tsc --build --clean && tsc --build", "test": "echo \"Error: run tests from root\" && exit 1"