Skip to content

Commit 094fb96

Browse files
authored
chore: update dependencies, fix linting errors
1 parent a8ac3f5 commit 094fb96

File tree

11 files changed

+345
-561
lines changed

11 files changed

+345
-561
lines changed

dist/AdvancedFlagging.user.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3496,7 +3496,7 @@
34963496
const tooltipFlagText = this.post.deleted ? "" : flagText;
34973497
const commentText = this.getCommentText(flagType);
34983498
const tooltipCommentText = (this.post.deleted ? "" : commentText) || "";
3499-
const reportTypeHuman = reportType === "NoFlag" || !this.post.deleted ? getHumanFromDisplayName(reportType) : "";
3499+
const reportTypeHuman = reportType === "NoFlag" /* NoFlag */ || !this.post.deleted ? getHumanFromDisplayName(reportType) : "";
35003500
const popoverParent = document.createElement("div");
35013501
Object.entries({
35023502
Flag: reportTypeHuman,
@@ -3638,7 +3638,7 @@
36383638
flex.remove();
36393639
this.post.progress.delete();
36403640
StackExchange.helpers.removeSpinner = old;
3641-
if (reportType !== "NoFlag") return;
3641+
if (reportType !== "NoFlag" /* NoFlag */) return;
36423642
if (success) {
36433643
attachPopover(this.post.done, `Performed action ${displayName}`);
36443644
$(this.post.done).fadeIn();

eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export default tseslint.config({
5757
'@stylistic/brace-style': ['error', '1tbs'],
5858
'@stylistic/comma-dangle': 'off',
5959
'@stylistic/indent-binary-ops': 'off',
60-
'@stylistic/space-before-function-paren': 'off',
6160
'@stylistic/type-annotation-spacing': [
6261
'warn',
6362
{

npm-shrinkwrap.json

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

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
"author": "Robert Rudman <[email protected]> (https://github.com/rjrudman)",
1111
"license": "ISC",
1212
"devDependencies": {
13-
"@eslint/js": "^9.34.0",
14-
"@stylistic/eslint-plugin": "^5.3.1",
13+
"@eslint/js": "^9.39.2",
14+
"@stylistic/eslint-plugin": "^5.6.1",
1515
"@types/jquery": "3.5.33",
16-
"@types/node": "^24.3.0",
17-
"@types/tampermonkey": "5.0.4",
16+
"@types/node": "^25.0.3",
17+
"@types/tampermonkey": "5.0.5",
1818
"@userscripters/stackexchange-global-types": "^2.8.2",
19-
"esbuild": "^0.25.9",
20-
"typescript": "5.9.2",
21-
"typescript-eslint": "^8.41.0"
19+
"esbuild": "^0.27.2",
20+
"typescript": "5.9.3",
21+
"typescript-eslint": "^8.50.0"
2222
},
2323
"dependencies": {
24-
"@stackoverflow/stacks-icons": "^6.6.1",
24+
"@stackoverflow/stacks-icons": "^6.8.0",
2525
"@userscripters/stacks-helpers": "1.1.3"
2626
},
2727
"repository": {

src/Configuration.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ import {
44
CachedCategory,
55
CachedFlag
66
} from './UserscriptTools/Store';
7-
import { Flags, flagCategories } from './FlagTypes';
7+
import { flagCategories } from './FlagTypes';
88

9-
import { FlagNames, displayStacksToast, getFlagTypeFromFlagId } from './shared';
9+
import { Flags, displayStacksToast, getFlagTypeFromFlagId } from './shared';
1010

1111
import { buildConfigurationOverlay } from './modals/config';
1212
import { setupCommentsAndFlagsModal } from './modals/comments/main';
1313

1414
export function isSpecialFlag(flagName: Flags, checkNoFlag = true): boolean {
1515
const arrayOfFlags: Flags[] = [
16-
FlagNames.ModFlag,
17-
FlagNames.Plagiarism
16+
Flags.ModFlag,
17+
Flags.Plagiarism
1818
];
1919

2020
if (checkNoFlag) {
21-
arrayOfFlags.push(FlagNames.NoFlag);
21+
arrayOfFlags.push(Flags.NoFlag);
2222
}
2323

2424
return arrayOfFlags.includes(flagName);
@@ -97,7 +97,7 @@ function setupDefaults(): void {
9797
// filter by id because names can be edited by the user
9898
if (cachedFlag.id !== 3 && cachedFlag.id !== 5) return;
9999

100-
cachedFlag.reportType = FlagNames.Plagiarism;
100+
cachedFlag.reportType = Flags.Plagiarism;
101101
});
102102
Store.updateFlagTypes();
103103

@@ -136,9 +136,10 @@ function setupDefaults(): void {
136136
// https://meta.stackoverflow.com/a/434697
137137
Store.flagTypes
138138
// @ts-expect-error VLQ flag is removed, see the link above
139+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
139140
.filter(({ reportType }) => reportType === 'PostLowQuality')
140141
.forEach(flagType => {
141-
flagType.reportType = FlagNames.NAA;
142+
flagType.reportType = Flags.NAA;
142143
});
143144

144145
Store.updateFlagTypes();

src/FlagTypes.ts

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
import { FlagTypeFeedbacks, PostType, FlagNames } from './shared';
1+
import { FlagTypeFeedbacks, PostType, Flags } from './shared';
22
import { CachedFlag } from './UserscriptTools/Store';
33

4-
export type Flags = 'AnswerNotAnAnswer'
5-
| 'PostOffensive'
6-
| 'PostSpam'
7-
| 'NoFlag'
8-
| 'PostOther'
9-
| 'PlagiarizedContent';
10-
114
const deletedAnswers = '/help/deleted-answers';
125
const commentHelp = '/help/privileges/comment';
136
const reputationHelp = '/help/whats-reputation';
@@ -47,14 +40,14 @@ export const flagCategories: FlagCategory[] = [
4740
{
4841
id: 1,
4942
displayName: 'Spam',
50-
reportType: FlagNames.Spam,
43+
reportType: Flags.Spam,
5144
feedbacks: { Smokey: 'tpu-', Natty: 'tp', Guttenberg: '', 'Generic Bot': 'track' },
5245
sendWhenFlagRaised: true
5346
},
5447
{
5548
id: 2,
5649
displayName: 'Rude or Abusive',
57-
reportType: FlagNames.Rude,
50+
reportType: Flags.Rude,
5851
feedbacks: { Smokey: 'tpu-', Natty: 'tp', Guttenberg: '', 'Generic Bot': 'track' },
5952
sendWhenFlagRaised: true
6053
}
@@ -69,7 +62,7 @@ export const flagCategories: FlagCategory[] = [
6962
{
7063
id: 3,
7164
displayName: 'Plagiarism',
72-
reportType: FlagNames.Plagiarism,
65+
reportType: Flags.Plagiarism,
7366
flagText: 'Possible plagiarism of the linked answer, as can be seen here $COPYPASTOR$',
7467
// don't send feedback to Smokey despite https://charcoal-se.org/smokey/Feedback-Guidance.html#plagiarism
7568
feedbacks: { Smokey: '', Natty: '', Guttenberg: 'tp', 'Generic Bot': '' },
@@ -78,7 +71,7 @@ export const flagCategories: FlagCategory[] = [
7871
{
7972
id: 4,
8073
displayName: 'Duplicate answer',
81-
reportType: FlagNames.ModFlag,
74+
reportType: Flags.ModFlag,
8275
flagText: 'The post is a repost of their other answer: $TARGET$, but as there are slight differences '
8376
+ '(see $COPYPASTOR$), an auto flag would not be raised.',
8477
comments: {
@@ -92,7 +85,7 @@ export const flagCategories: FlagCategory[] = [
9285
{
9386
id: 5,
9487
displayName: 'Bad attribution',
95-
reportType: FlagNames.Plagiarism,
88+
reportType: Flags.Plagiarism,
9689
flagText: 'This post is copied from $TARGET$, as can be seen here $COPYPASTOR$. The author '
9790
+ 'only added a link to the other answer, which is [not the proper way of attribution]'
9891
+ '(//stackoverflow.blog/2009/06/25/attribution-required).',
@@ -110,7 +103,7 @@ export const flagCategories: FlagCategory[] = [
110103
{
111104
id: 6,
112105
displayName: 'Link Only',
113-
reportType: FlagNames.NAA,
106+
reportType: Flags.NAA,
114107
comments: {
115108
// comment by Yunnosch: https://chat.stackoverflow.com/transcript/message/57442309
116109
low: 'A link to a solution is welcome, but please ensure your answer is useful without it: '
@@ -126,7 +119,7 @@ export const flagCategories: FlagCategory[] = [
126119
{
127120
id: 7,
128121
displayName: 'Not an answer',
129-
reportType: FlagNames.NAA,
122+
reportType: Flags.NAA,
130123
comments: {
131124
low: 'This does not provide an answer to the question. You can [search for similar questions](/search), '
132125
+ 'or refer to the related and linked questions on the right-hand side of the page to find an answer. '
@@ -144,7 +137,7 @@ export const flagCategories: FlagCategory[] = [
144137
{
145138
id: 8,
146139
displayName: 'Thanks',
147-
reportType: FlagNames.NAA,
140+
reportType: Flags.NAA,
148141
comments: {
149142
low: 'Please don\'t add _thanks_ as answers. They don\'t actually provide an answer to the question, and '
150143
+ 'can be perceived as noise by its future visitors. Once you [earn](//meta.stackoverflow.com/q/146472) '
@@ -164,7 +157,7 @@ export const flagCategories: FlagCategory[] = [
164157
{
165158
id: 9,
166159
displayName: 'Me too',
167-
reportType: FlagNames.NAA,
160+
reportType: Flags.NAA,
168161
comments: {
169162
low: 'Please don\'t add *Me too* as answers. It doesn\'t actually provide an answer to the question. '
170163
+ 'If you have a different but related question, then [ask](/questions/ask) it (reference this one '
@@ -178,7 +171,7 @@ export const flagCategories: FlagCategory[] = [
178171
{
179172
id: 10,
180173
displayName: 'Library',
181-
reportType: FlagNames.NAA,
174+
reportType: Flags.NAA,
182175
comments: {
183176
low: 'Please don\'t just post some tool or library as an answer. At least demonstrate '
184177
+ '[how it solves the problem](//meta.stackoverflow.com/a/251605) in the answer itself.',
@@ -189,7 +182,7 @@ export const flagCategories: FlagCategory[] = [
189182
{
190183
id: 11,
191184
displayName: 'Comment',
192-
reportType: FlagNames.NAA,
185+
reportType: Flags.NAA,
193186
comments: {
194187
low: 'This does not provide an answer to the question. Once you have sufficient '
195188
+ `[reputation](${reputationHelp}) you will be able to [comment on any post](${commentHelp}); instead, `
@@ -202,7 +195,7 @@ export const flagCategories: FlagCategory[] = [
202195
{
203196
id: 12,
204197
displayName: 'Duplicate',
205-
reportType: FlagNames.NAA,
198+
reportType: Flags.NAA,
206199
comments: {
207200
low: 'Instead of posting an answer which merely links to another answer, please instead '
208201
+ `[flag the question](${flagPosts}) as a duplicate.`,
@@ -213,7 +206,7 @@ export const flagCategories: FlagCategory[] = [
213206
{
214207
id: 13,
215208
displayName: 'Non English',
216-
reportType: FlagNames.NAA,
209+
reportType: Flags.NAA,
217210
comments: {
218211
low: 'Please write your answer in English, as Stack Overflow is an '
219212
+ '[English-only site](//meta.stackoverflow.com/a/297680).',
@@ -224,7 +217,7 @@ export const flagCategories: FlagCategory[] = [
224217
{
225218
id: 14,
226219
displayName: 'Should be an edit',
227-
reportType: FlagNames.NAA,
220+
reportType: Flags.NAA,
228221
comments: {
229222
low: 'Please use the edit link on your question to add additional information. '
230223
+ 'The "Post Answer" button should be used only for complete answers to the question.',
@@ -243,21 +236,21 @@ export const flagCategories: FlagCategory[] = [
243236
{
244237
id: 15,
245238
displayName: 'Looks Fine',
246-
reportType: FlagNames.NoFlag,
239+
reportType: Flags.NoFlag,
247240
feedbacks: { Smokey: 'fp-', Natty: 'fp', Guttenberg: 'fp', 'Generic Bot': '' },
248241
sendWhenFlagRaised: false
249242
},
250243
{
251244
id: 16,
252245
displayName: 'Needs Editing',
253-
reportType: FlagNames.NoFlag,
246+
reportType: Flags.NoFlag,
254247
feedbacks: { Smokey: 'fp-', Natty: 'ne', Guttenberg: 'fp', 'Generic Bot': '' },
255248
sendWhenFlagRaised: false
256249
},
257250
{
258251
id: 17,
259252
displayName: 'Vandalism',
260-
reportType: FlagNames.NoFlag,
253+
reportType: Flags.NoFlag,
261254
feedbacks: { Smokey: 'tp-', Natty: '', Guttenberg: 'fp', 'Generic Bot': '' },
262255
sendWhenFlagRaised: false
263256
}
@@ -269,7 +262,7 @@ export function getEmptyFlagType(id: number, belongsTo: string): CachedFlag {
269262
return {
270263
id,
271264
displayName: 'Name',
272-
reportType: FlagNames.NoFlag,
265+
reportType: Flags.NoFlag,
273266
feedbacks: { Smokey: '', Natty: '', Guttenberg: '', 'Generic Bot': '' },
274267
sendWhenFlagRaised: false,
275268
downvote: false,

src/UserscriptTools/Post.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { page } from '../AdvancedFlagging';
2-
import { Flags } from '../FlagTypes';
32
import {
43
PostType,
5-
FlagNames,
4+
Flags,
65
getFormDataFromObject,
76
addXHRListener,
87
addProgress,
@@ -122,7 +121,7 @@ export default class Post {
122121
// plagiarism flag: fill "Link(s) to original content"
123122
// note wrt link: site will always be Stack Overflow,
124123
// post will always be an answer.
125-
customData: flagName === FlagNames.Plagiarism
124+
customData: flagName === Flags.Plagiarism
126125
? JSON.stringify({ plagiarizedSource: `https:${targetUrl}` })
127126
: ''
128127
};

src/modals/comments/rows.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export function getTextareas({
218218
textarea.insertAdjacentElement('afterend', charsLeft);
219219

220220
// change the string on keyup
221-
textarea.addEventListener('keyup', function() {
221+
textarea.addEventListener('keyup', function () {
222222
const newCharsLeft = getCharSpan(this, contentType);
223223

224224
this.nextElementSibling?.replaceWith(newCharsLeft);

src/modals/comments/submit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {
22
displayStacksToast,
33
FlagTypeFeedbacks,
44
getFlagTypeFromFlagId,
5+
Flags
56
} from '../../shared';
6-
import { Flags } from '../../FlagTypes';
77
import { isSpecialFlag } from '../../Configuration';
88
import { CachedFlag, Store } from '../../UserscriptTools/Store';
99

src/popover.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
attachPopover,
66
getHumanFromDisplayName,
77

8+
Flags,
89
getFullFlag,
9-
FlagNames,
1010
delay,
1111
configBoxes
1212
} from './shared';
@@ -18,7 +18,6 @@ import { Store, CachedFlag } from './UserscriptTools/Store';
1818
import Reporter from './UserscriptTools/Reporter';
1919
import Page from './UserscriptTools/Page';
2020
import { Progress } from './UserscriptTools/Progress';
21-
import { Flags } from './FlagTypes';
2221

2322
const noneSpan = document.createElement('span');
2423
noneSpan.classList.add('o50');
@@ -33,11 +32,11 @@ export class Popover {
3332

3433
// do not vote to delete if reportType is one of these:
3534
private readonly excludedTypes: Flags[] = [
36-
FlagNames.Plagiarism,
37-
FlagNames.ModFlag,
38-
FlagNames.NoFlag,
39-
FlagNames.Spam,
40-
FlagNames.Rude
35+
Flags.Plagiarism,
36+
Flags.ModFlag,
37+
Flags.NoFlag,
38+
Flags.Spam,
39+
Flags.Rude
4140
];
4241

4342
private makeMenu(): HTMLUListElement {
@@ -234,7 +233,7 @@ export class Popover {
234233
const commentText = this.getCommentText(flagType);
235234
const tooltipCommentText = (this.post.deleted ? '' : commentText) || '';
236235

237-
const reportTypeHuman = reportType === 'NoFlag' || !this.post.deleted
236+
const reportTypeHuman = reportType === Flags.NoFlag || !this.post.deleted
238237
? getHumanFromDisplayName(reportType)
239238
: '';
240239

@@ -386,7 +385,7 @@ export class Popover {
386385

387386
const natty = this.post.reporters.Natty;
388387
if (natty) {
389-
natty.raisedRedFlag = reportType === FlagNames.Spam || reportType === FlagNames.Rude;
388+
natty.raisedRedFlag = reportType === Flags.Spam || reportType === Flags.Rude;
390389
}
391390

392391
// if feedback is sent successfully, the success variable is true, otherwise false
@@ -438,11 +437,11 @@ export class Popover {
438437
}
439438

440439
// flag & delete
441-
if (flag && reportType !== FlagNames.NoFlag
440+
if (flag && reportType !== Flags.NoFlag
442441
// as requested by Zoe: https://chat.stackoverflow.com/transcript/message/57483258
443442
&& (!StackExchange.options.user.isModerator
444-
|| reportType === FlagNames.Spam
445-
|| reportType === FlagNames.Rude
443+
|| reportType === Flags.Spam
444+
|| reportType === Flags.Rude
446445
)
447446
) {
448447
const humanFlag = getHumanFromDisplayName(reportType);
@@ -497,7 +496,7 @@ export class Popover {
497496
StackExchange.helpers.removeSpinner = old;
498497

499498
// don't show performed/failed action icons if post has been flagged
500-
if (reportType !== 'NoFlag') return;
499+
if (reportType !== Flags.NoFlag) return;
501500

502501
if (success) {
503502
attachPopover(this.post.done, `Performed action ${displayName}`);

0 commit comments

Comments
 (0)