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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 30 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 5 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 5 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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>

0 commit comments

Comments
 (0)