Skip to content

Commit c55b3bf

Browse files
committed
Add linting to project
1 parent 0c407cb commit c55b3bf

File tree

9 files changed

+567
-37
lines changed

9 files changed

+567
-37
lines changed

.eslintrc.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ parserOptions:
33
env:
44
node: true
55
mocha: true
6-
chai: true
76
extends: eslint:recommended
87
rules:
98
quotes: [1, "single"]

lib/TreeData.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// A single tree nodes data
22

33
const debug = require('debug')('d::domain-tree::TreeData')
4-
const _ = require('lodash')
54

65

76
module.exports = class TreeData {

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
"test": "mocha test/unit test/int",
1818
"test:unit": "mocha test/unit",
1919
"test:int": "mocha test/int",
20+
"test:lint": "eslint lib/ test/",
2021
"test:benchmark": "node test/benchmark/benchmark_slice_lodash.js",
2122
"test:coverage": "nyc _mocha test/unit test/int && nyc report -r html && nyc check-coverage",
2223
"release:test": "set -uex; yarn run test; yarn run build; npm version prerelease; npm publish --tag testing --access public",
23-
"release:patch": "set -uex; git pull; rm -rf node_modules; yarn; yarn run test:coverage; ./make.sh test:all; npm version patch; git push; npm publish --access public; git push --tags"
24+
"release:patch": "set -uex; git pull; rm -rf node_modules; yarn; yarn run test:coverage; yarn run test:lint; ./make.sh test:all; npm version patch; git push; npm publish --access public; git push --tags"
2425
},
2526
"keywords": [
2627
"domain",
@@ -31,6 +32,7 @@
3132
"devDependencies": {
3233
"benchmark": "^2.1.2",
3334
"chai": "^4.1.2",
35+
"eslint": "^4.18.2",
3436
"mocha": "^5.0.2",
3537
"nyc": "^11.4.1"
3638
},
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const Benchmark = require('benchmark');
2-
const _ = require('lodash');
1+
const Benchmark = require('benchmark')
2+
const _ = require('lodash')
33

4-
let suite = new Benchmark.Suite;
4+
let suite = new Benchmark.Suite
55
let array = [999,4,3,4,5,6,7,3,2,3,3,5,5,3]
66
let long_array = [
7-
999,4,23,4,5,6,"asdfasdfsfasdvda","asdfdsafdsafsa",7,3,2,3,3,5,5,3,1324,1324,1234,1234,
8-
"kidfffkdsajflkndsafnm,dsanfmsadnfmdsa",1234,345,345,465,67,578,678,678,546,
7+
999,4,23,4,5,6,'asdfasdfsfasdvda','asdfdsafdsafsa',7,3,2,3,3,5,5,3,1324,1324,1234,1234,
8+
'kidfffkdsajflkndsafnm,dsanfmsadnfmdsa',1234,345,345,465,67,578,678,678,546,
99
32532,2143,324,324,32432,432,423,324,234,34223,
1010
45,456,547,65876,867,76,987987,978,978078,8656,4534,42,
1111
42,432,436,45,6567,678,79,780,890980,890899,7665,45,543,532,423,42,53,3635,77,8675,84,754,6345,32,423,
@@ -15,53 +15,54 @@ let long_array = [
1515
623,53,254,2,42,6,5437,36,7654,7,4356,43,625,46,3456,354,76,457,658,76,869,7890,978,9867,23423,547,45,
1616
63,463,245,432,23423,4235243,1234,12,41,4123,5,1325,132,52,5315,1325,31253,125,1253,125,125,153,125,
1717
125,1,6432,623,46,3246,15,32,15,12,51,23,243,54236,43567,4,7456,765,8765,8967,96789,67,98765,
18-
"trrsgdfgsfdgfsdgdsf",74,364,5365,235,6346,3547,6534,67345,6345,6,346,3456,345,634,6344,3452,5,235,
18+
'trrsgdfgsfdgfsdgdsf',74,364,5365,235,6346,3547,6534,67345,6345,6,346,3456,345,634,6344,3452,5,235,
1919
3245,4235,2435,2345,235,235,2345,4235,235,234542,352,345423,52,35,36,53246,7435,764,74,634,3546345,
2020
3255,32,23465,246,534,7534,6543,453,6345,65,346,3456,345,34,346,54,534,634,6345,634,56,3463,456,3456,
2121
346,4,634,6543,634,64,3456345
2222
]
2323

2424
let r = []
2525
r[0] = _.tail(array)
26-
r[1] = array.slice(1,array.length)
27-
if (r[0] !== r[1]) console.error('ne',r[0],r[1])
26+
r[1] = array.slice(1, array.length)
27+
if (r[0] !== r[1]) console.error('ne',r[0],r[1]) // eslint-disable-line no-console
2828
// add tests
2929

3030
suite
3131
.add('rest - native slice', function() {
32-
array.slice(1,array.length);
32+
array.slice(1, array.length)
3333
})
3434
.add('rest - lodash tail', function() {
35-
_.tail(array);
35+
_.tail(array)
3636
})
3737

3838
.add('rest long- native slice', function() {
39-
array.slice(1,array.length);
39+
long_array.slice(1, long_array.length)
4040
})
4141
.add('rest long- lodash tail', function() {
42-
_.tail(array);
42+
_.tail(long_array)
4343
})
4444

4545
.add('first - native direct', function() {
4646
array[0]
4747
})
4848
.add('first - lodash first', function() {
49-
_.first(array);
49+
_.first(array)
5050
})
5151

5252
.add('first long- native direct', function() {
53-
array[0]
53+
long_array[0]
5454
})
5555
.add('first long- lodash first', function() {
56-
_.first(array);
56+
_.first(long_array)
5757
})
5858

5959
// add listeners
6060
.on('cycle', function(event) {
61-
console.log(String(event.target));
61+
console.log(String(event.target)) // eslint-disable-line no-console
6262
})
6363
.on('complete', function() {
64-
console.log('Fastest is ' + this.filter('fastest').map('name'));
64+
let msg = 'Fastest is ' + this.filter('fastest').map('name')
65+
console.log(msg) // eslint-disable-line no-console
6566
})
6667
// run async
67-
.run({ 'async': true });
68+
.run({ 'async': true })

test/unit/unit-DomainName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
/* global expect */
22
const DomainName = require('../../lib/DomainName')
33

44
describe('Unit', function(){

test/unit/unit-DomainNames.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
/* global expect */
22
const DomainNames = require('../../lib/DomainNames')
33

44

test/unit/unit-Tree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
/* global expect */
22
const Tree = require('../../lib/Tree')
33

44

test/unit/unit-module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
/* global expect */
22
const domaintree = require('../../')
33

44

0 commit comments

Comments
 (0)