From 1e9c16f58ac97fd5e158602018186ad04d2b2c39 Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 24 Mar 2017 21:42:06 +0100 Subject: [PATCH 1/3] Add configure tests and add simple valid and invalid tests for no-console rule --- package.json | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f07094c..b6c9726 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,17 @@ { "name": "eslint-plugin-vazco", - "version": "1.0.0", - "description": "", + "version": "0.0.1", + "description": "Custom ESLint style rules in Vazco", "main": "index.js", "directories": { "test": "tests" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "jest" + }, + "devDependencies": { + "eslint": "^3.18.0", + "jest": "^19.0.1" }, "author": "", "license": "ISC" From 4767c006285f8b72c1596244ea78c09ea17e0f38 Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 24 Mar 2017 21:44:57 +0100 Subject: [PATCH 2/3] Add configure tests and add simple valid and invalid tests for no-console rule, add gitignore --- .gitignore | 1 + jest-dev.json | 3 +++ lib/rules/__tests__/no-console.js | 21 +++++++++++++++++++++ package.json | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 jest-dev.json create mode 100644 lib/rules/__tests__/no-console.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/jest-dev.json b/jest-dev.json new file mode 100644 index 0000000..4091e2e --- /dev/null +++ b/jest-dev.json @@ -0,0 +1,3 @@ +{ + "testRegex": "/lib/.*__tests__/.*\\.js$" +} diff --git a/lib/rules/__tests__/no-console.js b/lib/rules/__tests__/no-console.js new file mode 100644 index 0000000..3e923ec --- /dev/null +++ b/lib/rules/__tests__/no-console.js @@ -0,0 +1,21 @@ +"use strict"; + +var rule = require("../no-console"), + RuleTester = require("eslint").RuleTester; + +var ruleTester = new RuleTester(); +ruleTester.run("no-console", rule, { + valid: [ + { + code: "console.info()", + options: [{disallow: ["log"]}] + } + ], + invalid: [ + { + code: "console.log()", + errors: [{message: /^Unexpected console statement/}], + options: [{disallow: ["log"]}] + } + ] +}); diff --git a/package.json b/package.json index b6c9726..84030ed 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "test": "tests" }, "scripts": { - "test": "jest" + "test": "jest --config=jest-dev.json" }, "devDependencies": { "eslint": "^3.18.0", From 6b15fb3bedb45a81400a862372abd522f80089fa Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 24 Mar 2017 22:07:14 +0100 Subject: [PATCH 3/3] Fix versioning --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 84030ed..a8e5fc6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-vazco", - "version": "0.0.1", + "version": "1.1.0", "description": "Custom ESLint style rules in Vazco", "main": "index.js", "directories": {