Skip to content

Commit

Permalink
drop jscs and use eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
givanse committed Apr 10, 2019
1 parent d53f009 commit 01df2ab
Show file tree
Hide file tree
Showing 11 changed files with 553 additions and 455 deletions.
37 changes: 37 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
'parser': 'typescript-eslint-parser',
'globals': {
'Pretender': true,
'sinon': true, // karma-sinon
},
'env': {
'browser': true,
'es6': true,
'node': true,
'jquery': true,
'qunit': true,
},
'extends': 'eslint:recommended',
'parserOptions': {
'ecmaVersion': 2015,
'sourceType': 'module'
},
'rules': {
'indent': [
'error',
2
],
'linebreak-style': [
'error',
'unix'
],
'quotes': [
'error',
'single'
],
'semi': [
'error',
'always'
]
}
};
41 changes: 0 additions & 41 deletions .jscsrc

This file was deleted.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"prepublishOnly": "npm run build && npm run tests-only",
"pretest": "bower install",
"build": "rollup --config",
"test": "npm run lint && npm run jscs && npm run tests-only",
"test-ci": "npm run pretest && npm run build && npm run lint && npm run jscs && npm run tests-only-ci",
"test": "npm run lint && npm run eslint && npm run tests-only",
"test-ci": "npm run pretest && npm run build && npm run lint && npm run eslint && npm run tests-only-ci",
"tests-only": "karma start --single-run",
"tests-only-ci": "karma start --single-run --browsers PhantomJS",
"lint": "jshint test",
"jscs": "jscs test",
"eslint": "eslint src/**/*.ts test",
"test:server": "karma start --no-single-run"
},
"repository": {
Expand All @@ -30,7 +30,7 @@
"bower": "^1.8.2",
"coveralls": "^2.11.3",
"es6-promise": "^4.0.5",
"jscs": "^3.0.7",
"eslint": "^5.12.0",
"jshint": "^2.8.0",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.2.0",
Expand All @@ -47,7 +47,8 @@
"rollup-plugin-typescript": "^1.0.0",
"sinon": "^3.2.1",
"tslib": "^1.9.3",
"typescript": "~3.1.1"
"typescript": "~3.1.1",
"typescript-eslint-parser": "^21.0.2"
},
"dependencies": {
"fake-xml-http-request": "^2.0.0",
Expand Down
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ function interceptor(ctx) {
};

if (ctx.pretender._nativeXMLHttpRequest.prototype._passthroughCheck) {
// eslint-disable-next-line no-console
console.warn('You created a second Pretender instance while there was already one running. ' +
'Running two Pretender servers at once will lead to unexpected results and will ' +
'be removed entirely in a future major version.' +
Expand Down Expand Up @@ -324,9 +325,9 @@ Pretender.prototype = {
throw new Error('Nothing returned by handler for ' + path + '. ' + note);
}

var status = statusHeadersAndBody[0],
headers = pretender.prepareHeaders(statusHeadersAndBody[1]),
body = pretender.prepareBody(statusHeadersAndBody[2], headers);
var status = statusHeadersAndBody[0];
var headers = pretender.prepareHeaders(statusHeadersAndBody[1]);
var body = pretender.prepareBody(statusHeadersAndBody[2], headers);

pretender.handleResponse(request, async, function() {
request.respond(status, headers, body);
Expand Down
1 change: 1 addition & 0 deletions src/parse-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default function parseURL(url: string) {
anchor.href = url;

if (!anchor.host) {
// eslint-disable-next-line no-self-assign
anchor.href = anchor.href; // IE: load the host and protocol
}

Expand Down
Loading

0 comments on commit 01df2ab

Please sign in to comment.