Skip to content

Commit b671272

Browse files
author
unknown
committed
Added automation for running examples and downloading stuff from npm.
1 parent c1d4988 commit b671272

20 files changed

+229
-93
lines changed

.eslintrc.json

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 6,
4+
"ecmaFeatures": {
5+
"experimentalObjectRestSpread": true,
6+
"jsx": true
7+
},
8+
"sourceType": "module"
9+
},
10+
11+
"env": {
12+
"es6": true,
13+
"node": true
14+
},
15+
16+
"globals": {
17+
"document": false,
18+
"navigator": false,
19+
"window": false
20+
},
21+
22+
"rules": {
23+
"accessor-pairs": 1,
24+
"arrow-parens": [1, "always"],
25+
"arrow-spacing": [1, { "before": true, "after": true }],
26+
"block-spacing": [1, "always"],
27+
"brace-style": [1, "1tbs", { "allowSingleLine": true }],
28+
"comma-dangle": [1, "never"],
29+
"comma-spacing": [1, { "before": false, "after": true }],
30+
"comma-style": [1, "last"],
31+
"constructor-super": 1,
32+
"curly": [1, "multi-line"],
33+
"dot-location": [1, "property"],
34+
"eol-last": 0,
35+
"eqeqeq": [0, "allow-null"],
36+
"generator-star-spacing": [1, { "before": true, "after": true }],
37+
"handle-callback-err": [1, "^(err|error)$" ],
38+
"indent": [1, 4],
39+
"jsx-quotes": [1, "prefer-single"],
40+
"key-spacing": [1, { "beforeColon": false, "afterColon": true }],
41+
"keyword-spacing": [1, { "before": true, "after": true }],
42+
"new-cap": [1, { "newIsCap": false, "capIsNew": false }],
43+
"new-parens": 1,
44+
"no-array-constructor": 1,
45+
"no-caller": 1,
46+
"no-class-assign": 1,
47+
"no-cond-assign": 1,
48+
"no-const-assign": 1,
49+
"no-control-regex": 1,
50+
"no-debugger": 1,
51+
"no-delete-var": 1,
52+
"no-dupe-args": 1,
53+
"no-dupe-class-members": 1,
54+
"no-dupe-keys": 1,
55+
"no-duplicate-case": 1,
56+
"no-empty-character-class": 1,
57+
"no-empty-pattern": 1,
58+
"no-eval": 1,
59+
"no-ex-assign": 1,
60+
"no-extend-native": 1,
61+
"no-extra-bind": 1,
62+
"no-extra-boolean-cast": 1,
63+
"no-extra-parens": [1, "functions"],
64+
"no-fallthrough": 1,
65+
"no-floating-decimal": 1,
66+
"no-func-assign": 1,
67+
"no-implied-eval": 1,
68+
"no-inner-declarations": [1, "functions"],
69+
"no-invalid-regexp": 1,
70+
"no-irregular-whitespace": 1,
71+
"no-iterator": 1,
72+
"no-label-var": 1,
73+
"no-labels": [1, { "allowLoop": false, "allowSwitch": false }],
74+
"no-lone-blocks": 1,
75+
"no-mixed-spaces-and-tabs": 1,
76+
"no-multi-spaces": 1,
77+
"no-multi-str": 1,
78+
"no-multiple-empty-lines": [1, { "max": 1 }],
79+
"no-native-reassign": 1,
80+
"no-negated-in-lhs": 1,
81+
"no-new": 1,
82+
"no-new-func": 1,
83+
"no-new-object": 1,
84+
"no-new-require": 1,
85+
"no-new-symbol": 1,
86+
"no-new-wrappers": 1,
87+
"no-obj-calls": 1,
88+
"no-octal": 1,
89+
"no-octal-escape": 1,
90+
"no-path-concat": 1,
91+
"no-proto": 1,
92+
"no-redeclare": 1,
93+
"no-regex-spaces": 1,
94+
"no-return-assign": [1, "except-parens"],
95+
"no-self-assign": 1,
96+
"no-self-compare": 1,
97+
"no-sequences": 1,
98+
"no-shadow-restricted-names": 1,
99+
"no-spaced-func": 1,
100+
"no-sparse-arrays": 1,
101+
"no-this-before-super": 1,
102+
"no-throw-literal": 1,
103+
"no-trailing-spaces": 0,
104+
"no-undef": 1,
105+
"no-undef-init": 1,
106+
"no-unexpected-multiline": 1,
107+
"no-unneeded-ternary": [1, { "defaultAssignment": false }],
108+
"no-unreachable": 1,
109+
"no-unused-vars": 0,
110+
"no-useless-call": 1,
111+
"no-useless-constructor": 1,
112+
"no-with": 1,
113+
"one-var": [1, { "initialized": "never" }],
114+
"operator-linebreak": [1, "after", { "overrides": { "?": "before", ":": "before" } }],
115+
"padded-blocks": [0, "never"],
116+
"quotes": 0,
117+
"semi": [0, "never"],
118+
"semi-spacing": [1, { "before": false, "after": true }],
119+
"space-before-blocks": [1, "always"],
120+
"space-before-function-paren": 0,
121+
"space-in-parens": [1, "never"],
122+
"space-infix-ops": 1,
123+
"space-unary-ops": [1, { "words": true, "nonwords": false }],
124+
"spaced-comment": 0,
125+
"template-curly-spacing": [1, "never"],
126+
"use-isnan": 1,
127+
"valid-typeof": 1,
128+
"wrap-iife": [1, "any"],
129+
"yield-star-spacing": [1, "both"]
130+
}
131+
}

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ RUN apt-get -y update && apt-get install -y git && apt-get install -y vim && apt
66

