From 516b0747901c1d3efb4097bb89f2f7bce7e7ba36 Mon Sep 17 00:00:00 2001 From: Igor Savin Date: Sun, 6 Oct 2019 20:20:46 +0200 Subject: [PATCH] Enable linting in CI (#3450) --- .travis.yml | 3 +-- lib/query/builder.js | 4 ++-- package.json | 32 +++++++++++++++++--------------- test/index.js | 1 + types/index.d.ts | 2 +- types/tslint.json | 1 + 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 398dfe3e0d..b030361f18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -# .travis.yml language: node_js sudo: required @@ -14,7 +13,7 @@ matrix: - node_js: '10' env: DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000 - node_js: '8' - env: TESTSCRIPT=test:nyc DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000 + env: TESTSCRIPT=test:everything DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000 install: - npm i - (echo $DB | grep oracledb) && npm install oracledb@3.1.2 || true diff --git a/lib/query/builder.js b/lib/query/builder.js index cbbd5517c2..27546f15a3 100644 --- a/lib/query/builder.js +++ b/lib/query/builder.js @@ -1271,8 +1271,8 @@ Builder.prototype.del = Builder.prototype.delete; require('../interface')(Builder); helpers.addQueryContext(Builder); -Builder.extend = function(methodName, fn) { - if (Builder.prototype.hasOwnProperty(methodName)) { +Builder.extend = (methodName, fn) => { + if (Object.prototype.hasOwnProperty.call(Builder.prototype, methodName)) { throw new Error( `Can't extend QueryBuilder with existing method ('${methodName}').` ); diff --git a/package.json b/package.json index 203176dc21..8467ee5826 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,10 @@ "coveralls": "nyc report --reporter=text-lcov | coveralls", "lint": "eslint \"lib/**/*.js\" \"test/**/*.js\"", "lint:types": "dtslint types", + "lint:everything": "npm run lint:types && npm run lint", "test": "mocha --exit -t 10000 test/index.js && npm run test:tape && npm run test:cli", - "test:nyc": "nyc mocha --exit --check-leaks --globals __core-js_shared__ -t 10000 test/index.js && npm run test:tape && npm run test:cli", + "test:coverage": "nyc mocha --exit --check-leaks --globals __core-js_shared__ -t 10000 test/index.js && npm run test:tape && npm run test:cli", + "test:everything": "npm run lint:everything && npm run test:coverage", "test:sqlite": "cross-env DB=sqlite3 npm test", "test:tape": "node test/tape/index.js | tap-spec", "test:cli": "cross-env KNEX_PATH=../knex.js KNEX=bin/cli.js jake -f test/jake/Jakefile", @@ -26,9 +28,9 @@ "stress:destroy": "docker-compose -f scripts/stress-test/docker-compose.yml stop" }, "dependencies": { - "bluebird": "^3.5.5", + "bluebird": "^3.7.0", "colorette": "1.1.0", - "commander": "^3.0.1", + "commander": "^3.0.2", "debug": "4.1.1", "getopts": "2.2.5", "inherits": "~2.0.4", @@ -49,21 +51,21 @@ ] }, "devDependencies": { - "@types/node": "^10.14.17", + "@types/node": "^10.14.20", "JSONStream": "^1.3.5", "chai": "^4.2.0", "chai-subset-in-order": "^2.1.3", - "cli-testlab": "^1.7.0", + "cli-testlab": "^1.8.0", "coveralls": "^3.0.6", - "cross-env": "^5.2.1", - "dtslint": "^0.9.6", - "eslint": "^6.3.0", - "eslint-config-prettier": "^6.2.0", + "cross-env": "^6.0.3", + "dtslint": "^0.9.8", + "eslint": "^6.5.1", + "eslint-config-prettier": "^6.4.0", "eslint-plugin-import": "^2.18.2", - "husky": "^3.0.5", + "husky": "^3.0.8", "jake": "^8.1.1", - "lint-staged": "^9.2.5", - "mocha": "^6.2.0", + "lint-staged": "^9.4.1", + "mocha": "^6.2.1", "mock-fs": "^4.10.1", "mssql": "^5.1.0", "mysql": "^2.17.1", @@ -73,15 +75,15 @@ "pg-query-stream": "^2.0.0", "prettier": "^1.18.2", "rimraf": "^3.0.0", - "sinon": "^7.4.2", + "sinon": "^7.5.0", "sinon-chai": "^3.3.0", "source-map-support": "^0.5.13", "sqlite3": "^4.1.0", "tap-spec": "^5.0.0", "tape": "^4.11.0", "toxiproxy-node-client": "^2.0.6", - "typescript": "^3.6.2", - "webpack-cli": "^3.3.8" + "typescript": "^3.6.3", + "webpack-cli": "^3.3.9" }, "buildDependencies": [ "rimraf" diff --git a/test/index.js b/test/index.js index c0fe9ac533..0a9111719a 100644 --- a/test/index.js +++ b/test/index.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ 'use strict'; require('source-map-support').install(); diff --git a/types/index.d.ts b/types/index.d.ts index a0bb051112..3100581bfd 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1873,7 +1873,7 @@ declare namespace Knex { } class QueryBuilder { - public static extend( + static extend( methodName: string, fn: ( this: Knex, diff --git a/types/tslint.json b/types/tslint.json index 69846155b9..3869684dc5 100644 --- a/types/tslint.json +++ b/types/tslint.json @@ -4,6 +4,7 @@ "ban-types": false, "await-promise": false, "array-type": false, + "no-unnecessary-class": false, "no-unnecessary-generics": false, "no-empty-interface": false, "unified-signatures": false,