From 3bd680802264ee3f6d8e8dede670efb4d8de9878 Mon Sep 17 00:00:00 2001
From: donal <donalspring@gmail.com>
Date: Sun, 22 Apr 2018 13:50:55 +0200
Subject: [PATCH] FIX - linting errors for the build

---
 tests/unit/javascript/mutations.spec.js         |    1 
 tests/unit/vue-components/NewTodo.spec.js       |   33 +++-------
 .gitignore                                      |    1 
 tests/unit/vue-components/XofYItems.spec.js     |   20 +-----
 .eslintrc                                       |    2 
 tests/unit/vue-components/Header.spec.js        |   13 ---
 tests/unit/vue-components/TodoItem.spec.js      |    1 
 tests/unit/javascript/store.spec.js             |    1 
 tests/unit/vue-components/ListOfTodos.spec.js   |    4 +
 tests/unit/vue-components/Todo.spec.js          |    1 
 /dev/null                                       |   41 -------------
 tests/unit/vue-components/ComponentView.spec.js |    1 
 tests/unit/vue-components/AboutLabs.spec.js     |    1 
 src/store/actions.js                            |    4 
 package.json                                    |    1 
 tests/unit/javascript/actions.spec.js           |    1 
 16 files changed, 27 insertions(+), 99 deletions(-)

diff --git a/.eslintrc b/.eslintrc
index 4bbd9e0..0c6c9d3 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -8,5 +8,5 @@
   "ecmaFeatures": {
     "modules": true
   },
-  "rules": { "no-unused-vars": 0 }
+  // "rules": { "no-unused-vars": 0 }
 }
diff --git a/.gitignore b/.gitignore
index 90734bb..fa80d30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,4 @@
 *.njsproj
 *.sln
 test-report.xml
+eslint-report.xml
diff --git a/package.json b/package.json
index af03cef..2ec6a5d 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
     "e2e": "vue-cli-service e2e",
     "e2e:ci": "vue-cli-service e2e --env jenkins --url http://${E2E_TEST_ROUTE}",
     "lint": "vue-cli-service lint",
+    "lint:ci": "vue-cli-service lint --format checkstyle  > eslint-report.xml",
     "clean": "rm -rf reports dist package-contents*",
     "build:ci": "npm run build && mkdir -p package-contents && cp -vr dist Dockerfile package-contents",
     "build:ci:dev": "cp src/config/dev.js src/config/index.js && npm run build && mkdir -p package-contents && cp -vr dist Dockerfile package-contents",
diff --git a/package.json.bak b/package.json.bak
deleted file mode 100644
index f16c1d6..0000000
--- a/package.json.bak
+++ /dev/null
@@ -1,41 +0,0 @@
-{
-  "name": "cli-test",
-  "version": "0.1.0",
-  "private": true,
-  "scripts": {
-    "serve": "./node_modules/.bin/vue-cli-service serve --open",
-    "build": "./node_modules/.bin/vue-cli-service build",
-    "test": "./node_modules/.bin/vue-cli-service test",
-    "e2e": "./node_modules/.bin/vue-cli-service e2e",
-    "e2e-ci": "./node_modules/.bin/vue-cli-service e2e --env jenkins --url http://localhost:8080",
-    "lint": "./node_modules/.bin/vue-cli-service lint",
-    "e2e-setup": "./node_modules/.bin/selenium-standalone install",
-    "e2e-ci-old": "npm run e2e-setup && ./node_modules/.bin/nightwatch --config nightwatch.config.js --env jenkins"
-  },
-  "dependencies": {
-    "register-service-worker": "^1.0.0",
-    "vue": "^2.5.13",
-    "vue-router": "^3.0.1",
-    "vuex": "^3.0.1"
-  },
-  "devDependencies": {
-    "@vue/cli-plugin-babel": "^3.0.0-beta.6",
-    "@vue/cli-plugin-e2e-nightwatch": "^3.0.0-beta.6",
-    "@vue/cli-plugin-eslint": "^3.0.0-beta.6",
-    "@vue/cli-plugin-pwa": "^3.0.0-beta.6",
-    "@vue/cli-plugin-unit-jest": "^3.0.0-beta.6",
-    "@vue/cli-service": "^3.0.0-beta.6",
-    "@vue/eslint-config-prettier": "^3.0.0-beta.6",
-    "@vue/test-utils": "^1.0.0-beta.10",
-    "babel-core": "^7.0.0-0",
-    "babel-jest": "^22.0.4",
-    "node-sass": "^4.7.2",
-    "sass-loader": "^6.0.6",
-    "vue-template-compiler": "^2.5.13"
-  },
-  "browserslist": [
-    "> 1%",
-    "last 2 versions",
-    "not ie <= 8"
-  ]
-}
diff --git a/src/store/actions.js b/src/store/actions.js
index 3a9abec..3c581cd 100644
--- a/src/store/actions.js
+++ b/src/store/actions.js
@@ -105,8 +105,8 @@
     // Fire and forget style backend update ;)
     return axios
       .put(config.todoEndpoint + "/" + state.todos[i]._id, state.todos[i])
