Skip to content

Commit 107bbcd

Browse files
author
Lionel Bijaoui
committed
Improve Codacy score
1 parent 8980a7f commit 107bbcd

35 files changed

+116
-111
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DS_Store
22
node_modules/
33
dist/*-report.html
4-
test/unit/coverage
4+
tests/unit/coverage
55

66
# local env files
77
.env.local

dev/mixins/utils.js

+1-30
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,7 @@
11
export default {
22
computed: {
33
prettyModel() {
4-
return this.prettyJSON(this.model);
5-
}
6-
},
7-
methods: {
8-
prettyJSON(json) {
9-
if (json) {
10-
json = JSON.stringify(json, null, 4);
11-
json = json
12-
.replace(/&/g, "&")
13-
.replace(/</g, "&lt;")
14-
.replace(/>/g, "&gt;");
15-
return json.replace(
16-
/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g,
17-
function(match) {
18-
let cls = "number";
19-
if (/^"/.test(match)) {
20-
if (/:$/.test(match)) {
21-
cls = "key";
22-
} else {
23-
cls = "string";
24-
}
25-
} else if (/true|false/.test(match)) {
26-
cls = "boolean";
27-
} else if (/null/.test(match)) {
28-
cls = "null";
29-
}
30-
return "<span class='" + cls + "'>" + match + "</span>";
31-
}
32-
);
33-
}
4+
return JSON.stringify(this.model, null, 4);
345
}
356
}
367
};

dev/projects/basic/app.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</div>
99
<div class="row">
1010
<div class="col-sm-12">
11-
<pre v-if="model" v-html="prettyModel"></pre>
11+
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
1212
</div>
1313
</div>
1414
</div>

dev/projects/basic/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<%= htmlWebpackPlugin.options.title %>
88
</title>
99
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
10+
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
1011

1112
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js"></script>
1213
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>

dev/projects/basic/main.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Vue from "vue";
2-
import VueFormGenerator from "../../../src";
2+
3+
import VueFormGenerator from "@";
34
Vue.use(VueFormGenerator);
45

6+
import VueHighlightJS from "vue-highlightjs";
7+
Vue.use(VueHighlightJS);
8+
59
import App from "./app.vue";
610

711
new Vue({

dev/projects/checklist/app.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</div>
99
<div class="row">
1010
<div class="col-sm-12">
11-
<pre v-if="model" v-html="prettyModel"></pre>
11+
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
1212
</div>
1313
</div>
1414
</div>

dev/projects/checklist/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<%= htmlWebpackPlugin.options.title %>
88
</title>
99
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
10+
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
1011
</head>
1112

1213
<body>

dev/projects/checklist/main.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Vue from "vue";
2-
import VueFormGenerator from "./../../../src";
2+
3+
import VueFormGenerator from "@";
34
Vue.use(VueFormGenerator);
45

6+
import VueHighlightJS from "vue-highlightjs";
7+
Vue.use(VueHighlightJS);
8+
59
import App from "./app.vue";
610

711
new Vue({

dev/projects/custom/app.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</div>
5050
<div class="row">
5151
<div class="col-sm-12">
52-
<pre v-if="model" v-html="prettyModel"></pre>
52+
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
5353
</div>
5454
</div>
5555
</div>

dev/projects/custom/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU"
1010
crossorigin="anonymous">
1111
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
12+
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
1213
</head>
1314

1415
<body>

dev/projects/custom/main.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Vue from "vue";
2-
import VueFormGenerator from "../../../src";
2+
3+
import VueFormGenerator from "@";
34
Vue.use(VueFormGenerator);
45

6+
import VueHighlightJS from "vue-highlightjs";
7+
Vue.use(VueHighlightJS);
8+
59
import App from "./app.vue";
610

711
new Vue({

dev/projects/full/app.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</vue-form-generator>
2828
</div>
2929
<div class="col-md-6">
30-
<pre v-if="model" v-html="prettyModel"></pre>
30+
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
3131
</div>
3232
</div>
3333
</div>

dev/projects/full/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<title>
77
<%= htmlWebpackPlugin.options.title %>
88
</title>
9+
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
910
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css">
1011
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
1112
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.11.2/css/bootstrap-select.min.css">

dev/projects/full/main.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Vue from "vue";
2-
import VueFormGenerator from "../../../src";
2+
3+
import VueFormGenerator from "@";
34
Vue.use(VueFormGenerator);
45

6+
import VueHighlightJS from "vue-highlightjs";
7+
Vue.use(VueHighlightJS);
8+
59
import App from "./app.vue";
610

711
new Vue({

dev/projects/grouping/app.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</div>
99
<div class="row">
1010
<div class="col-sm-12">
11-
<pre v-if="model" v-html="prettyModel"></pre>
11+
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
1212
</div>
1313
</div>
1414
</div>

dev/projects/grouping/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<%= htmlWebpackPlugin.options.title %>
88
</title>
99
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
10+
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
1011
</head>
1112

1213
<body>

dev/projects/grouping/main.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Vue from "vue";
2-
import VueFormGenerator from "../../../src";
2+
3+
import VueFormGenerator from "@";
34
Vue.use(VueFormGenerator);
45

6+
import VueHighlightJS from "vue-highlightjs";
7+
Vue.use(VueHighlightJS);
8+
59
import App from "./app.vue";
610

711
new Vue({

dev/projects/multi/app.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</div>
1414
<div class="row">
1515
<div class="col-sm-12">
16-
<pre v-if="model" v-html="prettyModel"></pre>
16+
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
1717
</div>
1818
</div>
1919
</div>

dev/projects/multi/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<%= htmlWebpackPlugin.options.title %>
88
</title>
99
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
10+
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
1011

1112
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js"></script>
1213
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>

dev/projects/multi/main.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Vue from "vue";
2-
import VueFormGenerator from "../../../src";
2+
3+
import VueFormGenerator from "@";
34
Vue.use(VueFormGenerator);
45

6+
import VueHighlightJS from "vue-highlightjs";
7+
Vue.use(VueHighlightJS);
8+
59
import App from "./app.vue";
610

711
new Vue({

dev/projects/multiselect/app.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</div>
99
<div class="row">
1010
<div class="col-sm-12">
11-
<pre v-if="model" v-html="prettyModel"></pre>
11+
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
1212
</div>
1313
</div>
1414
</div>

dev/projects/multiselect/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<%= htmlWebpackPlugin.options.title %>
88
</title>
99
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
10+
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
1011
<link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]/dist/vue-multiselect.min.css">
1112
<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/vue-multiselect.min.js"></script>
1213
</head>

dev/projects/multiselect/main.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Vue from "vue";
2-
import VueFormGenerator from "../../../src";
2+
3+
import VueFormGenerator from "@";
34
Vue.use(VueFormGenerator);
45

6+
import VueHighlightJS from "vue-highlightjs";
7+
Vue.use(VueHighlightJS);
8+
59
import App from "./app.vue";
610

711
new Vue({

dev/projects/picker/app.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</div>
99
<div class="row">
1010
<div class="col-sm-12">
11-
<pre v-if="model" v-html="prettyModel"></pre>
11+
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
1212
</div>
1313
</div>
1414
</div>

dev/projects/picker/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<%= htmlWebpackPlugin.options.title %>
88
</title>
99

10+
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
1011
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css">
1112
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
1213
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker.css">

dev/projects/picker/main.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Vue from "vue";
2-
import VueFormGenerator from "../../../src";
2+
3+
import VueFormGenerator from "@";
34
Vue.use(VueFormGenerator);
45

6+
import VueHighlightJS from "vue-highlightjs";
7+
Vue.use(VueHighlightJS);
8+
59
import App from "./app.vue";
610

711
new Vue({

dev/style.scss

+1-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import url("https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300|Open+Sans:300,600,700&subset=latin-ext");
1+
@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,600,700&subset=latin-ext");
22
html {
33
font-family: "Open Sans";
44
font-size: 14px;
@@ -10,26 +10,6 @@ html {
1010
box-sizing: border-box;
1111
}
1212

13-
pre {
14-
overflow: auto;
15-
16-
.string {
17-
color: #885800;
18-
}
19-
.number {
20-
color: blue;
21-
}
22-
.boolean {
23-
color: magenta;
24-
}
25-
.null {
26-
color: red;
27-
}
28-
.key {
29-
color: green;
30-
}
31-
}
32-
3313
.control-buttons {
3414
button {
3515
margin: 0.2em 0.3em;

0 commit comments

Comments
 (0)