0.0.1-alpha.3

- 修改??运算符为|| 并添加到eslint忽略规则中
This commit is contained in:
Kijin-Seija 2024-04-09 16:10:52 +08:00
parent 4b08e6e892
commit 586ac419e4
2 changed files with 7 additions and 6 deletions

View File

@ -16,3 +16,4 @@ rules:
'@typescript-eslint/space-before-function-paren': off '@typescript-eslint/space-before-function-paren': off
'@typescript-eslint/explicit-function-return-type': off '@typescript-eslint/explicit-function-return-type': off
'@typescript-eslint/no-unsafe-argument': off '@typescript-eslint/no-unsafe-argument': off
'@typescript-eslint/prefer-nullish-coalescing': off

View File

@ -10,18 +10,18 @@ export class DtSqlParserSemAnalysePlugin {
private readonly settings: PluginSettings = {} private readonly settings: PluginSettings = {}
constructor (settings?: PluginSettings) { constructor (settings?: PluginSettings) {
this.settings = settings ?? {} this.settings = settings || {}
} }
public parse (sql: string, caret?: InsertCaretPlaceholderConfig) { public parse (sql: string, caret?: InsertCaretPlaceholderConfig) {
const sqlAfterInsertCaret = insertCaret(sql, caret) const sqlAfterInsertCaret = insertCaret(sql, caret)
const sqlAfterPreprocess = preprocess(sqlAfterInsertCaret, this.settings.preprocessor ?? defaultPreprocessorList) const sqlAfterPreprocess = preprocess(sqlAfterInsertCaret, this.settings.preprocessor || defaultPreprocessorList)
const sqlParseResult = parse( const sqlParseResult = parse(
sqlAfterPreprocess, sqlAfterPreprocess,
this.settings.parse?.parser ?? new PostgresSQL(), this.settings.parse?.parser || new PostgresSQL(),
this.settings.parse?.stmts ?? defaultStmts, this.settings.parse?.stmts || defaultStmts,
this.settings.parse?.entities ?? defaultEntities, this.settings.parse?.entities || defaultEntities,
this.settings.parse?.rules ?? defaultRules this.settings.parse?.rules || defaultRules
) )
return sqlParseResult return sqlParseResult
} }