Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move discussion-rendering into DCR #8057

Merged
merged 52 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
e3e20a7
initial work on moving discussion-rendering into dcr and removing pac…
Georges-GNM Jun 27, 2023
ea7b3bc
fix(lint): rename variable to fix shadowing
georgeblahblah Jun 27, 2023
796efc1
lint fixes for CommentForm
georgeblahblah Jun 27, 2023
0d980a7
fix(lint): lint fixes for FirstCommentWelcome
georgeblahblah Jun 27, 2023
cca2293
fix(lint): Lint fixes for `PillarButton`
georgeblahblah Jun 27, 2023
212e558
fix(lint): fix CommentContainer
georgeblahblah Jun 27, 2023
e56c60b
Lint formatting fix
georgeblahblah Jun 27, 2023
f745e23
refactor `useInterval` by specifying callback function shape
georgeblahblah Jun 27, 2023
46db916
rm unused `reducer` module
georgeblahblah Jun 27, 2023
3441df8
specify return type of `joinUrl` and use `isNonNullable`
georgeblahblah Jun 27, 2023
e9a7682
refactor `joinUrl` to use `startsWith`/`endsWith`
georgeblahblah Jun 27, 2023
0235cf1
create narrower type for `setCurrentPage` prop
georgeblahblah Jun 27, 2023
8c69c56
lint fixes for AbuseReportForm
georgeblahblah Jun 27, 2023
cf9e81e
more lint fixes :)
georgeblahblah Jun 27, 2023
66f6a6d
`AbuseReportForm` lint formatting
georgeblahblah Jun 27, 2023
a560711
Simplify AbuseReportForm test
georgeblahblah Jun 27, 2023
a766904
lint fix for CommentContainer.test.tsx
georgeblahblah Jun 27, 2023
b0fe19d
lint fixes for Comment
georgeblahblah Jun 27, 2023
c2fa809
more lint fixes
georgeblahblah Jun 27, 2023
13e9a5a
refactor `dateFormatter` to use `Intl.DateTimeFormat`
georgeblahblah Jun 27, 2023
570049e
delete `joinUrl` module in favour of `@guardian/libs` implementation
georgeblahblah Jun 28, 2023
25f8b23
refactor to use jest over vitest
georgeblahblah Jun 28, 2023
ac3e687
refactor arguments to `joinUrl`
georgeblahblah Jun 28, 2023
da46673
refactor `objAsParams` to be more typesafe
georgeblahblah Jun 28, 2023
f3c8730
ignore unsafe member access errors
georgeblahblah Jun 28, 2023
991e3d8
more lint fixes
georgeblahblah Jun 28, 2023
4aabb73
use type `React.ReactNode` for `children` props
georgeblahblah Jun 28, 2023
e7cedaa
stylelint fixes
georgeblahblah Jun 28, 2023
963ab83
prettier fixes
georgeblahblah Jun 28, 2023
9ea918d
Revert "refactor `dateFormatter` to use `Intl.DateTimeFormat`"
georgeblahblah Jun 28, 2023
8e93fbd
Revert "refactor `objAsParams` to be more typesafe"
georgeblahblah Jun 28, 2023
34a5adc
add comments about why we ignore eslint errors
georgeblahblah Jun 28, 2023
a467408
remove `test` prop
georgeblahblah Jun 28, 2023
a0a60a9
refactor test to check request body for `categoryId`
georgeblahblah Jun 28, 2023
9f5dfe6
return `undefined` to silence empty function warning
georgeblahblah Jun 28, 2023
cabb8c0
refactor month name lookup
georgeblahblah Jun 28, 2023
caf58b8
refactor disabled dropdown logic
georgeblahblah Jun 28, 2023
9733f15
add comment explaining we don't have a Source monospace font
georgeblahblah Jun 28, 2023
802fd68
fix logic for muting users
georgeblahblah Jun 28, 2023
e7c358b
return `undefined` instead of nothing
georgeblahblah Jun 28, 2023
c9a7303
handle 0 and NaN widths as well
georgeblahblah Jun 28, 2023
36e078c
check NaN and 0
georgeblahblah Jun 28, 2023
2ccda79
add comment explaining stylelint rule squash
georgeblahblah Jun 28, 2023
2cb41c2
add TODO to implement error handling
georgeblahblah Jun 28, 2023
62195d4
fix indentation
georgeblahblah Jun 28, 2023
1485839
put prettier last in eslint config
georgeblahblah Jun 28, 2023
0a4b2b4
Array.prototype.find => Array.prototype.some
georgeblahblah Jun 28, 2023
77470af
disable eslint formatting rules
georgeblahblah Jun 28, 2023
f9e8cc6
set discussion fixtures
georgeblahblah Jun 29, 2023
c946a34
use `mockRESTCalls` for all mocks
georgeblahblah Jun 29, 2023
237656d
replace discussion fixture with a shorter one
georgeblahblah Jun 29, 2023
78a5f83
updated timestamp stories to an appropriate time relative to dcr time…
Georges-GNM Jun 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions dotcom-rendering/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const rulesToReview = {
'@typescript-eslint/default-param-last': 'warn',
'@typescript-eslint/no-misused-promises': 'warn',

// We use prettier to format code. Some eslint rules conflict with prettier
'react/jsx-indent-props': 'off',
'react/jsx-indent': 'off',

// More rules
'eslint-comments/require-description': 'warn',
'eslint-comments/no-unused-disable': 'warn',
Expand All @@ -66,9 +70,10 @@ module.exports = {
extends: [
'eslint:recommended',
'@guardian/eslint-config-typescript',
'prettier',
'plugin:@guardian/source-react-components/recommended',
'plugin:jsx-a11y/recommended',
// prettier needs to go last so it can override other configuration. See https://github.com/prettier/eslint-config-prettier#installation
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand All @@ -90,8 +95,6 @@ module.exports = {
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
'react/jsx-boolean-value': [2, 'always'],
'react/jsx-indent-props': [2, 'tab'],
'react/jsx-indent': [2, 'tab'],
'react/jsx-key': 'error',
'react/jsx-no-target-blank': 'error',
'react/jsx-one-expression-per-line': 'off',
Expand Down
157 changes: 157 additions & 0 deletions dotcom-rendering/fixtures/manual/comment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
export const comment = {
id: 138809272,
body: '<p>Begone ye self-serving Tory isolationists.</p> <p>Never has there been a more significant time for Big Government and public health provision. Nature has spoken.</p>',
date: '09 March 2020 7:09pm',
isoDateTime: '2020-03-09T19:09:28Z',
status: 'visible',
webUrl: 'https://discussion.theguardian.com/comment-permalink/138809272',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/comment/138809272',
numRecommends: 45,
isHighlighted: false,
userProfile: {
userId: '13239086',
displayName: 'blipvert',
webUrl: 'https://profile.theguardian.com/user/id/13239086',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/profile/13239086',
avatar: 'https://avatar.guim.co.uk/user/13239086',
secureAvatarUrl: 'https://avatar.guim.co.uk/user/13239086',
badge: [],
},
discussion: {
key: '/p/4k83z',
webUrl: 'https://www.theguardian.com/commentisfree/2020/mar/09/coronavirus-outbreak-nhs-staff-shortages',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/discussion//p/4k83z',
title: 'Even a starved NHS is still our best defence against the coronavirus',
isClosedForComments: true,
isClosedForRecommendation: true,
},
responses: [
{
id: 138809396,
body: "This comment was removed by a moderator because it didn't abide by our <a href='http://www.theguardian.com/community-standards'>community standards</a>. Replies may also be deleted. For more detail see <a href='http://www.guardian.co.uk/community-faqs'>our FAQs</a>.",
date: '09 March 2020 7:19pm',
isoDateTime: '2020-03-09T19:19:03Z',
status: 'blocked',
webUrl: 'https://discussion.theguardian.com/comment-permalink/138809396',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/comment/138809396',
numRecommends: 0,
isHighlighted: false,
responseTo: {
displayName: 'blipvert',
commentApiUrl:
'https://discussion.guardianapis.com/discussion-api/comment/138809272',
isoDateTime: '2020-03-09T19:09:28Z',
date: '09 March 2020 7:09pm',
commentId: '138809272',
commentWebUrl:
'https://discussion.theguardian.com/comment-permalink/138809272',
},
userProfile: {
userId: '13093174',
displayName: 'Cricketnut',
webUrl: 'https://profile.theguardian.com/user/id/13093174',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/profile/13093174',
avatar: 'https://avatar.guim.co.uk/user/13093174',
secureAvatarUrl: 'https://avatar.guim.co.uk/user/13093174',
badge: [],
},
},
{
id: 138809487,
body: '<p>There are few Libertarians and small government advocates during pandemics.</p>',
date: '09 March 2020 7:24pm',
isoDateTime: '2020-03-09T19:24:46Z',
status: 'visible',
webUrl: 'https://discussion.theguardian.com/comment-permalink/138809487',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/comment/138809487',
numRecommends: 30,
isHighlighted: false,
responseTo: {
displayName: 'blipvert',
commentApiUrl:
'https://discussion.guardianapis.com/discussion-api/comment/138809272',
isoDateTime: '2020-03-09T19:09:28Z',
date: '09 March 2020 7:09pm',
commentId: '138809272',
commentWebUrl:
'https://discussion.theguardian.com/comment-permalink/138809272',
},
userProfile: {
userId: '100102208',
displayName: 'AJVC1991',
webUrl: 'https://profile.theguardian.com/user/id/100102208',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/profile/100102208',
avatar: 'https://avatar.guim.co.uk/user/100102208',
secureAvatarUrl: 'https://avatar.guim.co.uk/user/100102208',
badge: [],
},
},
{
id: 138809896,
body: '<p>What?</p>',
date: '09 March 2020 7:48pm',
isoDateTime: '2020-03-09T19:48:31Z',
status: 'visible',
webUrl: 'https://discussion.theguardian.com/comment-permalink/138809896',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/comment/138809896',
numRecommends: 9,
isHighlighted: false,
responseTo: {
displayName: 'blipvert',
commentApiUrl:
'https://discussion.guardianapis.com/discussion-api/comment/138809272',
isoDateTime: '2020-03-09T19:09:28Z',
date: '09 March 2020 7:09pm',
commentId: '138809272',
commentWebUrl:
'https://discussion.theguardian.com/comment-permalink/138809272',
},
userProfile: {
userId: '2611744',
displayName: 'Delius',
webUrl: 'https://profile.theguardian.com/user/id/2611744',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/profile/2611744',
avatar: 'https://avatar.guim.co.uk/user/2611744',
secureAvatarUrl: 'https://avatar.guim.co.uk/user/2611744',
badge: [],
},
},
{
id: 138810191,
body: '<p>Or at least, they don\'t flaunt their allegiance to <i>Britannia Unchained</i> and Rand quite so obviously. What awaits if we continue to act as if "there are individual men and women and there are families" and no responsibility to a wider society?</p>',
date: '09 March 2020 8:05pm',
isoDateTime: '2020-03-09T20:05:54Z',
status: 'visible',
webUrl: 'https://discussion.theguardian.com/comment-permalink/138810191',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/comment/138810191',
numRecommends: 20,
isHighlighted: false,
responseTo: {
displayName: 'AJVC1991',
commentApiUrl:
'https://discussion.guardianapis.com/discussion-api/comment/138809487',
isoDateTime: '2020-03-09T19:24:46Z',
date: '09 March 2020 7:24pm',
commentId: '138809487',
commentWebUrl:
'https://discussion.theguardian.com/comment-permalink/138809487',
},
userProfile: {
userId: '12298092',
displayName: '_jhfta_',
webUrl: 'https://profile.theguardian.com/user/id/12298092',
apiUrl: 'https://discussion.guardianapis.com/discussion-api/profile/12298092',
avatar: 'https://avatar.guim.co.uk/user/12298092',
secureAvatarUrl: 'https://avatar.guim.co.uk/user/12298092',
badge: [],
},
},
],
metaData: {
commentCount: 5,
staffCommenterCount: 0,
editorsPickCount: 0,
blockedCount: 1,
responseCount: 4,
},
};
Loading