Skip to content

Commit 00329fc

Browse files
authored
Merge pull request #916 from XhmikosR/eslint
Switch to ESLint
2 parents 0808356 + 03bb837 commit 00329fc

3 files changed

Lines changed: 56 additions & 19 deletions

File tree

example.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
global.watcher = require('.').watch('.', {
24
ignored: /node_modules|\.git/,
35
persistent: true,

package.json

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@types/node": "^12",
2929
"chai": "^4.2",
3030
"dtslint": "0.4.1",
31-
"jshint": "^2.10.2",
31+
"eslint": "^6.5.1",
3232
"mocha": "^6.2.1",
3333
"nyc": "^14.1.1",
3434
"rimraf": "^2.7.1",
@@ -51,7 +51,7 @@
5151
"license": "MIT",
5252
"scripts": {
5353
"dtslint": "dtslint types",
54-
"lint": "jshint index.js test.js lib",
54+
"lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .",
5555
"mocha": "mocha",
5656
"test": "npm run lint && nyc npm run mocha -- --exit"
5757
},
@@ -65,21 +65,53 @@
6565
"fsevents"
6666
],
6767
"types": "./types/index.d.ts",
68-
"jshintConfig": {
69-
"bitwise": false,
70-
"curly": false,
71-
"eqeqeq": true,
72-
"eqnull": true,
73-
"esversion": 9,
74-
"expr": true,
75-
"mocha": true,
76-
"nocomma": true,
77-
"node": true,
78-
"nonbsp": true,
79-
"strict": "global",
80-
"trailingcomma": false,
81-
"undef": true,
82-
"unused": true
68+
"eslintConfig": {
69+
"extends": "eslint:recommended",
70+
"parserOptions": {
71+
"ecmaVersion": 9,
72+
"sourceType": "script"
73+
},
74+
"env": {
75+
"node": true,
76+
"es6": true
77+
},
78+
"rules": {
79+
"no-empty": [
80+
"error",
81+
{
82+
"allowEmptyCatch": true
83+
}
84+
],
85+
"object-shorthand": "error",
86+
"prefer-arrow-callback": [
87+
"error",
88+
{
89+
"allowNamedFunctions": true
90+
}
91+
],
92+
"prefer-const": [
93+
"error",
94+
{
95+
"ignoreReadBeforeAssign": true
96+
}
97+
],
98+
"prefer-destructuring": [
99+
"error",
100+
{
101+
"object": true,
102+
"array": false
103+
}
104+
],
105+
"prefer-spread": "error",
106+
"prefer-template": "error",
107+
"radix": "error",
108+
"strict": "error",
109+
"quotes": [
110+
"error",
111+
"single"
112+
],
113+
"no-var": "error"
114+
}
83115
},
84116
"nyc": {
85117
"include": [

test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-env mocha */
2+
13
'use strict';
24

35
const fs = require('fs');
@@ -1769,16 +1771,17 @@ const runTests = (baseopts) => {
17691771
function isSpyReady(spy) {
17701772
return Array.isArray(spy) ? spy[0].callCount >= spy[1] : spy.callCount;
17711773
}
1774+
let intrvl, to;
17721775
function finish() {
17731776
clearInterval(intrvl);
17741777
clearTimeout(to);
17751778
fn();
17761779
fn = Function.prototype;
17771780
}
1778-
var intrvl = setInterval(() => {
1781+
intrvl = setInterval(() => {
17791782
if (spies.every(isSpyReady)) finish();
17801783
}, 5);
1781-
var to = setTimeout(finish, 3500);
1784+
to = setTimeout(finish, 3500);
17821785
}
17831786

17841787
it('should handle unlink that happens while waiting for stat to return', (done) => {

0 commit comments

Comments
 (0)