Skip to content

Commit b997051

Browse files
committed
replaced eslint with standard.
1 parent 02632aa commit b997051

File tree

15 files changed

+497
-208
lines changed

15 files changed

+497
-208
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 28 deletions
This file was deleted.

dist/node-polyfill.js

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node-ponyfill.js

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"deploy:major": "npm version major && git push --follow-tags",
1515
"deploy:minor": "npm version minor && git push --follow-tags",
1616
"deploy:patch": "npm version patch && git push --follow-tags",
17-
"lint": "eslint .",
17+
"lint": "standard",
1818
"sauce": "./tasks/sauce",
1919
"security": "snyk test",
2020
"test": "npm run -s test:headless && npm run -s test:node && npm run -s test:node:bundle && npm run -s lint",
@@ -25,10 +25,24 @@
2525
},
2626
"lint-staged": {
2727
"*.js": [
28-
"eslint --fix",
28+
"standard --fix",
2929
"git add"
3030
]
3131
},
32+
"standard": {
33+
"env": [
34+
"mocha",
35+
"browser"
36+
],
37+
"globals": [
38+
"expect",
39+
"chai",
40+
"sinon"
41+
],
42+
"ignore": [
43+
"/dist/"
44+
]
45+
},
3246
"repository": {
3347
"type": "git",
3448
"url": "https://github.com/lquixada/cross-fetch.git"
@@ -45,7 +59,6 @@
4559
"devDependencies": {
4660
"chai": "4.1.2",
4761
"codecov": "3.1.0",
48-
"eslint": "5.5.0",
4962
"husky": "0.14.3",
5063
"lint-staged": "7.2.2",
5164
"mocha": "5.2.0",
@@ -59,6 +72,7 @@
5972
"rollup-plugin-uglify": "5.0.2",
6073
"sinon": "6.2.0",
6174
"snyk": "1.95.3",
75+
"standard": "12.0.1",
6276
"webpack": "4.17.3",
6377
"webpack-cli": "3.1.0"
6478
},

rollup.config.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* Rollup creates the browser version of the polyfill and ponyfill. */
2-
import path from 'path';
3-
import copy from 'rollup-plugin-copy';
4-
import {uglify} from 'rollup-plugin-uglify';
2+
import path from 'path'
3+
import copy from 'rollup-plugin-copy'
4+
import { uglify } from 'rollup-plugin-uglify'
55

6-
const input = path.join(__dirname, 'node_modules', 'whatwg-fetch', 'fetch.js');
6+
const input = path.join(__dirname, 'node_modules', 'whatwg-fetch', 'fetch.js')
77

8-
const outdent = str => str.replace(/^\s*/mg, '');
8+
const outdent = str => str.replace(/^\s*/mg, '')
99

1010
export default [
1111
// Ponyfill for commonjs usage via require('cross-fetch')
@@ -75,8 +75,8 @@ export default [
7575
strict: false
7676
},
7777
plugins: [
78-
uglify(),
78+
uglify()
7979
],
8080
context: 'this'
8181
}
82-
];
82+
]

src/node-polyfill.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
var fetchNode = require('./node-ponyfill');
2-
var fetch = fetchNode.fetch.bind({});
1+
var fetchNode = require('./node-ponyfill')
2+
var fetch = fetchNode.fetch.bind({})
33

4-
fetch.polyfill = true;
4+
fetch.polyfill = true
55

66
if (!global.fetch) {
7-
global.fetch = fetch;
8-
global.Response = fetchNode.Response;
9-
global.Headers = fetchNode.Headers;
10-
global.Request = fetchNode.Request;
7+
global.fetch = fetch
8+
global.Response = fetchNode.Response
9+
global.Headers = fetchNode.Headers
10+
global.Request = fetchNode.Request
1111
}
12-

src/node-ponyfill.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
var nodeFetch = require('node-fetch');
2-
var realFetch = nodeFetch.default || nodeFetch;
1+
var nodeFetch = require('node-fetch')
2+
var realFetch = nodeFetch.default || nodeFetch
33

44
var fetch = function (url, options) {
55
// Support schemaless URIs on the server for parity with the browser.
66
// Ex: //github.com/ -> https://github.com/
77
if (/^\/\//.test(url)) {
8-
url = 'https:' + url;
8+
url = 'https:' + url
99
}
10-
return realFetch.call(this, url, options);
11-
};
10+
return realFetch.call(this, url, options)
11+
}
1212

13-
fetch.polyfill = false;
13+
fetch.polyfill = false
1414

15-
module.exports = exports = fetch;
16-
exports.fetch = fetch;
17-
exports.Headers = nodeFetch.Headers;
18-
exports.Request = nodeFetch.Request;
19-
exports.Response = nodeFetch.Response;
15+
module.exports = exports = fetch
16+
exports.fetch = fetch
17+
exports.Headers = nodeFetch.Headers
18+
exports.Request = nodeFetch.Request
19+
exports.Response = nodeFetch.Response
2020

2121
// Needed for TypeScript.
22-
exports.default = fetch;
22+
exports.default = fetch

test/browser/setup.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
// Enable mocha's bdd style
2-
mocha.setup('bdd');
2+
mocha.setup('bdd')
33

44
// Add chai's expect to the global scope
5-
window.expect = chai.expect;
5+
window.expect = chai.expect
66

77
// Delete native fetch api to force the polyfill installation for test purposes
8-
delete window.fetch;
9-
delete window.Request;
10-
delete window.Response;
11-
delete window.Headers;
8+
delete window.fetch
9+
delete window.Request
10+
delete window.Response
11+
delete window.Headers
1212

1313
// Enable fake server
1414
before(function () {
15-
this.server = sinon.createFakeServer({ autoRespond: true });
15+
this.server = sinon.createFakeServer({ autoRespond: true })
1616

1717
this.server.respondWith('GET', '//lquixa.da/succeed.txt',
18-
[200, { 'Content-Type': 'text/plain' }, 'hello world.']);
18+
[200, { 'Content-Type': 'text/plain' }, 'hello world.'])
1919

2020
this.server.respondWith('GET', '//lquixa.da/fail.txt',
21-
[404, { 'Content-Type': 'text/plain' }, 'good bye world.']);
22-
});
21+
[404, { 'Content-Type': 'text/plain' }, 'good bye world.'])
22+
})
2323

2424
after(function () {
25-
this.server.restore();
26-
});
25+
this.server.restore()
26+
})

0 commit comments

Comments
 (0)