eslint-plugin-slonik 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
2
  import { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
3
- import { C as Config } from './shared/eslint-plugin-slonik.1m1xlVmw.cjs';
3
+ import { C as Config } from './shared/eslint-plugin-slonik.uSZXmGoY.cjs';
4
4
  import 'zod';
5
5
 
6
6
  declare const _default$1: {
@@ -24,6 +24,7 @@ declare const _default$1: {
24
24
  })[];
25
25
  migrationsDir: string;
26
26
  keepAlive?: boolean | undefined;
27
+ connectionTimeout?: number | undefined;
27
28
  overrides?: {
28
29
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
29
30
  parameter: string | {
@@ -63,6 +64,7 @@ declare const _default$1: {
63
64
  })[];
64
65
  databaseUrl: string;
65
66
  keepAlive?: boolean | undefined;
67
+ connectionTimeout?: number | undefined;
66
68
  overrides?: {
67
69
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
68
70
  parameter: string | {
@@ -99,6 +101,7 @@ declare const _default$1: {
99
101
  })[];
100
102
  migrationsDir: string;
101
103
  keepAlive?: boolean | undefined;
104
+ connectionTimeout?: number | undefined;
102
105
  overrides?: {
103
106
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
104
107
  parameter: string | {
@@ -138,6 +141,7 @@ declare const _default$1: {
138
141
  })[];
139
142
  databaseUrl: string;
140
143
  keepAlive?: boolean | undefined;
144
+ connectionTimeout?: number | undefined;
141
145
  overrides?: {
142
146
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
143
147
  parameter: string | {
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
2
  import { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
3
- import { C as Config } from './shared/eslint-plugin-slonik.1m1xlVmw.mjs';
3
+ import { C as Config } from './shared/eslint-plugin-slonik.uSZXmGoY.mjs';
4
4
  import 'zod';
5
5
 
6
6
  declare const _default$1: {
@@ -24,6 +24,7 @@ declare const _default$1: {
24
24
  })[];
25
25
  migrationsDir: string;
26
26
  keepAlive?: boolean | undefined;
27
+ connectionTimeout?: number | undefined;
27
28
  overrides?: {
28
29
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
29
30
  parameter: string | {
@@ -63,6 +64,7 @@ declare const _default$1: {
63
64
  })[];
64
65
  databaseUrl: string;
65
66
  keepAlive?: boolean | undefined;
67
+ connectionTimeout?: number | undefined;
66
68
  overrides?: {
67
69
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
68
70
  parameter: string | {
@@ -99,6 +101,7 @@ declare const _default$1: {
99
101
  })[];
100
102
  migrationsDir: string;
101
103
  keepAlive?: boolean | undefined;
104
+ connectionTimeout?: number | undefined;
102
105
  overrides?: {
103
106
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
104
107
  parameter: string | {
@@ -138,6 +141,7 @@ declare const _default$1: {
138
141
  })[];
139
142
  databaseUrl: string;
140
143
  keepAlive?: boolean | undefined;
144
+ connectionTimeout?: number | undefined;
141
145
  overrides?: {
142
146
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
143
147
  parameter: string | {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
2
  import { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
3
- import { C as Config } from './shared/eslint-plugin-slonik.1m1xlVmw.js';
3
+ import { C as Config } from './shared/eslint-plugin-slonik.uSZXmGoY.js';
4
4
  import 'zod';
5
5
 
6
6
  declare const _default$1: {
@@ -24,6 +24,7 @@ declare const _default$1: {
24
24
  })[];
25
25
  migrationsDir: string;
26
26
  keepAlive?: boolean | undefined;
27
+ connectionTimeout?: number | undefined;
27
28
  overrides?: {
28
29
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
29
30
  parameter: string | {
@@ -63,6 +64,7 @@ declare const _default$1: {
63
64
  })[];
64
65
  databaseUrl: string;
65
66
  keepAlive?: boolean | undefined;
67
+ connectionTimeout?: number | undefined;
66
68
  overrides?: {
67
69
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
68
70
  parameter: string | {
@@ -99,6 +101,7 @@ declare const _default$1: {
99
101
  })[];
100
102
  migrationsDir: string;
101
103
  keepAlive?: boolean | undefined;
104
+ connectionTimeout?: number | undefined;
102
105
  overrides?: {
103
106
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
104
107
  parameter: string | {
@@ -138,6 +141,7 @@ declare const _default$1: {
138
141
  })[];
139
142
  databaseUrl: string;
140
143
  keepAlive?: boolean | undefined;
144
+ connectionTimeout?: number | undefined;
141
145
  overrides?: {
142
146
  types?: Record<"bigint" | "boolean" | "int" | "null" | "void" | "date" | "int2" | "int4" | "int8" | "smallint" | "real" | "float4" | "float" | "float8" | "numeric" | "decimal" | "smallserial" | "serial" | "bigserial" | "uuid" | "text" | "varchar" | "char" | "bpchar" | "citext" | "bit" | "bool" | "timestamp" | "timestamptz" | "time" | "timetz" | "interval" | "inet" | "cidr" | "macaddr" | "macaddr8" | "money" | "json" | "jsonb" | "bytea", string | {
143
147
  parameter: string | {
package/dist/index.mjs CHANGED
@@ -1095,6 +1095,11 @@ const zBaseSchema = z.object({
1095
1095
  * Whether or not keep the connection alive. Change it only if you know what you're doing.
1096
1096
  */
1097
1097
  keepAlive: z.boolean().optional(),
1098
+ /**
1099
+ * Connection timeout in milliseconds. If the connection is not established within this time,
1100
+ * an error will be thrown. Defaults to 5000 (5 seconds).
1101
+ */
1102
+ connectionTimeout: z.number().optional(),
1098
1103
  /**
1099
1104
  * Override defaults
1100
1105
  */
@@ -1257,14 +1262,23 @@ function reportCheck(params) {
1257
1262
  { _tag: "InvalidMigrationError" },
1258
1263
  { _tag: "InvalidMigrationsPathError" },
1259
1264
  { _tag: "DatabaseInitializationError" },
1260
- { _tag: "InternalError" },
1261
1265
  (error2) => {
1262
1266
  if (params.connection.keepAlive === true) {
1263
1267
  fatalError = error2;
1264
1268
  }
1265
1269
  return reportBaseError({ context, error: error2, tag });
1266
1270
  }
1267
- ).exhaustive();
1271
+ ).with({ _tag: "InternalError" }, (error2) => {
1272
+ const isConfigError = error2.message.includes("Invalid override column key");
1273
+ if (isConfigError) {
1274
+ return reportBaseError({ context, error: error2, tag });
1275
+ }
1276
+ console.warn(
1277
+ `[eslint-plugin-slonik] Skipping query due to unsupported SQL syntax: ${error2.message}
1278
+ If you believe this query should be supported, please open an issue at https://github.com/gajus/eslint-plugin-slonik/issues`
1279
+ );
1280
+ return;
1281
+ }).exhaustive();
1268
1282
  },
1269
1283
  ({ result, checker, parser }) => {
1270
1284
  if (result === null) {