refactor: eslint setup (#70)
* replace dependencies with @cordova/eslint-config
* update eslint config
* eslint corrections
diff --git a/.eslintrc.yml b/.eslintrc.yml
index f6aae32..3a6b031 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -1,10 +1,2 @@
root: true
-extends: semistandard
-rules:
- indent:
- - error
- - 4
- camelcase: off
- padded-blocks: off
- operator-linebreak: off
- no-throw-literal: off
+extends: '@cordova/eslint-config/node'
diff --git a/.travis.yml b/.travis.yml
index c29410d..21696b8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,9 @@
language: node_js
sudo: false
+
git:
depth: 10
+
node_js:
- 10
- 12
diff --git a/package.json b/package.json
index b95de33..392313c 100644
--- a/package.json
+++ b/package.json
@@ -30,22 +30,16 @@
"which": "^1.3.1"
},
"devDependencies": {
- "eslint": "^5.15.2",
- "eslint-config-semistandard": "^13.0.0",
- "eslint-config-standard": "^12.0.0",
- "eslint-plugin-import": "^2.16.0",
- "eslint-plugin-node": "^8.0.1",
- "eslint-plugin-promise": "^4.0.1",
- "eslint-plugin-standard": "^4.0.0",
+ "@cordova/eslint-config": "^2.0.0",
"file-url": "^3.0.0",
"jasmine": "^3.5.0",
"nyc": "^14.1.1",
"rewire": "^4.0.1"
},
"scripts": {
- "test": "npm run eslint && npm run cover",
+ "test": "npm run lint && npm run cover",
"cover": "nyc jasmine",
- "eslint": "eslint --ignore-path .gitignore ."
+ "lint": "eslint --ignore-path .gitignore ."
},
"engines": {
"node": ">= 10",
diff --git a/spec/.eslintrc.yml b/spec/.eslintrc.yml
index 77cb525..f2c42a4 100644
--- a/spec/.eslintrc.yml
+++ b/spec/.eslintrc.yml
@@ -1,4 +1,2 @@
-env:
- jasmine: true
-rules:
- prefer-promise-reject-errors: off
+root: true
+extends: '@cordova/eslint-config/node-tests'
diff --git a/spec/fetch-unit.spec.js b/spec/fetch-unit.spec.js
index 3e26821..99922c3 100644
--- a/spec/fetch-unit.spec.js
+++ b/spec/fetch-unit.spec.js
@@ -40,7 +40,7 @@
});
it('should install package if not found', function () {
- fetch.__set__({ pathToInstalledPackage: _ => Promise.reject() });
+ fetch.__set__({ pathToInstalledPackage: _ => Promise.reject(new Error()) });
return fetch('foo', 'bar').then(result => {
expect(result).toBe('/foo');
diff --git a/spec/fetch.spec.js b/spec/fetch.spec.js
index 6cb7846..6e2adab 100644
--- a/spec/fetch.spec.js
+++ b/spec/fetch.spec.js
@@ -61,7 +61,6 @@
}
describe('fetch/uninstall tests via npm & git', function () {
-
it('should fetch and uninstall a cordova platform via npm & git', function () {
return Promise.resolve()
.then(_ => fetchAndMatch('cordova-android'))
@@ -79,7 +78,6 @@
});
describe('fetch/uninstall with --save', function () {
-
beforeEach(function () {
opts = { save: true };
// copy package.json from spec directory to tmpDir
@@ -132,7 +130,6 @@
});
describe('fetching already installed packages', function () {
-
beforeEach(function () {
fs.copySync(path.join(__dirname, 'support'), 'support');
});
@@ -166,7 +163,6 @@
});
describe('negative tests', function () {
-
it('should fail fetching a module that does not exist on npm', function () {
return fetch('NOTAMODULE', tmpDir, opts)
.then(function (result) {