🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@dannote/sloplint

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dannote/sloplint - npm Package Compare versions

Comparing version
0.1.0
to
0.1.1
+53
-2
dist/cli.js

@@ -77,2 +77,5 @@ #!/usr/bin/env node

var STEP_PATTERN = /^(?:\/\/|#|\/\*\*?)\s*step\s+\d/i;
var PLACEHOLDER_PATTERN = /^(?:\/\/|#|\/\*\*?)\s*(?:(?:\.\.\.|…)\s*(?:rest of|more|remaining|implementation|logic|code|here|functionality|similarly|and so on|etc|as above)|(?:omitted|truncated)\s+for\s+brevity|implementation details omitted|repeat (?:for each|as needed)|handle (?:other|remaining) cases similarly|similar for other cases)/i;
var APOLOGETIC_PATTERN = /^(?:\/\/|#|\/\*\*?)\s*(?:sorry,? this is a (?:quick )?hack|(?:quick|ugly|dirty|nasty) hack|(?:quick|dirty|naive) solution|not the best way but works|I know this is bad|(?:temporary|temp) (?:fix|workaround|solution|implementation|code)|(?:fix|refactor|implement|do|clean up) (?:this )?later|(?:good|fine|okay|ok|simple|works|good enough) for now|simplified (?:version|implementation|logic)|(?:basic|minimal|naive) approach|just a placeholder)/i;
var AI_SPECIFIC_PATTERN = /^(?:\/\/|#|\/\*\*?)\s*(?:As an AI,? I cannot|I'll leave this for you to (?:implement|complete|finish)|You'll need to add your own|Replace this with your (?:actual|real|own) implementation|Add your (?:code|logic) here|Insert your (?:logic|code|handling) here|Customize (?:as needed|according to your needs)|Modify (?:according to|based on) your needs|This is a (?:simplified|basic|example) (?:example|version|implementation)|In a real application,? you (?:would|should)|For production,? (?:consider|make sure to)|In practice,? you (?:should|might want to)|This is just a starting point)/i;
var DIVIDER_PATTERNS = [

@@ -83,3 +86,3 @@ /^(?:\/\/|#)\s*[-=~#*]{3,}/,

];
var KEEPER_PATTERN = /TODO|FIXME|HACK|NOTE|SAFETY|WARN|BUG|XXX|PERF|IMPORTANT|LICENSE|COPYRIGHT/i;
var KEEPER_PATTERN = /\bTODO\b|\bFIXME\b|\bHACK\b|\bNOTE\b|\bSAFETY\b|\bWARN\b|\bBUG\b|\bXXX\b|\bPERF\b|\bIMPORTANT\b|\bLICENSE\b|\bCOPYRIGHT\b/;
function isComment(node, lang) {

@@ -157,2 +160,47 @@ return lang.commentKinds.includes(node.kind());

};
var placeholderComment = {
id: "placeholder-comment",
message: "Placeholder comment — this code is incomplete",
note: 'Comments like "... rest of the code" or "omitted for brevity" mean the implementation was never finished.',
check(node, lang) {
const text = commentText(node);
if (!isComment(node, lang))
return null;
if (shouldKeep(text, lang))
return null;
if (!PLACEHOLDER_PATTERN.test(text))
return null;
return this;
}
};
var apologeticComment = {
id: "apologetic-comment",
message: "Apologetic comment — fix the code instead of apologizing for it",
note: 'Comments admitting "this is a hack" or "good enough for now" are a sign the code needs actual improvement, not an apology.',
check(node, lang) {
const text = commentText(node);
if (!isComment(node, lang))
return null;
if (shouldKeep(text, lang))
return null;
if (!APOLOGETIC_PATTERN.test(text))
return null;
return this;
}
};
var aiSpecificComment = {
id: "ai-generated-comment",
message: "AI-generated placeholder — the AI left a note instead of writing the code",
note: "The AI assistant admitted it didn't finish the job. Replace the comment with an actual implementation.",
check(node, lang) {
const text = commentText(node);
if (!isComment(node, lang))
return null;
if (shouldKeep(text, lang))
return null;
if (!AI_SPECIFIC_PATTERN.test(text))
return null;
return this;
}
};
var commentRules = [

@@ -162,3 +210,6 @@ obviousComment,

stepComment,
sectionDivider
sectionDivider,
placeholderComment,
apologeticComment,
aiSpecificComment
];

@@ -165,0 +216,0 @@

+1
-1
{
"name": "@dannote/sloplint",
"version": "0.1.0",
"version": "0.1.1",
"description": "AST-based multilingual AI slop linter — catches obvious comments, narrator comments, step comments, section dividers, empty catch blocks, and more across 8 languages",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -17,2 +17,5 @@ # sloplint

| `section-divider` | `// ============` or `// --- Helpers ---` |
| `placeholder-comment` | `// ... rest of the code` or `// omitted for brevity` |
| `apologetic-comment` | `// quick hack` or `// good enough for now` |
| `ai-generated-comment` | `// Replace this with your actual implementation` |

@@ -19,0 +22,0 @@ **Code patterns** (language-specific):