Skip to content

Commit 4feefdf

Browse files
committed
Enforce Unix (lf) line terminators (knex#3598)
1 parent a2a6660 commit 4feefdf

File tree

9 files changed

+63
-50
lines changed

9 files changed

+63
-50
lines changed

.prettierrc

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"singleQuote": true,
33
"trailingComma": "es5",
4-
"arrowParens": "always"
5-
}
4+
"arrowParens": "always",
5+
"endOfLine": "lf"
6+
}

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Master (Unreleased)
22

3+
# 0.20.6 - 29 December, 2019
4+
5+
### Bug fixes:
6+
7+
- Enforce Unix (lf) line terminators #3598
8+
39
# 0.20.5 - 29 December, 2019
410

511
### New features:

lib/client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const debug = require('debug')('knex:client');
3030
const _debugQuery = require('debug')('knex:query');
3131
const debugBindings = require('debug')('knex:bindings');
3232

33-
const debugQuery = (sql, txId) => _debugQuery(sql.replace(/%/g, '%%'), txId)
33+
const debugQuery = (sql, txId) => _debugQuery(sql.replace(/%/g, '%%'), txId);
3434

3535
const { POOL_CONFIG_OPTIONS } = require('./constants');
3636

lib/dialects/postgres/query/compiler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Object.assign(QueryCompiler_PG.prototype, {
160160

161161
distinctOn(value) {
162162
return 'distinct on (' + this.formatter.columnize(value) + ') ';
163-
}
163+
},
164164
});
165165

166166
module.exports = QueryCompiler_PG;

lib/query/builder.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ assign(Builder.prototype, {
201201
this._statements.push({
202202
grouping: 'columns',
203203
value,
204-
distinctOn: true
204+
distinctOn: true,
205205
});
206206
return this;
207207
},

lib/schema/tablebuilder.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,14 @@ each(specialMethods, function(methods, dialect) {
7777
each(methods, function(method) {
7878
TableBuilder.prototype[method] = function(value) {
7979
if (this.client.dialect !== dialect) {
80-
throw new Error(`Knex only supports ${method} statement with ${dialect}.`);
80+
throw new Error(
81+
`Knex only supports ${method} statement with ${dialect}.`
82+
);
8183
}
8284
if (this._method === 'alter') {
8385
throw new Error(
8486
`Knex does not support altering the ${method} outside of create ` +
85-
`table, please use knex.raw statement.`
87+
`table, please use knex.raw statement.`
8688
);
8789
}
8890
this._single[method] = value;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "knex",
3-
"version": "0.20.5",
3+
"version": "0.20.6",
44
"description": "A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser",
55
"main": "knex.js",
66
"types": "types/index.d.ts",

test/integration/builder/selects.js

+37-36
Original file line numberDiff line numberDiff line change
@@ -794,43 +794,44 @@ module.exports = function(knex) {
794794
} catch (e) {
795795
error = e;
796796
}
797-
expect(error.message).to.eql('.distinctOn() is currently only supported on PostgreSQL');
797+
expect(error.message).to.eql(
798+
'.distinctOn() is currently only supported on PostgreSQL'
799+
);
798800
return;
799-
}
800-
return builder
801-
.testSql(function(tester) {
802-
tester(
803-
'pg',
804-
'select distinct on ("id") "email", "logins" from "accounts" order by "id" asc',
805-
[],
806-
[
807-
{
808-
809-
logins: 1,
810-
},
811-
{
812-
813-
logins: 1,
814-
},
815-
{
816-
817-
logins: 2,
818-
},
819-
{
820-
821-
logins: 2,
822-
},
823-
{
824-
825-
logins: 2,
826-
},
827-
{
828-
829-
logins: 2,
830-
},
831-
]
832-
);
833-
});
801+
}
802+
return builder.testSql(function(tester) {
803+
tester(
804+
'pg',
805+
'select distinct on ("id") "email", "logins" from "accounts" order by "id" asc',
806+
[],
807+
[
808+
{
809+
810+
logins: 1,
811+
},
812+
{
813+
814+
logins: 1,
815+
},
816+
{
817+
818+
logins: 2,
819+
},
820+
{
821+
822+
logins: 2,
823+
},
824+
{
825+
826+
logins: 2,
827+
},
828+
{
829+
830+
logins: 2,
831+
},
832+
]
833+
);
834+
});
834835
});
835836

836837
it('does "orWhere" cases', function() {

test/unit/schema/mssql.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ describe('MSSQL SchemaBuilder', function() {
1111

1212
it('throws when charset and collate are specified', function() {
1313
expect(() => {
14-
tableSql = client.schemaBuilder().createTable('users', function(table) {
15-
table.increments('id');
16-
table.string('email');
17-
table.charset('utf8');
18-
table.collate('utf8_unicode_ci');
19-
}).toSQL();
14+
tableSql = client
15+
.schemaBuilder()
16+
.createTable('users', function(table) {
17+
table.increments('id');
18+
table.string('email');
19+
table.charset('utf8');
20+
table.collate('utf8_unicode_ci');
21+
})
22+
.toSQL();
2023
}).to.throw('Knex only supports charset statement with mysql');
2124
});
2225

0 commit comments

Comments
 (0)