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

Improve linting #5460

Merged
merged 7 commits into from
Jul 12, 2023
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
*.stub
#
lib/migrations/util/import-file.js
Expand Down
4 changes: 0 additions & 4 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ If issue is about TypeScript definitions, tag @ lorefnon.
database connection to MySQL or PostgreSQL, then single file example which initializes
needed data and demonstrates the problem.


# Feature discussion / request

1. Explain what is your use case
Expand All @@ -28,14 +27,11 @@ If issue is about TypeScript definitions, tag @ lorefnon.

3. Give some API proposal, how the feature should work


# Missing / erroneus documentation

Send issue to documentation repo, or fix it and send PR https://github.com/knex/documentation


# Questions about how to use knex

GitHub issues are for knex development. Please send questions how to use knex to
Stack Overflow or ask about it in gitter chat.

4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
directory: '/'
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: npm
directory: "/"
directory: '/'
schedule:
interval: daily
open-pull-requests-limit: 10
30 changes: 15 additions & 15 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
schedule:
- cron: '36 2 * * 0'

Expand All @@ -14,25 +14,25 @@ permissions:
jobs:
analyze:
permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/analyze to upload SARIF results
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/analyze to upload SARIF results
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
9 changes: 4 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
---

name: Coverage

on: ["push", "pull_request"]
on: ['push', 'pull_request']

permissions:
contents: read

jobs:
build:
permissions:
checks: write # for coverallsapp/github-action to create new checks
contents: read # for actions/checkout to fetch code
checks: write # for coverallsapp/github-action to create new checks
contents: read # for actions/checkout to fetch code
runs-on: ubuntu-latest

name: Coverage
Expand Down Expand Up @@ -48,7 +47,7 @@ jobs:
run: npm run test:coverage || true
env:
CI: true
DB: "postgres pgnative mysql mysql2 mssql sqlite3 cockroachdb"
DB: 'postgres pgnative mysql mysql2 mssql sqlite3 cockroachdb'
KNEX_TEST_TIMEOUT: 60000

- name: Stop Databases
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

name: CI

on:
Expand All @@ -22,7 +21,17 @@ jobs:
fail-fast: false
matrix:
node-version: [18.x, 16.x, 14.x, 12.x]
database-type: [postgres, pgnative, mysql, mssql, sqlite3, cockroachdb, better-sqlite3, oracledb]
database-type:
[
postgres,
pgnative,
mysql,
mssql,
sqlite3,
cockroachdb,
better-sqlite3,
oracledb,
]

steps:
- name: Checkout Repository
Expand Down Expand Up @@ -112,7 +121,7 @@ jobs:
with:
always-auth: false
node-version: ${{ matrix.node-version }}

- name: Test npm git dependency
shell: bash
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

name: Linting and Types

on:
Expand Down Expand Up @@ -37,7 +36,8 @@ jobs:
- name: Run npm install
run: npm install

- name: Run format:check
run: npm run format:check

- name: Run lint:everything
run: npm run lint:everything
env:
CI: true
1 change: 0 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

name: Unit Tests

on:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test.sqlite3
npm-debug.log
tmp
knex-*.tgz
.eslintcache

