Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-ban-unko

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-ban-unko - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

lib/rules/no-unko.js

7

package.json
{
"name": "eslint-plugin-ban-unko",
"version": "0.0.2",
"version": "0.0.3",
"description": "🚫💩",
"main": "lib/index.js",
"scripts": {
"test": "eslint tests/*.test.js"
"test": "jest"
},

@@ -20,4 +20,5 @@ "keywords": [

"@babel/eslint-parser": "^7.21.3",
"eslint": "^8.36.0"
"eslint": "^8.36.0",
"jest": "^29.5.0"
}
}

@@ -1,82 +0,30 @@

"use strict";
const { RuleTester } = require("eslint");
const plugin = require("../lib");
const rule = require("../lib/rules/no-unko").rules["no-unko"];
const ruleTester = new RuleTester({
parserOptions: {
ecmaVersion: 2021
}
const ruleTester = new RuleTester();
ruleTester.run("no-unko", rule, {
valid: ['"hello"', '"HELLO"', "console.log(123)", { code: "var hoge = 1" }],
invalid: [
invalid('"💩"'),
invalid('"うんこ"'),
invalid('"ウンコ"'),
invalid('"ウンコ"'),
invalid('"unko"'),
invalid('"poop"'),
invalid('"feces"'),
invalid('var foo = "unko"'),
invalid('var unko = "foo"'),
invalid("function unko() {}"),
],
});
ruleTester.run("no-unko", plugin.rules["no-unko"], {
valid: [
'const helloWorld = "Hello World";',
'const noUnko = "noUnko";'
],
invalid: [
{
code: 'const unko = "💩";',
errors: [
{
message: "The word '💩' is banned",
type: "Literal"
}
]
},
{
code: 'const message = "I stepped on unko";',
errors: [
{
message: "The word 'unko' is banned",
type: "Literal"
}
]
},
{
code: "const message = `I saw a pile of うんこ yesterday`;",
errors: [
{
message: "The word 'うんこ' is banned",
type: "TemplateElement"
}
]
},
{
code: "const message = `I smelled ウンコ on the street`;",
errors: [
{
message: "The word 'ウンコ' is banned",
type: "TemplateElement"
}
]
},
{
code: "const message = `My dog rolled in ウンコ at the park`;",
errors: [
{
message: "The word 'ウンコ' is banned",
type: "TemplateElement"
}
]
},
{
code: "const message = `The poop emoji is my favorite emoji`;",
errors: [
{
message: "The word 'poop' is banned",
type: "TemplateElement"
}
]
},
{
code: 'const message = `I prefer to use the word "feces" instead of "unko"`;',
errors: [
{
message: "The word 'feces' is banned",
type: "TemplateElement"
}
]
}
]
});
function invalid(code, output) {
const invalidTest = {
code,
errors: [{ message: "The use of strings similar to 💩 is prohibited." }],
};
if (output) {
invalidTest.output = output;
}
return invalidTest;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc