eslint-plugin-ban-unko
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -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) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
3738
2
100
1
41
0
6