From 586ac419e46676522f73e96277b44a79eb9d2e89 Mon Sep 17 00:00:00 2001 From: Kijin-Seija Date: Tue, 9 Apr 2024 16:10:52 +0800 Subject: [PATCH] =?UTF-8?q?0.0.1-alpha.3=20-=20=E4=BF=AE=E6=94=B9=3F=3F?= =?UTF-8?q?=E8=BF=90=E7=AE=97=E7=AC=A6=E4=B8=BA||=20=E5=B9=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=B0eslint=E5=BF=BD=E7=95=A5=E8=A7=84=E5=88=99?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.yml | 1 + src/index.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 31c4aa1..e0b88f4 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -16,3 +16,4 @@ rules: '@typescript-eslint/space-before-function-paren': off '@typescript-eslint/explicit-function-return-type': off '@typescript-eslint/no-unsafe-argument': off + '@typescript-eslint/prefer-nullish-coalescing': off diff --git a/src/index.ts b/src/index.ts index 41f7b6e..e2d7e61 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,18 +10,18 @@ export class DtSqlParserSemAnalysePlugin { private readonly settings: PluginSettings = {} constructor (settings?: PluginSettings) { - this.settings = settings ?? {} + this.settings = settings || {} } public parse (sql: string, caret?: InsertCaretPlaceholderConfig) { const sqlAfterInsertCaret = insertCaret(sql, caret) - const sqlAfterPreprocess = preprocess(sqlAfterInsertCaret, this.settings.preprocessor ?? defaultPreprocessorList) + const sqlAfterPreprocess = preprocess(sqlAfterInsertCaret, this.settings.preprocessor || defaultPreprocessorList) const sqlParseResult = parse( sqlAfterPreprocess, - this.settings.parse?.parser ?? new PostgresSQL(), - this.settings.parse?.stmts ?? defaultStmts, - this.settings.parse?.entities ?? defaultEntities, - this.settings.parse?.rules ?? defaultRules + this.settings.parse?.parser || new PostgresSQL(), + this.settings.parse?.stmts || defaultStmts, + this.settings.parse?.entities || defaultEntities, + this.settings.parse?.rules || defaultRules ) return sqlParseResult }