@medusajs/eslint-plugin 2.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # @medusajs/eslint-plugin
2
+
3
+ Official ESLint plugin for Medusa projects. Codifies Medusa's framework conventions into automatically-enforced static checks across API routes, modules, workflows, subscribers, scheduled jobs, admin extensions, and module links.
4
+
5
+ > Status: pre-release. The plugin currently ships with no rules — only the package scaffold and `recommended` / `strict` config shapes. Rules will land incrementally; see `MEDUSA_LINT_RULES_CATALOG.md` at the repo root for the planned set.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -D @medusajs/eslint-plugin eslint
11
+ ```
12
+
13
+ `eslint` is a peer dependency — install it in the consuming project.
14
+
15
+ ## Usage (flat config)
16
+
17
+ ```js
18
+ // eslint.config.js
19
+ import medusa from "@medusajs/eslint-plugin"
20
+
21
+ export default [...medusa.configs.recommended]
22
+ ```
23
+
24
+ ## Configs
25
+
26
+ - `recommended` — default preset for Medusa projects.
27
+ - `strict` — extends `recommended` and enables stricter, opt-in heuristics.
28
+
29
+ ## Development
30
+
31
+ ```bash
32
+ yarn workspace @medusajs/eslint-plugin build
33
+ yarn workspace @medusajs/eslint-plugin test
34
+ ```
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare function buildRecommended(plugin: unknown): Linter.Config[];
3
+ //# sourceMappingURL=recommended.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recommended.d.ts","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,CAwBjE"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildRecommended = buildRecommended;
4
+ function buildRecommended(plugin) {
5
+ return [
6
+ {
7
+ ignores: [
8
+ ".medusa/**",
9
+ ".yalc/**",
10
+ "dist/**",
11
+ "build/**",
12
+ "node_modules/**",
13
+ "coverage/**",
14
+ ".cache/**",
15
+ "**/*.generated.ts",
16
+ ],
17
+ },
18
+ {
19
+ files: ["**/*.{ts,tsx}"],
20
+ plugins: { "@medusajs": plugin },
21
+ languageOptions: {
22
+ parser: require("@typescript-eslint/parser"),
23
+ parserOptions: { project: true, sourceType: "module" },
24
+ },
25
+ rules: {},
26
+ },
27
+ ];
28
+ }
29
+ //# sourceMappingURL=recommended.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recommended.js","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":";;AAEA,4CAwBC;AAxBD,SAAgB,gBAAgB,CAAC,MAAe;IAC9C,OAAO;QACL;YACE,OAAO,EAAE;gBACP,YAAY;gBACZ,UAAU;gBACV,SAAS;gBACT,UAAU;gBACV,iBAAiB;gBACjB,aAAa;gBACb,WAAW;gBACX,mBAAmB;aACpB;SACF;QACD;YACE,KAAK,EAAE,CAAC,eAAe,CAAC;YACxB,OAAO,EAAE,EAAE,WAAW,EAAE,MAAe,EAAE;YACzC,eAAe,EAAE;gBACf,MAAM,EAAE,OAAO,CAAC,2BAA2B,CAAC;gBAC5C,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE;aACvD;YACD,KAAK,EAAE,EAAE;SACV;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare function buildStrict(plugin: unknown): Linter.Config[];
3
+ //# sourceMappingURL=strict.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strict.d.ts","sourceRoot":"","sources":["../../src/configs/strict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAGpC,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,CAE5D"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildStrict = buildStrict;
4
+ const recommended_1 = require("./recommended");
5
+ function buildStrict(plugin) {
6
+ return [...(0, recommended_1.buildRecommended)(plugin)];
7
+ }
8
+ //# sourceMappingURL=strict.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strict.js","sourceRoot":"","sources":["../../src/configs/strict.ts"],"names":[],"mappings":";;AAGA,kCAEC;AAJD,+CAAgD;AAEhD,SAAgB,WAAW,CAAC,MAAe;IACzC,OAAO,CAAC,GAAG,IAAA,8BAAgB,EAAC,MAAM,CAAC,CAAC,CAAA;AACtC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { ESLintUtils } from "@typescript-eslint/utils";
2
+ export interface MedusaRuleDocs {
3
+ description: string;
4
+ recommended?: boolean;
5
+ strict?: boolean;
6
+ requiresTypeChecking?: boolean;
7
+ }
8
+ export declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener> & {
9
+ name: string;
10
+ };
11
+ //# sourceMappingURL=create-rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-rule.d.ts","sourceRoot":"","sources":["../src/create-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,eAAO,MAAM,UAAU;;CAGtB,CAAA"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRule = void 0;
4
+ const utils_1 = require("@typescript-eslint/utils");
5
+ exports.createRule = utils_1.ESLintUtils.RuleCreator(
6
+ // TODO: Update this to point to the actual documentation for each rule once it's published
7
+ (name) => `https://docs.medusajs.com/resources/lint/rules/${name}`);
8
+ //# sourceMappingURL=create-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-rule.js","sourceRoot":"","sources":["../src/create-rule.ts"],"names":[],"mappings":";;;AAAA,oDAAsD;AASzC,QAAA,UAAU,GAAG,mBAAW,CAAC,WAAW;AAC/C,2FAA2F;AAC3F,CAAC,IAAI,EAAE,EAAE,CAAC,kDAAkD,IAAI,EAAE,CACnE,CAAA"}
@@ -0,0 +1,21 @@
1
+ import type { Linter } from "eslint";
2
+ import { rules } from "./rules";
3
+ declare const plugin: {
4
+ meta: {
5
+ name: string;
6
+ };
7
+ rules: Record<string, import("@eslint/core").RuleDefinition<import("@eslint/core").RuleDefinitionTypeOptions>>;
8
+ configs: {
9
+ recommended: Linter.Config[];
10
+ strict: Linter.Config[];
11
+ };
12
+ };
13
+ export default plugin;
14
+ export declare const meta: {
15
+ name: string;
16
+ }, configs: {
17
+ recommended: Linter.Config[];
18
+ strict: Linter.Config[];
19
+ };
20
+ export { rules };
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAM/B,QAAA,MAAM,MAAM;;;;;aAGK;QACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;QAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;KACxB;CACsB,CAAA;AAKzB,eAAe,MAAM,CAAA;AACrB,eAAO,MAAQ,IAAI;;GAAE,OAAO;iBATX,MAAM,CAAC,MAAM,EAAE;YACpB,MAAM,CAAC,MAAM,EAAE;CAQY,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rules = exports.configs = exports.meta = void 0;
4
+ const rules_1 = require("./rules");
5
+ Object.defineProperty(exports, "rules", { enumerable: true, get: function () { return rules_1.rules; } });
6
+ const recommended_1 = require("./configs/recommended");
7
+ const strict_1 = require("./configs/strict");
8
+ const PLUGIN_NAME = "@medusajs/eslint-plugin";
9
+ const plugin = {
10
+ meta: { name: PLUGIN_NAME },
11
+ rules: rules_1.rules,
12
+ configs: {},
13
+ };
14
+ plugin.configs.recommended = (0, recommended_1.buildRecommended)(plugin);
15
+ plugin.configs.strict = (0, strict_1.buildStrict)(plugin);
16
+ exports.default = plugin;
17
+ exports.meta = plugin.meta, exports.configs = plugin.configs;
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,mCAA+B;AAoBtB,sFApBA,aAAK,OAoBA;AAnBd,uDAAwD;AACxD,6CAA8C;AAE9C,MAAM,WAAW,GAAG,yBAAyB,CAAA;AAE7C,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3B,KAAK,EAAL,aAAK;IACL,OAAO,EAAE,EAGR;CACsB,CAAA;AAEzB,MAAM,CAAC,OAAO,CAAC,WAAW,GAAG,IAAA,8BAAgB,EAAC,MAAM,CAAC,CAAA;AACrD,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAA;AAE3C,kBAAe,MAAM,CAAA;AACN,YAAI,GAAc,MAAM,OAAlB,eAAO,GAAK,MAAM,SAAA"}
@@ -0,0 +1,3 @@
1
+ import type { ESLint } from "eslint";
2
+ export declare const rules: NonNullable<ESLint.Plugin["rules"]>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAM,CAAA"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rules = void 0;
4
+ exports.rules = {};
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":";;;AAEa,QAAA,KAAK,GAAwC,EAAE,CAAA"}
@@ -0,0 +1 @@
1
+ {"root":["../src/create-rule.ts","../src/index.ts","../src/__tests__/plugin.spec.ts","../src/configs/recommended.ts","../src/configs/strict.ts","../src/rules/index.ts"],"version":"5.9.3"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@medusajs/eslint-plugin",
3
+ "version": "2.15.5",
4
+ "description": "Official ESLint plugin for Medusa projects. Enforces Medusa's framework conventions across API routes, modules, workflows, subscribers, jobs, admin extensions, and module links.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/medusajs/medusa",
8
+ "directory": "packages/eslint-plugin"
9
+ },
10
+ "main": "dist/index.js",
11
+ "types": "dist/index.d.ts",
12
+ "exports": {
13
+ ".": "./dist/index.js",
14
+ "./configs/recommended": "./dist/configs/recommended.js",
15
+ "./configs/strict": "./dist/configs/strict.js"
16
+ },
17
+ "scripts": {
18
+ "build": "yarn run -T rimraf dist && yarn run -T tsc --build",
19
+ "watch": "yarn run -T tsc --build --watch",
20
+ "test": "../../node_modules/.bin/jest --silent=false --bail --forceExit --testPathPattern=src"
21
+ },
22
+ "engines": {
23
+ "node": ">=20.0.0"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "!dist/**/__tests__",
31
+ "!dist/**/*.spec.*",
32
+ "!dist/**/*.test.*"
33
+ ],
34
+ "keywords": [
35
+ "eslint",
36
+ "eslintplugin",
37
+ "eslint-plugin",
38
+ "medusa",
39
+ "medusajs"
40
+ ],
41
+ "author": "Medusa",
42
+ "license": "MIT",
43
+ "peerDependencies": {
44
+ "eslint": "^9.0.0",
45
+ "typescript": ">=4.8.0"
46
+ },
47
+ "dependencies": {
48
+ "@typescript-eslint/parser": "^8.0.0",
49
+ "@typescript-eslint/utils": "^8.0.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/eslint": "^9.6.1",
53
+ "@typescript-eslint/rule-tester": "^8.0.0",
54
+ "eslint": "^9.0.0",
55
+ "typescript": "^5.4.0"
56
+ }
57
+ }