77
#install necesary npm packages
88
RUN npm install -g mocha
9+
RUN npm install -g chai
10+
RUN npm install -g nock
911
RUN npm install -g istanbul
1012
RUN npm install -g grunt-cli
13+
RUN npm install -g eslint
1114

1215
#set the working directory
1316
WORKDIR /source

Gruntfile.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@ module.exports = function(grunt) {
4545

4646
// These plugins provide necessary tasks.
4747
grunt.loadNpmTasks("grunt-contrib-clean");
48-
grunt.loadNpmTasks("grunt-contrib-watch");
49-
grunt.loadNpmTasks("grunt-eslint");
48+
grunt.loadNpmTasks("grunt-contrib-watch");;
5049
grunt.loadNpmTasks("grunt-jsdoc");
5150

5251
// Task definitions.
5352
// run `grunt <task>` in command line and it will run the sequence in brackets
54-
grunt.registerTask("default", ["clean","jsdoc", "eslint"]);
53+
grunt.registerTask("default", ["clean","jsdoc"]);
5554
grunt.registerTask("doc", ["jsdoc"]);
56-
grunt.registerTask("lint", ["eslint"]);
5755
};

lib/Api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Api(userKey, serviceURL) {
5959
* @default
6060
*/
6161
this.serviceURL = "https://api.rosette.com/rest/v1/";
62-
if(serviceURL){
62+
if (serviceURL) {
6363
this.serviceURL = serviceURL;
6464
}
6565

lib/categories.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function categories() {
4141
*/
4242
categories.prototype.getResults = function(parameters, userKey, serviceURL, callback) {
4343

44-
if(parameters.loadParams().documentFile != null){
44+
if (parameters.loadParams().documentFile != null) {
4545
parameters.loadFile(parameters.loadParams().documentFile);
4646
}
4747

@@ -97,7 +97,7 @@ categories.prototype.getResults = function(parameters, userKey, serviceURL, call
9797

9898
if (res.statusCode === 200) {
9999
return callback(err, JSON.parse(result.toString()));
100-
} else if(res.statusCode != 200){
100+
} else if (res.statusCode != 200) {
101101
return callback(err, JSON.parse(result.toString()));
102102
}
103103
});

lib/checkVersion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ checkVersion.prototype.check = function(userKey, serviceURL, callback) {
8686

8787
if (res.statusCode === 200) {
8888
return callback(err, JSON.parse(result.toString()));
89-
}else if(res.statusCode != 200){
89+
} else if (res.statusCode != 200) {
9090
return callback(err, JSON.parse(result.toString()));
9191
}
9292
});

lib/entities.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function entities() {
4141
*/
4242
entities.prototype.getResults = function(parameters, userKey, serviceURL, callback) {
4343

44-
if(parameters.loadParams().documentFile != null){
44+
if (parameters.loadParams().documentFile != null) {
4545
parameters.loadFile(parameters.loadParams().documentFile);
4646
}
4747

@@ -102,7 +102,7 @@ entities.prototype.getResults = function(parameters, userKey, serviceURL, callba
102102

103103
if (res.statusCode === 200) {
104104
return callback(err, JSON.parse(result.toString()));
105-
} else if(res.statusCode != 200){
105+
} else if (res.statusCode != 200) {
106106
return callback(err, JSON.parse(result.toString()));
107107
}
108108
});

lib/language.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ language.prototype.getResults = function(parameters, userKey, serviceURL, callba
9797

9898
if (res.statusCode === 200) {
9999
return callback(err, JSON.parse(result.toString()));
100-
} else if(res.statusCode != 200){
100+
} else if (res.statusCode != 200) {
101101
return callback(err, JSON.parse(result.toString()));
102102
}
103103
});

lib/matchedName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ matchedName.prototype.getResults = function(parameters, userKey, serviceURL, cal
9595

9696
if (res.statusCode === 200) {
9797
return callback(err, JSON.parse(result.toString()));
98-
} else if(res.statusCode != 200){
98+
} else if (res.statusCode != 200) {
9999
return callback(err, JSON.parse(result.toString()));
100100
}
101101
});

lib/morphology.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function morphology() {
4040
* @param {function} callback - Callback function to be exectuted after the function to which it is passed is complete
4141
*/
4242
morphology.prototype.getResults = function(parameters, userKey, serviceURL, callback) {
43-
//console.log(parameters)
43+
//console.log(parameters)
4444
if (parameters.loadParams().documentFile != null) {
4545
parameters.loadFile(parameters.loadParams().documentFile);
4646
}
@@ -99,7 +99,7 @@ morphology.prototype.getResults = function(parameters, userKey, serviceURL, call
9999

100100
if (res.statusCode === 200) {
101101
return callback(err, JSON.parse(result.toString()));
102-
} else if(res.statusCode != 200){
102+
} else if (res.statusCode != 200) {
103103
return callback(err, JSON.parse(result.toString()));
104104
}
105105
});

0 commit comments

Comments
 (0)