Skip to content

linter is parsing keywords within strings #233

@LukeWakelingKT

Description

@LukeWakelingKT

The linter should ignore keywords inside properly quoted strings, here it's found the word limit inside a string which should not be invalid.

const sqlLint = require('sql-lint').default;

const main = async function (sqlQuery) {
    const SQLerrors = await sqlLint({ driver: "postgres", sql: sqlQuery });
    console.log(SQLerrors);
}

main("INSERT INTO my_table (notes) VALUES ('speed limit sign');")

returns:

[
  {
    source: '',
    error: "[sql-lint: invalid-limit-quantifier] Argument 'sign' is not a valid quantifier for LIMIT clause.",
    line: 1,
    additionalInformation: ''
  }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions