mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
chore: disable eslint errors for chai assertions (#11833)
This commit is contained in:
parent
cc07c90f1d
commit
2133c97437
@ -1,20 +1,18 @@
|
||||
import js from "@eslint/js"
|
||||
import { defineConfig } from "eslint/config"
|
||||
import pluginChaiFriendly from "eslint-plugin-chai-friendly"
|
||||
import { jsdoc } from "eslint-plugin-jsdoc"
|
||||
import { defineConfig, globalIgnores } from "eslint/config"
|
||||
import globals from "globals"
|
||||
import ts from "typescript-eslint"
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
ignores: [
|
||||
"build/**",
|
||||
"docs/**",
|
||||
"node_modules/**",
|
||||
"sample/playground/**",
|
||||
"temp/**",
|
||||
],
|
||||
},
|
||||
|
||||
globalIgnores([
|
||||
"build/**",
|
||||
"docs/**",
|
||||
"node_modules/**",
|
||||
"sample/playground/**",
|
||||
"temp/**",
|
||||
]),
|
||||
{
|
||||
files: ["**/*.ts"],
|
||||
languageOptions: {
|
||||
@ -31,10 +29,7 @@ export default defineConfig([
|
||||
js,
|
||||
ts,
|
||||
},
|
||||
extends: [
|
||||
js.configs.recommended,
|
||||
...ts.configs.recommendedTypeChecked,
|
||||
],
|
||||
extends: [js.configs.recommended, ...ts.configs.recommendedTypeChecked],
|
||||
rules: {
|
||||
// exceptions from typescript-eslint/recommended
|
||||
"@typescript-eslint/ban-ts-comment": "warn",
|
||||
@ -45,12 +40,11 @@ export default defineConfig([
|
||||
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
|
||||
"@typescript-eslint/no-unsafe-declaration-merging": "warn",
|
||||
"@typescript-eslint/no-unsafe-function-type": "warn",
|
||||
"@typescript-eslint/no-unused-expressions": "warn",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
destructuredArrayIgnorePattern: "^_"
|
||||
destructuredArrayIgnorePattern: "^_",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-wrapper-object-types": "off",
|
||||
@ -90,14 +84,17 @@ export default defineConfig([
|
||||
"no-regex-spaces": "warn",
|
||||
},
|
||||
},
|
||||
|
||||
jsdoc({
|
||||
config: "flat/recommended-typescript",
|
||||
files: ["src/**/*.ts"],
|
||||
config: "flat/recommended-typescript",
|
||||
// Temporarily enable individual rules when they are fixed, until all current warnings are gone,
|
||||
// and then remove manual config in favor of `config: "flat/recommended-typescript-error"`
|
||||
rules: {
|
||||
"jsdoc/valid-types": "error"
|
||||
}
|
||||
"jsdoc/valid-types": "error",
|
||||
},
|
||||
}),
|
||||
{
|
||||
files: ["test/**/*.ts"],
|
||||
...pluginChaiFriendly.configs.recommendedFlat,
|
||||
},
|
||||
])
|
||||
|
||||
14
package-lock.json
generated
14
package-lock.json
generated
@ -53,6 +53,7 @@
|
||||
"chai-as-promised": "^7.1.2",
|
||||
"class-transformer": "^0.5.1",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-plugin-chai-friendly": "^1.1.0",
|
||||
"eslint-plugin-jsdoc": "^61.4.1",
|
||||
"globals": "^16.5.0",
|
||||
"gulp": "^4.0.2",
|
||||
@ -5936,6 +5937,19 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-chai-friendly": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-1.1.0.tgz",
|
||||
"integrity": "sha512-+T1rClpDdXkgBAhC16vRQMI5umiWojVqkj9oUTdpma50+uByCZM/oBfxitZiOkjMRlm725mwFfz/RVgyDRvCKA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": ">=3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-jsdoc": {
|
||||
"version": "61.4.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-61.4.1.tgz",
|
||||
|
||||
@ -134,6 +134,7 @@
|
||||
"chai-as-promised": "^7.1.2",
|
||||
"class-transformer": "^0.5.1",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-plugin-chai-friendly": "^1.1.0",
|
||||
"eslint-plugin-jsdoc": "^61.4.1",
|
||||
"globals": "^16.5.0",
|
||||
"gulp": "^4.0.2",
|
||||
|
||||
@ -806,14 +806,20 @@ export class AuroraMysqlDriver implements Driver {
|
||||
this.poolCluster.getConnection(
|
||||
"MASTER",
|
||||
(err: any, dbConnection: any) => {
|
||||
err
|
||||
? fail(err)
|
||||
: ok(this.prepareDbConnection(dbConnection))
|
||||
if (err) {
|
||||
fail(err)
|
||||
} else {
|
||||
ok(this.prepareDbConnection(dbConnection))
|
||||
}
|
||||
},
|
||||
)
|
||||
} else if (this.pool) {
|
||||
this.pool.getConnection((err: any, dbConnection: any) => {
|
||||
err ? fail(err) : ok(this.prepareDbConnection(dbConnection))
|
||||
if (err) {
|
||||
fail(err)
|
||||
} else {
|
||||
ok(this.prepareDbConnection(dbConnection))
|
||||
}
|
||||
})
|
||||
} else {
|
||||
fail(
|
||||
@ -837,7 +843,11 @@ export class AuroraMysqlDriver implements Driver {
|
||||
this.poolCluster.getConnection(
|
||||
"SLAVE*",
|
||||
(err: any, dbConnection: any) => {
|
||||
err ? fail(err) : ok(this.prepareDbConnection(dbConnection))
|
||||
if (err) {
|
||||
fail(err)
|
||||
} else {
|
||||
ok(this.prepareDbConnection(dbConnection))
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
@ -826,7 +826,11 @@ export class CockroachDriver implements Driver {
|
||||
|
||||
return new Promise((ok, fail) => {
|
||||
this.master.connect((err: any, connection: any, release: any) => {
|
||||
err ? fail(err) : ok([connection, release])
|
||||
if (err) {
|
||||
fail(err)
|
||||
} else {
|
||||
ok([connection, release])
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -844,7 +848,11 @@ export class CockroachDriver implements Driver {
|
||||
return new Promise((ok, fail) => {
|
||||
this.slaves[random].connect(
|
||||
(err: any, connection: any, release: any) => {
|
||||
err ? fail(err) : ok([connection, release])
|
||||
if (err) {
|
||||
fail(err)
|
||||
} else {
|
||||
ok([connection, release])
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
@ -920,14 +920,20 @@ export class MysqlDriver implements Driver {
|
||||
this.poolCluster.getConnection(
|
||||
"MASTER",
|
||||
(err: any, dbConnection: any) => {
|
||||
err
|
||||
? fail(err)
|
||||
: ok(this.prepareDbConnection(dbConnection))
|
||||
if (err) {
|
||||
fail(err)
|
||||
} else {
|
||||
ok(this.prepareDbConnection(dbConnection))
|
||||
}
|
||||
},
|
||||
)
|
||||
} else if (this.pool) {
|
||||
this.pool.getConnection((err: any, dbConnection: any) => {
|
||||
err ? fail(err) : ok(this.prepareDbConnection(dbConnection))
|
||||
if (err) {
|
||||
fail(err)
|
||||
} else {
|
||||
ok(this.prepareDbConnection(dbConnection))
|
||||
}
|
||||
})
|
||||
} else {
|
||||
fail(
|
||||
@ -951,7 +957,11 @@ export class MysqlDriver implements Driver {
|
||||
this.poolCluster.getConnection(
|
||||
"SLAVE*",
|
||||
(err: any, dbConnection: any) => {
|
||||
err ? fail(err) : ok(this.prepareDbConnection(dbConnection))
|
||||
if (err) {
|
||||
fail(err)
|
||||
} else {
|
||||
ok(this.prepareDbConnection(dbConnection))
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
@ -988,14 +988,16 @@ export class OracleDriver implements Driver {
|
||||
try {
|
||||
const oracle = this.options.driver || PlatformTools.load("oracledb")
|
||||
this.oracle = oracle
|
||||
} catch (e) {
|
||||
} catch {
|
||||
throw new DriverPackageNotInstalledError("Oracle", "oracledb")
|
||||
}
|
||||
const thickMode = this.options.thickMode
|
||||
if (thickMode) {
|
||||
typeof thickMode === "object"
|
||||
? this.oracle.initOracleClient(thickMode)
|
||||
: this.oracle.initOracleClient()
|
||||
if (typeof thickMode === "object") {
|
||||
this.oracle.initOracleClient(thickMode)
|
||||
} else {
|
||||
this.oracle.initOracleClient()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1218,7 +1218,11 @@ export class PostgresDriver implements Driver {
|
||||
|
||||
return new Promise((ok, fail) => {
|
||||
this.master.connect((err: any, connection: any, release: any) => {
|
||||
err ? fail(err) : ok([connection, release])
|
||||
if (err) {
|
||||
fail(err)
|
||||
} else {
|
||||
ok([connection, release])
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -1238,7 +1242,11 @@ export class PostgresDriver implements Driver {
|
||||
return new Promise((ok, fail) => {
|
||||
this.slaves[random].connect(
|
||||
(err: any, connection: any, release: any) => {
|
||||
err ? fail(err) : ok([connection, release])
|
||||
if (err) {
|
||||
fail(err)
|
||||
} else {
|
||||
ok([connection, release])
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
@ -1569,14 +1577,17 @@ export class PostgresDriver implements Driver {
|
||||
|
||||
if (options.logNotifications) {
|
||||
connection.on("notice", (msg: any) => {
|
||||
msg && this.connection.logger.log("info", msg.message)
|
||||
if (msg) {
|
||||
this.connection.logger.log("info", msg.message)
|
||||
}
|
||||
})
|
||||
connection.on("notification", (msg: any) => {
|
||||
msg &&
|
||||
if (msg) {
|
||||
this.connection.logger.log(
|
||||
"info",
|
||||
`Received NOTIFY on channel ${msg.channel}: ${msg.payload}.`,
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
release()
|
||||
|
||||
@ -138,13 +138,14 @@ describe("query builder > distinct on", () => {
|
||||
|
||||
expect(
|
||||
result.map(({ moderator }) => moderator),
|
||||
).to.have.members(["Dion", "Sarah", "Dion", "Dion"]) &&
|
||||
expect(result.map(({ author }) => author)).to.have.members([
|
||||
"Dion",
|
||||
"Pablo",
|
||||
"Sarah",
|
||||
"Zelda",
|
||||
])
|
||||
).to.have.members(["Dion", "Sarah", "Dion", "Dion"])
|
||||
|
||||
expect(result.map(({ author }) => author)).to.have.members([
|
||||
"Dion",
|
||||
"Pablo",
|
||||
"Sarah",
|
||||
"Zelda",
|
||||
])
|
||||
}),
|
||||
))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user