-      .then(data => {
-        console.log("INFO - item " + id + " updated");
+      .then(() => {
+        console.info("INFO - item " + id + " updated");
       });
   }
 };
diff --git a/tests/unit/javascript/actions.spec.js b/tests/unit/javascript/actions.spec.js
index 9778f34..554057f 100644
--- a/tests/unit/javascript/actions.spec.js
+++ b/tests/unit/javascript/actions.spec.js
@@ -1,5 +1,4 @@
 import actions from "@/store/actions";
-import * as all from "../setup.js";
 import axios from "axios";
 import MockAdapter from "axios-mock-adapter";
 import sinon from "sinon";
diff --git a/tests/unit/javascript/mutations.spec.js b/tests/unit/javascript/mutations.spec.js
index 7552f9a..921c76e 100644
--- a/tests/unit/javascript/mutations.spec.js
+++ b/tests/unit/javascript/mutations.spec.js
@@ -1,5 +1,4 @@
 import mutations from "@/store/mutations";
-import * as all from "../setup.js";
 
 let state;
 const todo = {
diff --git a/tests/unit/javascript/store.spec.js b/tests/unit/javascript/store.spec.js
index 2e8841f..3613caa 100644
--- a/tests/unit/javascript/store.spec.js
+++ b/tests/unit/javascript/store.spec.js
@@ -1,5 +1,4 @@
 import store from "@/store";
-import * as all from "../setup.js";
 
 describe("Initial state tests", () => {
   it("should have no todos by default", () => {
diff --git a/tests/unit/vue-components/AboutLabs.spec.js b/tests/unit/vue-components/AboutLabs.spec.js
index 629ad51..b3a093e 100644
--- a/tests/unit/vue-components/AboutLabs.spec.js
+++ b/tests/unit/vue-components/AboutLabs.spec.js
@@ -1,3 +1,4 @@
+/* eslint-disable */
 import { shallow } from "@vue/test-utils";
 import AboutLabs from "@/components/AboutLabs.vue";
 import * as all from "../setup.js";
diff --git a/tests/unit/vue-components/ComponentView.spec.js b/tests/unit/vue-components/ComponentView.spec.js
index 1972c81..455aed0 100644
--- a/tests/unit/vue-components/ComponentView.spec.js
+++ b/tests/unit/vue-components/ComponentView.spec.js
@@ -1,3 +1,4 @@
+/* eslint-disable */
 import { shallow } from "@vue/test-utils";
 import ComponentView from "@/views/ComponentView.vue";
 import * as all from "../setup.js";
diff --git a/tests/unit/vue-components/Header.spec.js b/tests/unit/vue-components/Header.spec.js
index 3eca441..f385875 100644
--- a/tests/unit/vue-components/Header.spec.js
+++ b/tests/unit/vue-components/Header.spec.js
@@ -1,22 +1,13 @@
-import { shallow, createLocalVue } from "@vue/test-utils";
+import { shallow } from "@vue/test-utils";
 import Header from "@/components/Header.vue";
-import * as all from "../setup.js";
 
 describe("Header.vue", () => {
-  //   const Date = 15 / 12 / 1995;
-  //   it("has the expected html structure", () => {
-  //     const created = () => {}
-  //     const wrapper = shallow(Header, {
-  //       created
-  //     });
-  //     expect(wrapper.element).toMatchSnapshot();
-  //   });
-
   it("calls the loadTodos function from actionsjs when created", () => {
     const created = jest.fn();
     const wrapper = shallow(Header, {
       created
     });
+    expect(wrapper).toBeTruthy();
     expect(created).toHaveBeenCalled();
   });
 });
diff --git a/tests/unit/vue-components/ListOfTodos.spec.js b/tests/unit/vue-components/ListOfTodos.spec.js
index 1745994..c4091b2 100644
--- a/tests/unit/vue-components/ListOfTodos.spec.js
+++ b/tests/unit/vue-components/ListOfTodos.spec.js
@@ -1,7 +1,7 @@
+/* eslint-disable */
 import { shallow, createLocalVue } from "@vue/test-utils";
 import Vuex from "vuex";
 import ListOfTodos from "@/components/ListOfTodos.vue";
-// import { expect } from 'chai'
 
 import * as all from "../setup.js";
 
@@ -35,11 +35,13 @@
 
   it("calls the loadTodos function from actionsjs when created", () => {
     const wrapper = shallow(ListOfTodos, { store, localVue });
+    expect(wrapper).toBeTruthy();
     expect(actions.loadTodos).toHaveBeenCalled();
   });
 
   it("maps getters with todos when computed", () => {
     const wrapper = shallow(ListOfTodos, { store, localVue });
+    expect(wrapper).toBeTruthy();
     expect(getters.todos).toHaveBeenCalled();
   });
 
diff --git a/tests/unit/vue-components/NewTodo.spec.js b/tests/unit/vue-components/NewTodo.spec.js
index cb82ba9..df32c74 100644
--- a/tests/unit/vue-components/NewTodo.spec.js
+++ b/tests/unit/vue-components/NewTodo.spec.js
@@ -1,26 +1,25 @@
-import { shallow, createLocalVue, mount } from "@vue/test-utils";
+/* eslint-disable */
+import { shallow, createLocalVue } from "@vue/test-utils";
 import Vuex from "vuex";
 import NewTodo from "@/components/NewTodo.vue";
-// import { expect } from 'chai'
 
 import * as all from "../setup.js";
 
 const localVue = createLocalVue();
 
 localVue.use(Vuex);
+let methods;
+let store;
 
 describe("NewTodo.vue", () => {
-  let methods;
-  let store;
-
   beforeEach(() => {
-    (methods = {
+    methods = {
       newTodoAdded: jest.fn()
-    }),
-      (store = new Vuex.Store({
-        state: {},
-        methods
-      }));
+    };
+    store = new Vuex.Store({
+      state: {},
+      methods
+    });
   });
 
   it("calls newTodoAdded() when keyup.enter hit.", () => {
@@ -56,16 +55,4 @@
     const wrapper = shallow(NewTodo);
     expect(wrapper.element).toMatchSnapshot();
   });
-
-  // it("has the expected html structure", () => {
-  //   const wrapper = mount(NewTodo);
-  //   expect(wrapper.element).toMatchSnapshot();
-  // });
-
-  // it("renders newTodo as test string ", () => {
-  //   const wrapper = shallow(NewTodo, {
-  //     propsData: { newTodo: "test string" }
-  //   });
-  //   expect(wrapper.vm.newTodo).toMatch("test string");
-  // });
 });
diff --git a/tests/unit/vue-components/Todo.spec.js b/tests/unit/vue-components/Todo.spec.js
index fb2bbff..9f2c741 100644
--- a/tests/unit/vue-components/Todo.spec.js
+++ b/tests/unit/vue-components/Todo.spec.js
@@ -1,3 +1,4 @@
+/* eslint-disable */
 import { shallow } from "@vue/test-utils";
 import Todo from "@/views/Todo.vue";
 import Header from "@/components/Header.vue";
diff --git a/tests/unit/vue-components/TodoItem.spec.js b/tests/unit/vue-components/TodoItem.spec.js
index 076eed7..1e66f00 100644
--- a/tests/unit/vue-components/TodoItem.spec.js
+++ b/tests/unit/vue-components/TodoItem.spec.js
@@ -1,3 +1,4 @@
+/* eslint-disable */
 import { shallow, mount, createLocalVue } from "@vue/test-utils";
 import Vuex from "vuex";
 import TodoItem from "@/components/TodoItem.vue";
diff --git a/tests/unit/vue-components/XofYItems.spec.js b/tests/unit/vue-components/XofYItems.spec.js
index cc78128..1ac9a33 100644
--- a/tests/unit/vue-components/XofYItems.spec.js
+++ b/tests/unit/vue-components/XofYItems.spec.js
@@ -1,26 +1,14 @@
-import { shallow, createLocalVue, mount } from "@vue/test-utils";
+/* eslint-disable */
+import { shallow, createLocalVue } from "@vue/test-utils";
 import Vuex from "vuex";
 import XofYItems from "@/components/XofYItems.vue";
-
-import * as all from "../setup.js";
 
 const localVue = createLocalVue();
 
 localVue.use(Vuex);
 
+let store;
 describe("XofYItems.vue", () => {
-  let store;
-
-  const todos = [
-    {
-      title: "Learn awesome things about Labs",
-      completed: false,
-      important: false
-    }
-  ];
-  //   const methods = {
-  //     sumDoneTodoItems: jest.fn()
-  //   };
   const actions = {
     loadTodos: jest.fn(),
     clearTodos: jest.fn()
@@ -57,7 +45,5 @@
     ];
 
     expect(mockedTodos.length).toEqual(3);
-    // Replace with testing the sumDoneTodoItems function and check it it's called
-    // expect(sumDoneTodoItems).toHaveBeenCalled()
   });
 });

--
Gitblit v1.9.3