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.4 to 0.0.5

37

lib/rules/no-unko.js

@@ -1,4 +0,22 @@

const isOffensive = (text) =>
typeof text === "string" &&
/💩|うんこ|ウンコ|ウンコ|unko|poop|feces/.test(text.toLowerCase());
const unkoWords = [
"💩",
"うんこ",
"ウンコ",
"ウンコ",
"うんち",
"ウンチ",
"ウンチ",
"くそ",
"クソ",
"クソ",
"糞",
"unko",
"poop",
"poopoo",
"poo-poo",
"doo-doo",
"feces",
];
const unkoRegex = new RegExp(unkoWords.join("|"), "i");
const isUnkoWord = (text) => typeof text === "string" && unkoRegex.test(text);
const reportWith = (message) => (context, node) =>

@@ -15,8 +33,5 @@ context.report(node, message);

schema: [],
messages: {
noUnko: "",
},
},
create(context) {
const message = "The use of strings similar to 💩 is prohibited.";
const message = "The use of symbols resembling 💩 is not allowed.";
const report = reportWith(message);

@@ -26,9 +41,9 @@

Literal(node) {
isOffensive(node.value) && report(context, node);
isUnkoWord(node.value) && report(context, node);
},
Identifier(node) {
isOffensive(node.name) && report(context, node);
isUnkoWord(node.name) && report(context, node);
},
TemplateElement(node) {
isOffensive(node.value.raw) && report(context, node);
isUnkoWord(node.value.raw) && report(context, node);
},

@@ -39,3 +54,3 @@ Program(node) {

.forEach((c) => {
isOffensive(c.value) && report(context, c);
isUnkoWord(c.value) && report(context, c);
});

@@ -42,0 +57,0 @@ },

{
"name": "eslint-plugin-ban-unko",
"version": "0.0.4",
"description": "🚫💩",
"main": "lib/rules/no-unko.js",
"scripts": {
"test": "jest"
},
"version": "0.0.5",
"description": "The use of symbols resembling 💩 is not allowed.",
"keywords": [

@@ -15,7 +11,14 @@ "eslint",

],
"homepage": "https://github.com/hiro0218/eslint-plugin-ban-unko#readme",
"repository": {
"type": "git",
"url": "git@github.com:hiro0218/eslint-plugin-ban-unko.git"
},
"license": "MIT",
"author": "hiro",
"license": "MIT",
"main": "lib/rules/no-unko.js",
"scripts": {
"test": "jest"
},
"devDependencies": {
"@babel/core": "^7.21.3",
"@babel/eslint-parser": "^7.21.3",
"eslint": "^8.36.0",

@@ -22,0 +25,0 @@ "jest": "^29.5.0"

@@ -39,1 +39,3 @@ # eslint-plugin-ban-unko

- feces
...etc

@@ -24,3 +24,3 @@ const { RuleTester } = require("eslint");

code,
errors: [{ message: "The use of strings similar to 💩 is prohibited." }],
errors: [{ message: "The use of symbols resembling 💩 is not allowed." }],
};

@@ -27,0 +27,0 @@ if (output) {

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