Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f725e7b
Initial linting pass
fsvreddit Aug 30, 2025
5a6e294
Fix remaining linting issues
fsvreddit Aug 30, 2025
2b80340
Major refactoring and add ability to define default mop parameters
fsvreddit Aug 30, 2025
6692bfa
Update README
fsvreddit Aug 30, 2025
2954926
Update success toast to be green if mop works correctly
fsvreddit Aug 30, 2025
bc4a0b4
Improve console output
fsvreddit Aug 30, 2025
018cbdb
Use alternate method of identifying mod permissiosn
fsvreddit Aug 30, 2025
b44b357
Add toast notification for empty comments in nuke function
fsvreddit Aug 30, 2025
524abcd
Refactor permission checks and improve user feedback in nuke function…
fsvreddit Aug 31, 2025
70ddffe
Update README to clarify moderation tool functionality and enhance in…
fsvreddit Aug 31, 2025
07182a8
Add source code and license section to README
fsvreddit Aug 31, 2025
28ff5d0
Add GitHub Actions
fsvreddit Aug 31, 2025
225f270
Remove @vitest/eslint-plugin from devDependencies and update other de…
fsvreddit Aug 31, 2025
b5ff861
Remove vitest plugin from ESLint configuration
fsvreddit Aug 31, 2025
b221070
Update label casing and add help text for Comment Mop settings
fsvreddit Aug 31, 2025
d9a0443
Add performance logging for comment nuke operations and permissions c…
fsvreddit Aug 31, 2025
15da526
Update readme
fsvreddit Aug 31, 2025
0672c96
Refactor comment gather code for efficiency
fsvreddit Sep 1, 2025
905bd4f
Add lodash for chunking comments and improve logging in nuke function
fsvreddit Sep 1, 2025
7aaa375
Update README and userPermissions for performance improvements and lo…
fsvreddit Sep 1, 2025
f5a7ef6
Add option to skip already actioned comments in nuke functionality
fsvreddit Sep 1, 2025
6a28c99
Add tests for nuke form fields in settings and configure Vitest
fsvreddit Sep 1, 2025
2da2766
Improve logging for comment gathering by pluralizing comment count
fsvreddit Sep 1, 2025
b45efcf
Enhance logging in nuke functionality by including target IDs in cons…
fsvreddit Sep 1, 2025
f31499f
Import only one function needed from lodash
fsvreddit Sep 1, 2025
a152dcb
Simplify nukeData object creation
fsvreddit Sep 1, 2025
b673c9a
Fix type in getCurrentUser function context parameter
fsvreddit Sep 1, 2025
0c81eee
Update readme and packages
fsvreddit Sep 1, 2025
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
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: build-test-lint
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: use node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm install
- run: npx tsc --build --clean
- run: npx eslint
- run: npm run test
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
.yarn
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.DS_Store
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
A moderation tool used for deleting and locking an entire comment tree, starting with a single comment. This app demonstrates how to:
A moderation tool used for removing and locking an entire comment tree, starting either with a single comment or at an entire post level.

- Use the Reddit API to perform large-scale operations.
Run Comment Mop using the three-dot menu or mod shield menu (depending on platform) and chose the "Mop" option. You can opt to remove and/or lock, and skip mod-distinguished comments if desired.

- Use menu actions as an entrypoint for apps.
From version 9.2, you can configure the default options for the Mop form in your app settings, which you can find via the [Developer Platform app portal](https://developers.reddit.com/my/communities).

## Credits

This app was originally written by /u/FlyingLaserTurtle, with contributions from /u/ni5arga.

For support for Comment Mop, please contact /u/fsv (the current maintainer) rather than either of the above users.

## Source code and license

Comment Mop is open source and licensed under the BSD Three Clause license. The source code is available on GitHub [here](https://github.com/fsvreddit/comment-nuke).

## Change History

### v9.2.0

* Fix an error that causes Comment Mop to fail consistently for certain users
* The ability to set defaults for the Comment Mop form if the default values don't suit your sub's workflow
* Add new option to skip comments that have already been removed/locked
* Performance and reliability improvements
* Update to latest Dev Platform version
2 changes: 1 addition & 1 deletion devvit.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
name: comment-mop
name: comment-nuke
76 changes: 76 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import stylistic from '@stylistic/eslint-plugin'

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
stylistic.configs.customize({
indent: 4,
quotes: "double",
semi: true,
quoteProps: "consistent-as-needed",
braceStyle: "1tbs",
}),
{
files: ["**/*.ts", "**/*.tsx"],

languageOptions: {
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: import.meta.dirname,
},
},

rules: {
// Extra rules
"eqeqeq": ["error", "always", {
null: "ignore",
}],
"no-self-compare": "error",
"no-template-curly-in-string": "error",
"no-useless-assignment": "error",
"no-nested-ternary": "error",
"no-return-assign": "error",
"no-sequences": "error",
"no-var": "error",
"arrow-body-style": ["error", "as-needed"],
"func-style": ["error", "declaration", {
allowArrowFunctions: true,
}],
"curly": ["error", "all"],
"object-shorthand": ["error", "always"],
"operator-assignment": ["error", "always"],
"camelcase": ["error", {
properties: "always",
}],

// Rules I don't want
"@typescript-eslint/restrict-template-expressions": "off",

// Extra code styling rules
"@stylistic/array-bracket-newline": ["error", "consistent"],
"@stylistic/array-element-newline": ["error", "consistent"],
"@/func-call-spacing": ["error", "never"],
"@stylistic/function-paren-newline": ["error", "multiline"],
"@stylistic/implicit-arrow-linebreak": ["error", "beside"],

"@stylistic/object-curly-newline": ["error", {
multiline: true,
consistent: true,
}],

"@stylistic/object-property-newline": ["error", {
allowAllPropertiesOnSameLine: true,
}],

"@stylistic/operator-linebreak": ["off"],
"@stylistic/semi-style": ["error", "last"],
"@stylistic/space-before-function-paren": ["error", "always"],
},
},
{
ignores: ["**/node_modules", "**/dist", "eslint.config.mjs", "**/difflib"],
},
);
Loading