Open octo-topi opened 1 year ago
I set up knex client as specified in the doc
Lint fails on this file
I strip down the file to a maximum and still gets the following message
TypeError: Cannot read properties of undefined (reading 'name') Occurred while linting /home/octo-topi/Documents/Octo/Missions/Pix/repositories/pix/api/db/database-builder/database-builder.js:9 Rule: "knex/avoid-injections
Here is the stripped version
class Test { constructor({ knex}) { this.knex = knex; } async query() { const query = 'select ? from users'; const bindingParameters = ['email']; await this.knex.raw(query, bindingParameters); } } export { Test };
.eslintrc.cjs is below - With no settings, lint pass
.eslintrc.cjs
settings: { knex: { builderName: "^(knex)$" } }
Look like the callee structrure is quite different with this
this
So the node.callee.object.name does not exists
node.callee.object.name
if (context.settings && context.settings.knex) { const builder = node.callee.object; const builderName = builder.name || builder.callee.name;
Hi, sorry for not getting back to you here. I'm not using this myself anymore so haven't spent any time on it.
So the solution would be to additionally look for the configured builder on a ThisExpression?
ThisExpression
I set up knex client as specified in the doc
Lint fails on this file
I strip down the file to a maximum and still gets the following message
Here is the stripped version
.eslintrc.cjs
is below - With no settings, lint passLook like the callee structrure is quite different with
this
So the
node.callee.object.name
does not exists