# Testing for the knex cli:
bin/migrations-folder
Expand Down
5 changes: 2 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "always",
"endOfLine": "lf"
"singleQuote": true,
"trailingComma": "es5"
}
38 changes: 19 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- Add knex.mjs to files in package.json (#5518)
- Handle numeric array elements in .orderBy() (#5551)
- Attach error handler early enough (#5552)
- Fix Returning * in Oracle (#5598)
- Fix Returning \* in Oracle (#5598)
- Fix indexType option in `Postgres` (#5601)
- Add mjs extension type (#5616)
- Use implicit check on json fields for OracleDB (#5478)
Expand Down Expand Up @@ -501,13 +501,13 @@ Note: there are many breaking changes in this version, particularly in TypeScrip
- Change default to not trigger a promise rejection for transactions with a specified handler #4195
- Make toSQL().toNative() work for Raw to match the API for QueryBuilder #4058
- Allow 'match' operator #3569
- Support optimizer hints #4243
- Support optimizer hints #4243
- Add parameter to prevent autoincrement columns from being primary keys #4266
- Make "first" and "pluck" mutually exclusive #4280
- Make "first" and "pluck" mutually exclusive #4280
- Added merge strategy to allow selecting columns to upsert. #4252
- Throw error if the array passed to insert is empty #4289
- Events: introduce queryContext on query-error #4301
- CLI: Use UTC timestamp for new migrations #4245
- CLI: Use UTC timestamp for new migrations #4245
- MSSQL: Replace MSSQL dialect with Tedious.js implementation #2857 #4281
- MSSQL: Use "nvarchar(max)" for ".json()" #4278
- MSSQL: Schema builder - add predictable constraint names for default values #4319
Expand Down Expand Up @@ -549,9 +549,9 @@ Note: there are many breaking changes in this version, particularly in TypeScrip
- Various internal refactorings #4175 #4177 #4178 #4192
- Refactor to classes #4190 #4191 #4193 #4210 #4253
- Move transaction type tests to TSD #4208
- Clean up destroy logic #4248
- Colorize code snippets in readme files #4234
- Add "Ecosystem" documentation for Knex plugins #4183
- Clean up destroy logic #4248
- Colorize code snippets in readme files #4234
- Add "Ecosystem" documentation for Knex plugins #4183
- Documentation cleanup
- SQLite: Use SQLite "rename column" instead of a DDL helper #4200
- SQLite: Simplify reinsert logic when altering a table #4272
Expand Down Expand Up @@ -606,7 +606,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip

### Bug fixes:

- Make sure query-response and query-error events contain _knexTxId #4160
- Make sure query-response and query-error events contain \_knexTxId #4160

### Test / internal changes:

Expand Down Expand Up @@ -862,7 +862,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip

### Bug fixes:

- Correctly handle dateToString escaping without timezone passed #3742
- Correctly handle dateToString escaping without timezone passed #3742
- Make protocol length check more defensive #3744

### Typings:
Expand All @@ -873,7 +873,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip

### Bug fixes:

- Added missing call to _reject in Transactor#transaction #3706
- Added missing call to \_reject in Transactor#transaction #3706
- Fix method binding on knex proxy #3717
- Oracle: Transaction_OracleDB can use config.connection #3731

Expand All @@ -884,7 +884,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip
### Test / internal changes:

- Cleanup/remove transaction stalling #3716
- Rewrote Transaction#acquireConnection() methods to use async #3707
- Rewrote Transaction#acquireConnection() methods to use async #3707

# 0.20.11 - 26 February, 2020

Expand Down Expand Up @@ -920,7 +920,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip
### Typings:

- `fn.now` takes optionally a precision argument. #3662
- PG: Include SSL in connection definition #3659
- PG: Include SSL in connection definition #3659

### Test / internal changes:

Expand All @@ -934,7 +934,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip

### Typings:

- MSSQL: Add `enableArithAbort` to `MsSqlConnectionConfig`
- MSSQL: Add `enableArithAbort` to `MsSqlConnectionConfig`

### Test / internal changes:

Expand All @@ -953,7 +953,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip

### Typings:

- Fix incorrect type of QueryBuilder.first('*') result #3621
- Fix incorrect type of QueryBuilder.first('\*') result #3621

# 0.20.7 - 07 January, 2020

Expand Down Expand Up @@ -1108,7 +1108,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip
### Typings:

- Add missing Migrator.list typing #3460
- Fix Typescript type inference for to better support wildcard (*) calls #3444
- Fix Typescript type inference for to better support wildcard (\*) calls #3444
- Make options argument optional in timeout #3442

### Test / internal changes:
Expand Down Expand Up @@ -1145,7 +1145,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip

### Changes:

- migrate: Refactor _lockMigrations to avoid forUpdate - makes migrations compatible with CockroachDB #3395
- migrate: Refactor \_lockMigrations to avoid forUpdate - makes migrations compatible with CockroachDB #3395

# 0.19.2 - 17 August, 2019

Expand All @@ -1156,7 +1156,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip

### New features:

- Fallback to JSON when using JSONB in MySQL #3394
- Fallback to JSON when using JSONB in MySQL #3394

# 0.19.1 - 23 July, 2019

Expand All @@ -1175,7 +1175,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip

### Changes:

- Pooling: tarn.js connection pool was updated to version 2.0.0. This fixes issue with destroying connections and introduces support for connection pool event handlers. Please see tarn.js documentation for more details #3345
- Pooling: tarn.js connection pool was updated to version 2.0.0. This fixes issue with destroying connections and introduces support for connection pool event handlers. Please see tarn.js documentation for more details #3345
- Pooling: Passing unsupported pooling configuration options now throws an error
- Pooling: `beforeDestroy` configuration option was removed

Expand Down Expand Up @@ -1366,7 +1366,7 @@ Note: there are many breaking changes in this version, particularly in TypeScrip
- Typings: Add 'string' as accepted Knex constructor type definition #3105
- Typings: Add boolean as a column name in join #3121
- Typings: Add missing clearOrder & clearCounters types #3109
- Dependencies: Fix security warning #3082
- Dependencies: Fix security warning #3082
- Do not use unsupported column width/length arguments on data types int and tinyint in MSSQL #2738

### Changes:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## How to contribute to Knex.js

- Make changes in the `/lib` directory.
- Make changes in the `/lib` directory.

- Before sending a pull request for a feature or bug fix, be sure to have
[tests](https://github.com/knex/knex/tree/master/test). Every pull request that changes the queries should have
Expand Down
5 changes: 4 additions & 1 deletion ECOSYSTEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
Plugins and tools maintained by the knex team are listed under [Core](#core) while plugins and tools maintained by the community are listed in the [Community](#community) section.

#### [Dialects](#dialects)

- [`knex-firebird-dialect`](https://github.com/Tomas2D/knex-firebird-dialect) Dialect for a Firebird database.

#### [Core](#core)

- [`casbin-knex-adapter`](https://github.com/knex/casbin-knex-adapter) Knex adapter for [Node-Casbin](https://github.com/casbin/node-casbin).
- [`knex-schema-inspector`](https://github.com/knex/knex-schema-inspector) Utility for extracting information about the existing DB schema.
- [`knex-tablecleaner`](https://github.com/kibertoad/knex-tablecleaner) Library for deleting all rows from a given list of DB tables.

#### [Community](#community)
- [`knemm`](https://github.com/asteinarson/knemm) A CLI tool to manage SQL schema in declarative YAML files (`claims` and `states`). It allows for database dependencies between loosely coupled modules.

- [`knemm`](https://github.com/asteinarson/knemm) A CLI tool to manage SQL schema in declarative YAML files (`claims` and `states`). It allows for database dependencies between loosely coupled modules.
- [`knex-mock-client`](https://github.com/felixmosh/knex-mock-client) A mock client which helps you write integration tests which includes DB interactions.
- [`knex-paginate`](https://github.com/felixmosh/knex-paginate) Extension of the query builder with `paginate` method that helps with pagination tasks.
- [`knex-postgis`](https://github.com/jfgodoy/knex-postgis) Extension of Knex with [PostGIS](https://postgis.net/) (geographic objects in PostgreSQL) support.
Expand Down
Loading