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 }