eslint-plugin-ban-unko
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"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; | ||
} |
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
3422
4
87