Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies. Replace JSHint with ESLint. Remove grunt #61

Merged
merged 4 commits into from
Dec 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"env": {
"node": true,
"mocha": true
},
"parserOptions": {
"ecmaVersion": 5,
"sourceType": "script"
},
"extends": "eslint:recommended",
"rules": {
"no-empty": "off",
"no-unused-vars": "off"
}
}
4 changes: 0 additions & 4 deletions .jshintrc

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Follow the same coding format seen in the source code; the one hard requirement

## Tests

There is an exhaustive test suite under `/tests`; statement compilation tests may be run using `grunt` (executing `tests/*.js` files),
and tests against a live Cassandra cluster may be run via `grunt test-live` (executing `tests/live/live.test.js`).
There is an exhaustive test suite under `/tests`; statement compilation tests may be run using `yarn run test` (executing `tests/*.js` files),
and tests against a live Cassandra cluster may be run via `yarn run test:live` (executing `tests/live/live.test.js`).

PR's that provide additional functionality should also provide corresponding unit test cases.
40 changes: 0 additions & 40 deletions gruntfile.js

This file was deleted.

22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,27 @@
"test": "tests"
},
"scripts": {
"test": "nyc mocha tests/*.js"
"test": "nyc mocha --check-leaks tests/*.js",
"test:live": "nyc mocha --check-leaks tests/live/*.js",
"test:ci": "npm run lint && npm run test",
"lint": "eslint .",
"lint:fix": "eslint --fix ."
},
"author": "austin brown <[email protected]> (http://www.azuqua.com/)",
"license": "MIT",
"dependencies": {
"cassandra-driver": "^3.6.0",
"inherits": "^2.0.3",
"lodash": "^4.17.14"
"lodash": "^4.17.15"
},
"devDependencies": {
"async": "^3.0.1",
"chai": "^4.1.2",
"grunt": "^1.0.3",
"grunt-contrib-jshint": "^2.1.0",
"grunt-mocha-test": "^0.13.3",
"mocha": "^6.1.4",
"mocha-junit-reporter": "^1.22.0",
"async": "^3.1.0",
"chai": "^4.2.0",
"eslint": "^6.3.0",
"mocha": "^6.2.0",
"mocha-junit-reporter": "^1.23.1",
"nyc": "^14.1.1",
"uuid": "^3.3.2"
"uuid": "^3.3.3"
},
"keywords": [
"cql",
Expand Down
3 changes: 1 addition & 2 deletions query/queryCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function _getSelect() {
if (_.has(this._grouped, "aggregate")) {
_.each(this._grouped.aggregate, function (aggregate) {
// TODO add.. more.. aggregates
var key, val;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint is unhappy about redefining previously defined key, val variables, hence I extracted definition to a common scope.

switch (aggregate.type) {
case "dateOf":
case "unixTimestampOf":
Expand All @@ -111,7 +112,6 @@ function _getSelect() {
case "toUnixTimestamp":
case "writetime":
case "ttl":
var key, val;
if (_.isObject(aggregate.val)) {
key = Object.keys(aggregate.val)[0];
val = aggregate.val[key];
Expand All @@ -124,7 +124,6 @@ function _getSelect() {
(val ? " AS " + formatter.wrapQuotes(val) : "");
break;
case "count":
var key, val;
if (_.isObject(aggregate.val)) {
key = Object.keys(aggregate.val)[0];
val = aggregate.val[key];
Expand Down
9 changes: 5 additions & 4 deletions tests/live/live.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* usage: grunt test-live
* usage: yarn run test:live
*
* This script will perform several executions against a given cassandra cluster.
*
Expand Down Expand Up @@ -202,9 +202,10 @@ describe("yolo", function () {

var onReadable = function () {
// Readable is emitted as soon a row is received and parsed
var row;
while (row = this.read()) {
var row = this.read();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint is unhappy about assignment within condition.

while (row) {
assert(_.has(row, "id"), "Response must contain the id.");
row = this.read()
}
}
, onEnd = function () {
Expand Down Expand Up @@ -278,7 +279,7 @@ describe("yolo", function () {
.select()
.count({ "*": "theCount" })
.from(columnFamily)
.exec(function(err, resp) {
.exec(function (err, resp) {
assert(!err, err);
assert.equal(rows, resp.first().theCount);
next(err);
Expand Down
Loading