Skip to content

Commit

Permalink
fix: replace lone surrogates in draft-js content (#9415)
Browse files Browse the repository at this point in the history
* fix: replace lone surrogates in draft-js content

Signed-off-by: Matt Krick <matt.krick@gmail.com>

* fix typo

Signed-off-by: Matt Krick <matt.krick@gmail.com>

* fix: eslint errors

Signed-off-by: Matt Krick <matt.krick@gmail.com>

---------

Signed-off-by: Matt Krick <matt.krick@gmail.com>
  • Loading branch information
mattkrick committed Feb 28, 2024
1 parent 9cec00a commit 00092ec
Show file tree
Hide file tree
Showing 11 changed files with 181 additions and 113 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/no-duplicate-enum-values': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"test:server": "yarn workspace parabol-server test"
},
"resolutions": {
"typescript": "4.9.5",
"typescript": "^5.3.3",
"hoist-non-react-statics": "^3.3.0",
"@types/react": "16.9.11",
"@types/react-dom": "16.9.4",
Expand Down Expand Up @@ -92,8 +92,8 @@
"@types/dotenv": "^6.1.1",
"@types/jscodeshift": "^0.11.3",
"@types/lodash.toarray": "^4.4.7",
"@typescript-eslint/eslint-plugin": "5.17.0",
"@typescript-eslint/parser": "5.17.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"autoprefixer": "^10.4.13",
"babel-loader": "^9.1.2",
"concurrently": "^8.0.1",
Expand Down Expand Up @@ -123,6 +123,7 @@
"tailwindcss": "^3.2.7",
"terser-webpack-plugin": "^5.3.9",
"ts-loader": "9.2.6",
"typescript": "^5.3.3",
"vscode-apollo-relay": "^1.5.0",
"webpack": "^5.89.0",
"webpack-cli": "4.9.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/chronos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"devDependencies": {
"@types/cron": "^2.0.1",
"@types/node": "^16.11.62"
"@types/node": "^20.11.17"
},
"dependencies": {
"cron": "^2.3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"prettier": "^2.8.8",
"react-refresh": "^0.9.0",
"strict-event-emitter-types": "^2.0.0",
"typescript": "4.9.5",
"typescript": "^5.3.3",
"webpack-dev-server": "^4.15.1"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/utils/AtlassianManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type JiraPermissionScope =

export class RateLimitError {
retryAt: Date
name: 'RateLimitError' = 'RateLimitError'
name = 'RateLimitError' as const
message: string

constructor(message: string, retryAt: Date) {
Expand Down
3 changes: 2 additions & 1 deletion packages/client/utils/draftjs/extractTextFromDraftString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {RawDraftContentState} from 'draft-js'

const extractTextFromDraftString = (content: string) => {
const parsedContent = JSON.parse(content) as RawDraftContentState
const textBlocks = parsedContent.blocks.map(({text}) => text)
// toWellFormed replaces lone surrogates with replacement char (e.g. emoji that only has its first code point)
const textBlocks = parsedContent.blocks.map(({text}) => (text as any).toWellFormed())
return textBlocks.join('\n')
}

Expand Down
4 changes: 2 additions & 2 deletions packages/gql-executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"devDependencies": {
"@babel/cli": "7.18.6",
"@babel/core": "7.18.6",
"@types/node": "^16.11.62",
"@types/node": "^20.11.17",
"babel-plugin-inline-import": "^3.0.0",
"chokidar": "^3.3.1",
"sucrase": "^3.32.0",
"ts-node-dev": "^1.0.0-pre.44",
"typescript": "4.9.5"
"typescript": "^5.3.3"
},
"dependencies": {
"dd-trace": "^4.2.0",
Expand Down
5 changes: 1 addition & 4 deletions packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
},
"devDependencies": {
"@playwright/test": "^1.34.3",
"@types/node": "^16.11.62",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.5.0",
"lint-staged": "^12.3.3",
"ts-app-env": "^1.4.2",
"typescript": "^4.5.5"
"typescript": "^5.3.3"
}
}
4 changes: 2 additions & 2 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@types/jsonwebtoken": "^8.3.0",
"@types/mime-types": "^2.1.0",
"@types/ms": "^0.7.30",
"@types/node": "^16.11.62",
"@types/node": "^20.11.17",
"@types/nodemailer": "^6.4.14",
"@types/relay-runtime": "^14.1.9",
"@types/sharp": "^0.32.0",
Expand Down Expand Up @@ -68,7 +68,7 @@
"sucrase": "^3.32.0",
"ts-jest": "^29.1.0",
"ts-node": "^8.6.2",
"typescript": "4.9.5",
"typescript": "^5.3.3",
"url-loader": "4.1.1",
"vscode-apollo-relay": "^1.5.0",
"webpack-bundle-analyzer": "4.3.0",
Expand Down
15 changes: 3 additions & 12 deletions packages/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,8 @@
"parabol-client/*": ["client/*"],
"~/*": ["client/*"]
},
"lib": [
"esnext",
"dom"
],
"types": [
"node",
"jest",
"jest-extended"
]
"lib": ["esnext", "dom"],
"types": ["node", "jest", "jest-extended"]
},

"exclude": [
Expand All @@ -31,9 +24,7 @@
"server.ts",
"../client/modules/email/components/SummaryEmail/MeetingSummaryEmail/MeetingSummaryEmail.tsx"
],
"include": [
"graphql/**/*.ts",
]
"include": ["graphql/**/*.ts"]

// if "include" or "files" is added, even if they are empty arrays, then strictNullChecks breaks
// repro: https://www.typescriptlang.org/play?strictFunctionTypes=false&strictPropertyInitialization=false&strictBindCallApply=false&noImplicitThis=false&noImplicitReturns=false&alwaysStrict=false&declaration=false&experimentalDecorators=false&emitDecoratorMetadata=false&target=6&ts=3.5.1#code/C4TwDgpgBA8gRgKygXigbwFBSgWwIYhwQDKwATgIJlkD8AXFAM7kCWAdgOYDaAuhgL4ZQkKFTIpYiLgHJ8hEuTHS+AYwD2bZlDwS2AVwA2B7Y21sQJ0dQx4AdADM1ZAKJ4VACwAUngF4BKFAA+KH8MIA
Expand Down

0 comments on commit 00092ec

Please sign in to comment.