🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

eslint-plugin-memberjunction

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-memberjunction

ESLint plugin for MemberJunction conventions — 25 rules for entity access, RunView patterns, Angular, type safety, and architecture

latest
Source
npmnpm
Version
0.4.0
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-memberjunction

ESLint plugin for MemberJunction conventions — 25 rules for entity access, RunView patterns, Angular best practices, type safety, and architecture. Plus 2 Stylelint rules and 4 SQL migration checks.

Quick Start (MJ repo)

From your MJ repo root:

# 1. Install (one-time)
npm install eslint-plugin-memberjunction --save-dev

# 2. Lint the files you changed on your branch
npx mj-lint

That's it. No config files to create — everything ships with the package. mj-lint auto-detects your base branch and lints only files you've changed (committed, uncommitted, and new). It handles .ts, .css/.scss, and .sql migration files.

Other useful commands

# Lint a specific package
npx mj-lint 'packages/MJServer/src/**/*.ts'

# Lint a single file
npx mj-lint packages/MJCore/src/generic/baseEntity.ts

# Lint everything
npx mj-lint --all

# Diff against a specific branch
npx mj-lint --base origin/main

IDE integration

mj-lint is a standalone CLI — it doesn't touch your existing eslint config. To get inline warnings in VS Code, add the MJ rules to your project's ESLint config:

// eslint.config.js (flat config) — add to your existing config
import mj from 'eslint-plugin-memberjunction';
export default [mj.configs.recommended, /* ...your existing config */];

Report false positives

If a rule flags something that looks wrong, open an issue — it takes 30 seconds and helps improve the rules for everyone.

Setup (non-MJ projects)

npm install eslint-plugin-memberjunction --save-dev

ESLint flat config

// eslint.config.js
import mj from 'eslint-plugin-memberjunction';

export default [
  mj.configs.recommended,  // all rules as warnings
  { files: ['**/*.ts'] },
];

Or use mj.configs.strict for errors (CI enforcement).

Cherry-pick rules

import mj from 'eslint-plugin-memberjunction';

export default [
  {
    plugins: { memberjunction: mj },
    files: ['**/*.ts'],
    rules: {
      'memberjunction/use-uuids-equal': 'error',
      'memberjunction/no-runview-in-loop': 'error',
      'memberjunction/runview-check-success': 'warn',
    },
  },
];

Configs

ConfigSeverityNaming RuleUse Case
recommendedwarnwarnLocal development — non-blocking IDE hints
stricterroron (with exclusions)CI — blocks PRs with violations

Both configs also enable @typescript-eslint/no-explicit-any.

The strict config excludes external-convention packages (React/, AICLI/, A2AServer/, ComponentRegistryClientSDK/) from the naming rule.

Rules

Entity / Data Access (5 rules)

RuleDefaultWhat It Catches
no-entity-get-setwarn.Get('Field')/.Set('Field', val) — bypasses generated type safety
no-entity-spreadwarn{ ...entity } — loses getter properties, use .GetAll()
no-direct-entity-newwarnnew XyzEntity() — use md.GetEntityObject<T>() class factory
use-uuids-equalwarn=== on UUID fields — use UUIDsEqual() for case-insensitive comparison
no-fields-with-entity-objectwarnFields with ResultType: 'entity_object' — Fields is silently ignored

Performance / Correctness (5 rules)

RuleDefaultWhat It Catches
no-runview-in-loopwarnRunView inside loops — causes N+1 queries
runview-check-successwarnUnchecked .Success on RunView results
entity-save-check-resultwarnUnchecked .Save()/.Load()/.Delete() return values
no-promise-all-runviewwarnPromise.all([rv.RunView(), ...]) — use rv.RunViews([...])
prefer-simple-result-typewarnResultType: 'entity_object' when results aren't mutated

Server Safety (1 rule)

RuleDefaultWhat It Catches
no-global-provider-on-serverwarnnew RunView() without provider, Metadata.Provider reads, GetEntityObject() missing provider arg — causes cross-request data leakage

Angular (6 rules)

RuleDefaultWhat It Catches
no-legacy-template-syntaxwarn*ngIf/*ngFor/*ngSwitch — use @if/@for/@switch
for-requires-trackwarn@for blocks missing track expression
prefer-inject-functionwarnConstructor DI — use inject() function
no-ng-on-changeswarnngOnChanges/ngDoCheck — use @Input() setters
no-router-in-genericwarn@angular/router imports in Generic/ components
require-standalone-falsewarnMissing explicit standalone on decorators (Angular 19+ defaults to true)

Type Safety (2 rules + 1 external)

RuleDefaultWhat It Catches
no-any-typewarnLazy unknown usage — allows unknown at system boundaries
no-action-call-actionwarnthis.executeAction() inside Action subclasses
@typescript-eslint/no-explicit-anywarnAll any usage (external rule, enabled in both configs)

Architecture / Code Style (5 rules)

RuleDefaultWhat It Catches
no-static-singletonwarnManual static _instance — use BaseSingleton<T>
no-cross-package-reexportwarnRe-exporting from @memberjunction/* in index files
no-enum-prefer-unionwarnenum declarations — use union types
no-kendo-iconswarnk-icon/k-i-* CSS classes — use Font Awesome
member-naming-conventionwarnPascalCase public / camelCase private (allows RxJS $ suffix)

Stylelint (2 rules)

npm install stylelint --save-dev
// .stylelintrc.json
{ "plugins": ["eslint-plugin-memberjunction/stylelint"] }
RuleWhat It Catches
mj/no-hardcoded-colorsHex/rgb/rgba — use --mj-* design tokens
mj/no-primitive-tokensvar(--mj-color-neutral-*) — use semantic tokens

SQL Migration Checks (4 rules)

npx mj-lint-sql migrations/v5/
CheckWhat It Catches
no-mj-timestamps__mj_CreatedAt/__mj_UpdatedAt in CREATE TABLE
no-fk-indexesSingle-column FK indexes (CodeGen handles these)
use-flyway-schemaBare dbo./__mj. — use ${flyway:defaultSchema}
no-newidNEWID() in INSERT — use hardcoded UUIDs

CI Integration (diff-aware)

Only lint files changed in the PR:

- name: Lint changed TypeScript files
  run: |
    CHANGED=$(git diff --name-only origin/main...HEAD -- '*.ts' | grep -v __tests__ | grep -v generated | tr '\n' ' ')
    [ -n "$CHANGED" ] && npx eslint $CHANGED --max-warnings 0

Development

npm test            # 429 tests
npm run build       # compile
npm run test:watch  # watch mode

Adding a Rule

  • Create src/rules/my-rule.ts using createRule() from src/utils.ts
  • Create src/__tests__/rules/my-rule.test.ts
  • Register in src/rules/index.ts
  • Add to both configs in src/configs/recommended.ts
  • npm run build && npm test

License

MIT

Keywords

eslint

FAQs

Package last updated on 24 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts