# eslint-plugin-typeorm-enterprise > ESLint and oxlint plugin for TypeORM that catches unsafe database access at lint time: raw SQL, SQL injection, schema-destroying config, missing transactions, cross-tenant queries, and performance anti-patterns. Every rule works without type information, so they run in any ESLint 9+ flat config or under oxlint with zero parser setup; rules with a `typeAware` option additionally use TypeScript types when the typescript-eslint parser and a project are configured. Ships as a single TypeScript source compiled to dual ESM + CommonJS with bundled type declarations. ## Install ```bash npm install --save-dev eslint eslint-plugin-typeorm-enterprise ``` ## Use (ESLint 9 flat config) ```js const typeormEnterprise = require('eslint-plugin-typeorm-enterprise'); module.exports = [typeormEnterprise.configs.recommended]; ``` ## Use (oxlint) ```json { "jsPlugins": ["eslint-plugin-typeorm-enterprise"], "rules": { "typeorm-enterprise/no-raw-query": "error", "typeorm-enterprise/require-typed-query-result": "error" } } ``` ## Rules (prefix: `typeorm-enterprise/`) - no-raw-query: block static raw SQL passed to query/execute/raw. - require-parameterized-query: block dynamic interpolated/concatenated SQL (injection). - no-synchronize-true: block `synchronize: true` in DataSource config (auto-fixable). - no-entity-manager-query: block raw `.query()` on an EntityManager. - no-unsafe-query-builder-delete: block QueryBuilder delete/update reaching `.execute()` without `.where()`. - no-interpolated-where: block interpolated/concatenated QueryBuilder where clauses. - require-transaction: require mutations to run inside a transaction (strict config). - prefer-transaction-for-multiple-writes: combine multiple writes into one transaction (strict config). - require-tenant-scope: require tenant scoping on reads/writes; configurable `tenantKeys` (multiTenant config). - prefer-exists-over-count: prefer an existence check over counting rows (performance config). - require-typed-query-result: require raw query results (`query`, `getRawMany`, ...) to declare a row type; type-aware by default (strict config). - no-untyped-record-escape-hatch: block `any` / `object` / `Record` as the declared type of a raw query result; `allowUnknown` permits `Record` (strict config). - require-query-runner-release: require `createQueryRunner()` results to be released in a `finally` block, or the pooled connection leaks (recommended config). ## Configs - recommended (error) and warn: the broadly-safe rules. - recommendedTypeChecked / strictTypeChecked (error): same rule sets as recommended / strict, with `typeAware: true` on every rule that supports it; needs the typescript-eslint parser with a project or projectService. - strict (error): recommended + require-transaction + prefer-transaction-for-multiple-writes + require-typed-query-result + no-untyped-record-escape-hatch. - performance (warn): prefer-exists-over-count. - multiTenant (error): recommended + require-tenant-scope. ## Compatibility - ESLint: `^9 || ^10`. Node: `>=18`. - oxlint: works via its JS-plugin API (rule prefix `typeorm-enterprise/`). - TypeScript: not required to use the package; ships compiled JS + `.d.ts` and works with any TS version or none. ## Links - This file (canonical URL): https://alokraj68.github.io/eslint-plugin-typeorm-enterprise/llms.txt - Docs: https://github.com/alokraj68/eslint-plugin-typeorm-enterprise#readme - Rule docs: https://github.com/alokraj68/eslint-plugin-typeorm-enterprise/tree/main/docs/rules - npm: https://www.npmjs.com/package/eslint-plugin-typeorm-enterprise - Issues: https://github.com/alokraj68/eslint-plugin-typeorm-enterprise/issues