Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linter is parsing keywords within strings #233

Open
LukeWakelingKT opened this issue Dec 1, 2022 · 1 comment
Open

linter is parsing keywords within strings #233

LukeWakelingKT opened this issue Dec 1, 2022 · 1 comment

Comments

@LukeWakelingKT
Copy link

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: ''
  }
]
@LukeWakelingKT
Copy link
Author

version:

"node_modules/sql-lint": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/sql-lint/-/sql-lint-1.0.0.tgz",
      "integrity": "sha512-9o4Oww+IhFFLzPbmMSPNr+uDpk6xjrCYHSpRtqD+dPIu/pU2hdZhokfmgms9zq/3IKmnmoA5+KQdCgGFE2Uj8A==",
      "dependencies": {
        "@types/moo": "^0.5.3",
        "@types/nearley": "^2.11.1",
        "@types/node": "^14.0.14",
        "@types/pg": "^7.14.11",
        "@types/sprintf-js": "^1.1.2",
        "commander": "^5.1.0",
        "moo": "^0.5.1",
        "mysql2": "^2.2.5",
        "nearley": "^2.19.3",
        "param-case": "^3.0.3",
        "pg": "^8.6.0",
        "sprintf-js": "^1.1.2"
      },
      "bin": {
        "sql-lint": "dist/src/cli.js"
      }
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant