4ce4204b6c
CI / Lint (push) Failing after 2s
CI / Build (push) Has been skipped
SDK CI / PHP SDK (push) Failing after 1s
Split PHP SDK / PHP SDK tests (push) Failing after 1s
CI / Test (push) Failing after 1s
CI / Dashboard (push) Failing after 0s
SDK CI / JavaScript SDK (push) Failing after 0s
SDK CI / Python SDK (push) Failing after 2s
SDK CI / Java SDK (push) Failing after 1s
Split PHP SDK / Mirror sdk/php -> rmyndharis/openwa-php (push) Has been skipped
CI / Test (PostgreSQL migrations) (push) Failing after 7m47s
CI / Docker Build (push) Has been skipped
68 lines
2.2 KiB
JavaScript
68 lines
2.2 KiB
JavaScript
// @ts-check
|
|
import eslint from '@eslint/js';
|
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
import globals from 'globals';
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores: ['eslint.config.mjs'],
|
|
},
|
|
eslint.configs.recommended,
|
|
...tseslint.configs.recommendedTypeChecked,
|
|
eslintPluginPrettierRecommended,
|
|
{
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.node,
|
|
...globals.jest,
|
|
},
|
|
sourceType: 'commonjs',
|
|
parserOptions: {
|
|
projectService: true,
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
rules: {
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/no-floating-promises': 'warn',
|
|
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
"prettier/prettier": ["error", { endOfLine: "auto" }],
|
|
},
|
|
},
|
|
{
|
|
// Architecture guard: HTTP controllers must go through a per-capability service and
|
|
// never reach for the raw WhatsApp engine. This keeps the "session not started" guard,
|
|
// error mapping, and business rules behind the service boundary instead of leaking into
|
|
// controllers. `.getEngine(` (not `.getEngines()`) and the `IWhatsAppEngine` type are banned.
|
|
files: ['**/*.controller.ts'],
|
|
rules: {
|
|
'no-restricted-syntax': [
|
|
'error',
|
|
{
|
|
selector: "CallExpression[callee.property.name='getEngine']",
|
|
message:
|
|
'Controllers must not call getEngine(). Add a method to the capability service (e.g. GroupService) and call that instead.',
|
|
},
|
|
],
|
|
'no-restricted-imports': [
|
|
'error',
|
|
{
|
|
patterns: [
|
|
{
|
|
// Only the engine abstraction itself is banned — data shapes (e.g. ChatSummary)
|
|
// that happen to live in the same file remain importable by controllers.
|
|
group: ['**/engine/interfaces/whatsapp-engine.interface'],
|
|
importNames: ['IWhatsAppEngine'],
|
|
message:
|
|
'Controllers must not import IWhatsAppEngine. Keep engine types behind a capability service.',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
);
|