@infernodesign/eslint-config 2.11.0 → 2.12.1

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 CHANGED
@@ -6,7 +6,7 @@ Shared ESLint flat config presets for Inferno Design projects. Orignally forked
6
6
  - Reasonable best practices and only one line of config.
7
7
  - Designed to work with TypeScript, JSX, Vue, JSON, YAML, Toml, Markdown, etc. Out-of-box.
8
8
  - Uses the [ESLint Flat Config](https://eslint.org/docs/latest/use/configure/configuration-files-new) for easy compilation.
9
- - Optional [React](#react), [Next.js](#nextjs), [Sanity](#sanity), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro), [Storybook](#storybook), [Solid](#solid) support, [TailwindCSS](#tailwindcss) support.
9
+ - Optional [React](#react), [Medusa](#medusa), [Next.js](#nextjs), [Sanity](#sanity), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro), [Storybook](#storybook), [Solid](#solid) support, [TailwindCSS](#tailwindcss) support.
10
10
  - Optional [formatters](#formatters) support for formatting CSS, HTML, XML, etc.
11
11
  - **Style principle**: Minimal for reading, stable for diff, consistent
12
12
  - Sorted imports, dangling commas
@@ -302,6 +302,7 @@ Since flat config requires us to explicitly provide the plugin names (instead of
302
302
  | New Prefix | Original Prefix | Source Plugin |
303
303
  | ------------------------- | --------------------------------- | ----------------------------------------------------------------------------------------------------- |
304
304
  | `import` | `import-lite` | [eslint-plugin-import-lite](https://github.com/9romise/eslint-plugin-import-lite) |
305
+ | `medusa` | `@medusajs` | [@medusajs/eslint-plugin](https://github.com/medusajs/medusa/tree/develop/packages/eslint-plugin) |
305
306
  | `nextjs` | `@next/next` | [@next/eslint-plugin-next](https://github.com/vercel/next.js/tree/canary/packages/eslint-plugin-next) |
306
307
  | `node` | `n` | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) |
307
308
  | `react` | `@eslint-react` | [@eslint-react/eslint-plugin](https://github.com/eslint-react/eslint-plugin) |
@@ -498,6 +499,57 @@ Running `npx eslint` should prompt you to install the required dependencies, oth
498
499
  npm i -D @eslint-react/eslint-plugin eslint-plugin-react-refresh
499
500
  ```
500
501
 
502
+ #### Medusa
503
+
504
+ To enable linting for Medusa applications with the default recommended rules, explicitly turn it on:
505
+
506
+ ```js
507
+ // eslint.config.js
508
+ import { config } from '@infernodesign/eslint-config'
509
+
510
+ export default config( {
511
+ medusa: true,
512
+ } )
513
+ ```
514
+
515
+ Medusa support is powered by [`@medusajs/eslint-plugin`](https://docs.medusajs.com/resources/lint). It is an optional peer dependency, so projects that enable `medusa` must install it:
516
+
517
+ ```bash
518
+ npm i -D @medusajs/eslint-plugin
519
+ ```
520
+
521
+ The integration exposes all three official presets:
522
+
523
+ ```js
524
+ // eslint.config.js
525
+ import { config } from '@infernodesign/eslint-config'
526
+
527
+ export default config( {
528
+ medusa: {
529
+ // Use preset 'recommended' for applications, 'modules' for standalone module packages, or 'strict' for type-aware and cross-file rules
530
+ preset: 'strict',
531
+ },
532
+ typescript: {
533
+ tsconfigPath: 'tsconfig.json',
534
+ },
535
+ } )
536
+ ```
537
+
538
+ The `strict` preset requires a TypeScript config that includes every linted TypeScript file. Rule overrides retain the file scopes defined by the selected Medusa preset:
539
+
540
+ ```js
541
+ // eslint.config.js
542
+ import { config } from '@infernodesign/eslint-config'
543
+
544
+ export default config( {
545
+ medusa: {
546
+ overrides: {
547
+ 'medusa/no-console-log-in-workflow': 'off',
548
+ },
549
+ },
550
+ } )
551
+ ```
552
+
501
553
  #### Next.js
502
554
 
503
555
  To enable Next.js support, you need to explicitly turn it on:
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import { cac } from "cac";
8
8
  import parse from "parse-gitignore";
9
9
  import { execSync } from "node:child_process";
10
10
  //#region package.json
11
- var version = "2.11.0";
11
+ var version = "2.12.1";
12
12
  //#endregion
13
13
  //#region src/cli/constants.ts
14
14
  const vscodeSettingsString = `
@@ -69,6 +69,10 @@ const frameworkOptions = [
69
69
  label: c.magenta("Astro"),
70
70
  value: "astro"
71
71
  },
72
+ {
73
+ label: c.blue("Medusa"),
74
+ value: "medusa"
75
+ },
72
76
  {
73
77
  label: c.yellow("Next.js"),
74
78
  value: "nextjs"
@@ -124,6 +128,7 @@ const dependenciesMap = {
124
128
  astro: ["eslint-plugin-astro", "astro-eslint-parser"],
125
129
  formatter: ["eslint-plugin-format"],
126
130
  formatterAstro: ["prettier-plugin-astro"],
131
+ medusa: ["@medusajs/eslint-plugin"],
127
132
  nextjs: ["@next/eslint-plugin-next"],
128
133
  node: [],
129
134
  react: ["@eslint-react/eslint-plugin", "eslint-plugin-react-refresh"],
@@ -192,6 +197,7 @@ async function updateEslintFiles(result) {
192
197
  //#region src/cli/constants-generated.ts
193
198
  const versionsMap = {
194
199
  "@eslint-react/eslint-plugin": "^5.18.0",
200
+ "@medusajs/eslint-plugin": "^2.18.0",
195
201
  "@next/eslint-plugin-next": "^16.2.12",
196
202
  "@sanity-labs/eslint-plugin": "^1.0.0",
197
203
  "@unocss/eslint-plugin": "^66.7.5",
package/dist/index.d.ts CHANGED
@@ -1878,6 +1878,346 @@ interface RuleOptions {
1878
1878
  * @deprecated
1879
1879
  */
1880
1880
  'max-statements-per-line'?: Linter.RuleEntry<MaxStatementsPerLine>;
1881
+ /**
1882
+ * Admin widget and UI route components must be arrow functions, not function declarations.
1883
+ * @see https://docs.medusajs.com/resources/lint/rules/admin-component-must-be-arrow-function
1884
+ */
1885
+ 'medusa/admin-component-must-be-arrow-function'?: Linter.RuleEntry<[]>;
1886
+ /**
1887
+ * Admin code is bundled for the browser by Vite — use `import.meta.env` instead of `process.env` for environment variables.
1888
+ * @see https://docs.medusajs.com/resources/lint/rules/admin-env-vars-import-meta
1889
+ */
1890
+ 'medusa/admin-env-vars-import-meta'?: Linter.RuleEntry<[]>;
1891
+ /**
1892
+ * Don't import Node-only framework modules (`@medusajs/framework/utils`, `@medusajs/framework/http`, `@medusajs/framework/workflows-sdk`) in admin code — they break the browser bundle.
1893
+ * @see https://docs.medusajs.com/resources/lint/rules/admin-no-medusa-utils-import
1894
+ */
1895
+ 'medusa/admin-no-medusa-utils-import'?: Linter.RuleEntry<[]>;
1896
+ /**
1897
+ * API route opt-out flag must be exported as `AUTHENTICATE` with a boolean literal value. Other casings or non-boolean values are ignored by the framework.
1898
+ * @see https://docs.medusajs.com/resources/lint/rules/authenticate-flag-name-and-type
1899
+ */
1900
+ 'medusa/authenticate-flag-name-and-type'?: Linter.RuleEntry<[]>;
1901
+ /**
1902
+ * The name passed to `model.define(name, ...)` must be snake_case.
1903
+ * @see https://docs.medusajs.com/resources/lint/rules/data-model-table-name-snake-case
1904
+ */
1905
+ 'medusa/data-model-table-name-snake-case'?: Linter.RuleEntry<[]>;
1906
+ /**
1907
+ * Use the public `@medusajs/framework/*` entry points; don't import from a package's internal `dist/` build output or from deprecated standalone packages.
1908
+ * @see https://docs.medusajs.com/resources/lint/rules/import-from-framework-not-internal
1909
+ */
1910
+ 'medusa/import-from-framework-not-internal'?: Linter.RuleEntry<[]>;
1911
+ /**
1912
+ * Prefer `Modules.*` enum members over bare string keys in link calls and remote-link workflow steps.
1913
+ * @see https://docs.medusajs.com/resources/lint/rules/link-create-keys-modules-enum
1914
+ */
1915
+ 'medusa/link-create-keys-modules-enum'?: Linter.RuleEntry<[]>;
1916
+ /**
1917
+ * Data model relationships (`hasOne`/`belongsTo`/`hasMany`/`manyToMany`) must reference a data model defined in the same module. Use module links for cross-module references.
1918
+ * @see https://docs.medusajs.com/resources/lint/rules/link-no-cross-module-relationship
1919
+ */
1920
+ 'medusa/link-no-cross-module-relationship'?: Linter.RuleEntry<[]>;
1921
+ /**
1922
+ * Arguments to `defineLink` must be of the form `Module.linkable.<dataModel>` or an object with `linkable: Module.linkable.<dataModel>`.
1923
+ * @see https://docs.medusajs.com/resources/lint/rules/link-uses-linkable-properties
1924
+ */
1925
+ 'medusa/link-uses-linkable-properties'?: Linter.RuleEntry<[]>;
1926
+ /**
1927
+ * Loader files under `src/modules/<m>/loaders/` must be registered in the module's `loaders` array.
1928
+ * @see https://docs.medusajs.com/resources/lint/rules/loader-must-be-exported-in-module-definition
1929
+ */
1930
+ 'medusa/loader-must-be-exported-in-module-definition'?: Linter.RuleEntry<[]>;
1931
+ /**
1932
+ * Service method parameters typed `Context` must be decorated with `@MedusaContext()`.
1933
+ * @see https://docs.medusajs.com/resources/lint/rules/medusa-context-on-context-param
1934
+ */
1935
+ 'medusa/medusa-context-on-context-param'?: Linter.RuleEntry<[]>;
1936
+ /**
1937
+ * Middleware functions registered via `defineMiddlewares(...)` must reference their `next` parameter so the middleware chain continues.
1938
+ * @see https://docs.medusajs.com/resources/lint/rules/middleware-must-call-next
1939
+ */
1940
+ 'medusa/middleware-must-call-next'?: Linter.RuleEntry<[]>;
1941
+ /**
1942
+ * Medusa middlewares must be defined in `src/api/middlewares.{ts,js}` with a default export of `defineMiddlewares(...)`. Other filenames or locations are ignored by the framework.
1943
+ * @see https://docs.medusajs.com/resources/lint/rules/middlewares-file-location-and-name
1944
+ */
1945
+ 'medusa/middlewares-file-location-and-name'?: Linter.RuleEntry<[]>;
1946
+ /**
1947
+ * The name passed to `Module(name, ...)` must contain only alphanumeric characters and underscores.
1948
+ * @see https://docs.medusajs.com/resources/lint/rules/module-name-snake-case
1949
+ */
1950
+ 'medusa/module-name-snake-case'?: Linter.RuleEntry<[]>;
1951
+ /**
1952
+ * The function passed to `createWorkflow` must not be `async`. Workflow constructors run at definition time, not execution time.
1953
+ * @see https://docs.medusajs.com/resources/lint/rules/no-async-workflow-constructor
1954
+ */
1955
+ 'medusa/no-async-workflow-constructor'?: Linter.RuleEntry<[]>;
1956
+ /**
1957
+ * Disallow conditional operators (`&&`, `||`, `??`, ternary, `!`, `!!`, optional chaining, `===`/`==`/`!==`/`!=`) directly inside a `createWorkflow` constructor or a `when().then()` callback. Wrap value manipulation in `transform`.
1958
+ * @see https://docs.medusajs.com/resources/lint/rules/no-conditional-expressions-in-workflow
1959
+ */
1960
+ 'medusa/no-conditional-expressions-in-workflow'?: Linter.RuleEntry<[]>;
1961
+ /**
1962
+ * Dynamic UI routes (e.g. `[id]/page.tsx`) must not use `defineRouteConfig` — they aren't added to the sidebar.
1963
+ * @see https://docs.medusajs.com/resources/lint/rules/no-config-on-dynamic-ui-route
1964
+ */
1965
+ 'medusa/no-config-on-dynamic-ui-route'?: Linter.RuleEntry<[]>;
1966
+ /**
1967
+ * Disallow `console.log` (and other `console.*` calls) directly inside a `createWorkflow` constructor or a `when().then()` callback. Both run at workflow-definition time, not execution time — move logs into a `createStep` callback so they run when the workflow actually executes.
1968
+ * @see https://docs.medusajs.com/resources/lint/rules/no-console-log-in-workflow
1969
+ */
1970
+ 'medusa/no-console-log-in-workflow'?: Linter.RuleEntry<[]>;
1971
+ /**
1972
+ * Disallow `req.remoteQueryConfig`; use `req.queryConfig` instead (deprecated since Medusa v2.2.0).
1973
+ * @see https://docs.medusajs.com/resources/lint/rules/no-deprecated-remote-query-config
1974
+ */
1975
+ 'medusa/no-deprecated-remote-query-config'?: Linter.RuleEntry<[]>;
1976
+ /**
1977
+ * Disallow mutating or recomputing variables directly inside a `createWorkflow` constructor or a `when().then()` callback. The constructor runs at workflow-definition time, so locals (step outputs, input, etc.) are placeholders, not real values — derive new values inside `transform` instead.
1978
+ * @see https://docs.medusajs.com/resources/lint/rules/no-direct-variable-mutation-in-workflow
1979
+ */
1980
+ 'medusa/no-direct-variable-mutation-in-workflow'?: Linter.RuleEntry<[]>;
1981
+ /**
1982
+ * Disallow invoking the same step factory more than once in a `createWorkflow` constructor without renaming subsequent calls via `.config({ name })`. Steps registered with the same ID throw at runtime.
1983
+ * @see https://docs.medusajs.com/resources/lint/rules/no-duplicate-step-id-in-workflow
1984
+ */
1985
+ 'medusa/no-duplicate-step-id-in-workflow'?: Linter.RuleEntry<[]>;
1986
+ /**
1987
+ * Disallow `if`/`else` statements directly inside a `createWorkflow` constructor or a `when().then()` callback. Both run at definition time — use `when(...).then(...)` to conditionally execute steps.
1988
+ * @see https://docs.medusajs.com/resources/lint/rules/no-if-in-workflow-constructor
1989
+ */
1990
+ 'medusa/no-if-in-workflow-constructor'?: Linter.RuleEntry<[]>;
1991
+ /**
1992
+ * Disallow `for`, `for-in`, `for-of`, `while`, and `do-while` loops directly inside a `createWorkflow` constructor or a `when().then()` callback. Use `transform` for input prep, or loop outside the workflow (around `.run()`).
1993
+ * @see https://docs.medusajs.com/resources/lint/rules/no-loops-in-workflow
1994
+ */
1995
+ 'medusa/no-loops-in-workflow'?: Linter.RuleEntry<[]>;
1996
+ /**
1997
+ * Don't import MikroORM or awilix directly. As of Medusa v2.11, they're bundled into `@medusajs/framework`; use the `@medusajs/framework/mikro-orm/*` and `@medusajs/framework/awilix` re-exports.
1998
+ * @see https://docs.medusajs.com/resources/lint/rules/no-mikroorm-direct-import
1999
+ */
2000
+ 'medusa/no-mikroorm-direct-import'?: Linter.RuleEntry<[]>;
2001
+ /**
2002
+ * Disallow `new Date(...)` and any `Date.*(...)` static-method call directly inside a `createWorkflow` constructor or a `when().then()` callback. They evaluate at workflow-definition time, not execution time — wrap them in `transform` or compute inside a `createStep`.
2003
+ * @see https://docs.medusajs.com/resources/lint/rules/no-new-date-in-workflow
2004
+ */
2005
+ 'medusa/no-new-date-in-workflow'?: Linter.RuleEntry<[]>;
2006
+ /**
2007
+ * Step and workflow responses must be serializable — disallow `Map`, `Set`, `WeakMap`, and `WeakSet` values inside `new StepResponse(...)` / `new WorkflowResponse(...)`.
2008
+ * @see https://docs.medusajs.com/resources/lint/rules/no-non-serializable-step-return
2009
+ */
2010
+ 'medusa/no-non-serializable-step-return'?: Linter.RuleEntry<[]>;
2011
+ /**
2012
+ * Don't redefine reserved default properties (`created_at`, `updated_at`, `deleted_at`) in `model.define`; they are auto-added.
2013
+ * @see https://docs.medusajs.com/resources/lint/rules/no-reserved-default-properties-in-model
2014
+ */
2015
+ 'medusa/no-reserved-default-properties-in-model'?: Linter.RuleEntry<[]>;
2016
+ /**
2017
+ * Don't call service mutation methods directly from API route handlers; use a workflow instead.
2018
+ * @see https://docs.medusajs.com/resources/lint/rules/no-service-mutations-in-api-route
2019
+ */
2020
+ 'medusa/no-service-mutations-in-api-route'?: Linter.RuleEntry<MedusaNoServiceMutationsInApiRoute>;
2021
+ /**
2022
+ * Disallow spread (`...`) and rest (`...`) elements directly inside a `createWorkflow` constructor or a `when().then()` callback. Wrap object/array manipulation in `transform(...)` so it runs at execution time.
2023
+ * @see https://docs.medusajs.com/resources/lint/rules/no-spread-in-workflow
2024
+ */
2025
+ 'medusa/no-spread-in-workflow'?: Linter.RuleEntry<[]>;
2026
+ /**
2027
+ * Disallow `throw` statements inside a `transform()` callback. Use a validation step or `when-then` instead.
2028
+ * @see https://docs.medusajs.com/resources/lint/rules/no-throw-in-transform
2029
+ */
2030
+ 'medusa/no-throw-in-transform'?: Linter.RuleEntry<[]>;
2031
+ /**
2032
+ * Route matchers passed to `defineMiddlewares(...)` should not end with a trailing slash; matchers without trailing slashes won't match URLs with trailing slashes.
2033
+ * @see https://docs.medusajs.com/resources/lint/rules/no-trailing-slash-in-route-matcher
2034
+ */
2035
+ 'medusa/no-trailing-slash-in-route-matcher'?: Linter.RuleEntry<[]>;
2036
+ /**
2037
+ * Disallow `try/catch` statements directly inside a `createWorkflow` constructor or a `when().then()` callback. Use steps with compensation functions, `throwOnError: false`, or `skipOnPermanentFailure` / `continueOnPermanentFailure` instead.
2038
+ * @see https://docs.medusajs.com/resources/lint/rules/no-try-catch-in-workflow
2039
+ */
2040
+ 'medusa/no-try-catch-in-workflow'?: Linter.RuleEntry<[]>;
2041
+ /**
2042
+ * Disallow combining the `*` wildcard with specific top-level fields in a `query.graph` or `useQueryGraphStep` selection, since `*` drops those field selections.
2043
+ * @see https://docs.medusajs.com/resources/lint/rules/no-wildcard-with-specific-fields
2044
+ */
2045
+ 'medusa/no-wildcard-with-specific-fields'?: Linter.RuleEntry<[]>;
2046
+ /**
2047
+ * Workflow invocations must pass the Medusa container — `workflow(container).run({ input })`. Calling the workflow with no arguments or accessing `.run` directly bypasses container resolution.
2048
+ * @see https://docs.medusajs.com/resources/lint/rules/no-workflow-call-without-container
2049
+ */
2050
+ 'medusa/no-workflow-call-without-container'?: Linter.RuleEntry<[]>;
2051
+ /**
2052
+ * Prefer `ContainerRegistrationKeys.*` members over magic strings in `resolve(...)` calls.
2053
+ * @see https://docs.medusajs.com/resources/lint/rules/prefer-container-registration-keys
2054
+ */
2055
+ 'medusa/prefer-container-registration-keys'?: Linter.RuleEntry<[]>;
2056
+ /**
2057
+ * `RemoteLink` is deprecated since Medusa v2.2.0; use `Link` instead.
2058
+ * @see https://docs.medusajs.com/resources/lint/rules/prefer-link-over-remote-link
2059
+ */
2060
+ 'medusa/prefer-link-over-remote-link'?: Linter.RuleEntry<[]>;
2061
+ /**
2062
+ * Prefer `Modules.*` enum members over magic module-name strings in `resolve(...)` calls.
2063
+ * @see https://docs.medusajs.com/resources/lint/rules/prefer-modules-enum
2064
+ */
2065
+ 'medusa/prefer-modules-enum'?: Linter.RuleEntry<[]>;
2066
+ /**
2067
+ * Prices in Medusa are stored in major units (decimals). Flag values that look like they're in the smallest currency unit (cents).
2068
+ * @see https://docs.medusajs.com/resources/lint/rules/prices-in-major-units
2069
+ */
2070
+ 'medusa/prices-in-major-units'?: Linter.RuleEntry<[]>;
2071
+ /**
2072
+ * A data model defined with `model.define` must declare a primary key via `.primaryKey()`.
2073
+ * @see https://docs.medusajs.com/resources/lint/rules/primary-key-required
2074
+ */
2075
+ 'medusa/primary-key-required'?: Linter.RuleEntry<[]>;
2076
+ /**
2077
+ * Read-only `defineLink(...)` calls must specify a `field` on the first linkable (and a `primaryKey` on the inverse form).
2078
+ * @see https://docs.medusajs.com/resources/lint/rules/read-only-link-requires-field
2079
+ */
2080
+ 'medusa/read-only-link-requires-field'?: Linter.RuleEntry<[]>;
2081
+ /**
2082
+ * Dynamic route parameters must use `[param]` folder syntax and cannot appear as the first segment of a route.
2083
+ * @see https://docs.medusajs.com/resources/lint/rules/route-dynamic-folder-syntax
2084
+ */
2085
+ 'medusa/route-dynamic-folder-syntax'?: Linter.RuleEntry<[]>;
2086
+ /**
2087
+ * API route handler files must be named `route.ts` / `route.js` and live under `src/api/`.
2088
+ * @see https://docs.medusajs.com/resources/lint/rules/route-file-naming
2089
+ */
2090
+ 'medusa/route-file-naming'?: Linter.RuleEntry<[]>;
2091
+ /**
2092
+ * API route handler exports must be uppercase HTTP method names (GET, POST, ...). Lowercase exports are ignored by the framework.
2093
+ * @see https://docs.medusajs.com/resources/lint/rules/route-handler-exports-uppercase
2094
+ */
2095
+ 'medusa/route-handler-exports-uppercase'?: Linter.RuleEntry<[]>;
2096
+ /**
2097
+ * Properties accessed on `req.params` in an API route handler must correspond to a `[param]` folder in the route path.
2098
+ * @see https://docs.medusajs.com/resources/lint/rules/route-params-must-be-defined
2099
+ */
2100
+ 'medusa/route-params-must-be-defined'?: Linter.RuleEntry<[]>;
2101
+ /**
2102
+ * Scheduled job files must export a `config` object with `name` and `schedule` properties.
2103
+ * @see https://docs.medusajs.com/resources/lint/rules/scheduled-job-config-required
2104
+ */
2105
+ 'medusa/scheduled-job-config-required'?: Linter.RuleEntry<[]>;
2106
+ /**
2107
+ * The default-exported scheduled job function must be async.
2108
+ * @see https://docs.medusajs.com/resources/lint/rules/scheduled-job-default-export-async
2109
+ */
2110
+ 'medusa/scheduled-job-default-export-async'?: Linter.RuleEntry<[]>;
2111
+ /**
2112
+ * Scheduled job files must default-export the job function.
2113
+ * @see https://docs.medusajs.com/resources/lint/rules/scheduled-job-default-export-required
2114
+ */
2115
+ 'medusa/scheduled-job-default-export-required'?: Linter.RuleEntry<[]>;
2116
+ /**
2117
+ * Scheduled job `config.name` must be unique across all scheduled jobs in the project.
2118
+ * @see https://docs.medusajs.com/resources/lint/rules/scheduled-job-name-unique
2119
+ */
2120
+ 'medusa/scheduled-job-name-unique'?: Linter.RuleEntry<[]>;
2121
+ /**
2122
+ * A scheduled job `config.schedule` string must be a valid cron expression.
2123
+ * @see https://docs.medusajs.com/resources/lint/rules/scheduled-job-schedule-valid-cron
2124
+ */
2125
+ 'medusa/scheduled-job-schedule-valid-cron'?: Linter.RuleEntry<[]>;
2126
+ /**
2127
+ * A service that extends `MedusaService(...)` and defines a constructor must call `super(...arguments)`.
2128
+ * @see https://docs.medusajs.com/resources/lint/rules/service-constructor-must-call-super
2129
+ */
2130
+ 'medusa/service-constructor-must-call-super'?: Linter.RuleEntry<[]>;
2131
+ /**
2132
+ * All public methods on a service class that extends `MedusaService(...)` must be `async` (or return a `Promise`). Medusa always awaits service method calls.
2133
+ * @see https://docs.medusajs.com/resources/lint/rules/service-methods-must-be-async
2134
+ */
2135
+ 'medusa/service-methods-must-be-async'?: Linter.RuleEntry<[]>;
2136
+ /**
2137
+ * Step id (first argument of `createStep`) must be a kebab-case string literal and should match the enclosing variable name or filename (trailing `Step` segment stripped).
2138
+ * @see https://docs.medusajs.com/resources/lint/rules/step-id-kebab-case
2139
+ */
2140
+ 'medusa/step-id-kebab-case'?: Linter.RuleEntry<[]>;
2141
+ /**
2142
+ * A `createStep` main (or compensation) callback that returns a value must return `new StepResponse(...)`.
2143
+ * @see https://docs.medusajs.com/resources/lint/rules/step-must-return-step-response
2144
+ */
2145
+ 'medusa/step-must-return-step-response'?: Linter.RuleEntry<[]>;
2146
+ /**
2147
+ * Subscriber files must export a `config` object with at least an `event` property.
2148
+ * @see https://docs.medusajs.com/resources/lint/rules/subscriber-config-export-required
2149
+ */
2150
+ 'medusa/subscriber-config-export-required'?: Linter.RuleEntry<[]>;
2151
+ /**
2152
+ * The default-exported subscriber handler function must be async.
2153
+ * @see https://docs.medusajs.com/resources/lint/rules/subscriber-default-export-must-be-async
2154
+ */
2155
+ 'medusa/subscriber-default-export-must-be-async'?: Linter.RuleEntry<[]>;
2156
+ /**
2157
+ * Subscriber files must default-export the subscriber function.
2158
+ * @see https://docs.medusajs.com/resources/lint/rules/subscriber-default-export-required
2159
+ */
2160
+ 'medusa/subscriber-default-export-required'?: Linter.RuleEntry<[]>;
2161
+ /**
2162
+ * A UI route `config` export must be initialized via `defineRouteConfig(...)`.
2163
+ * @see https://docs.medusajs.com/resources/lint/rules/ui-route-config-via-define-route-config
2164
+ */
2165
+ 'medusa/ui-route-config-via-define-route-config'?: Linter.RuleEntry<[]>;
2166
+ /**
2167
+ * UI route files under `src/admin/routes/` must be named `page.tsx`.
2168
+ * @see https://docs.medusajs.com/resources/lint/rules/ui-route-file-name-page-tsx
2169
+ */
2170
+ 'medusa/ui-route-file-name-page-tsx'?: Linter.RuleEntry<[]>;
2171
+ /**
2172
+ * UI route `page` files must default-export the React component.
2173
+ * @see https://docs.medusajs.com/resources/lint/rules/ui-route-must-have-default-export
2174
+ */
2175
+ 'medusa/ui-route-must-have-default-export'?: Linter.RuleEntry<[]>;
2176
+ /**
2177
+ * Service methods that accept a `Context` parameter should be decorated with `@InjectManager()` (public) or `@InjectTransactionManager()` (protected).
2178
+ * @see https://docs.medusajs.com/resources/lint/rules/use-inject-manager-on-public-methods
2179
+ */
2180
+ 'medusa/use-inject-manager-on-public-methods'?: Linter.RuleEntry<[]>;
2181
+ /**
2182
+ * Throw `MedusaError` rather than a generic `Error`. `MedusaError` carries a `type` that Medusa maps to the right HTTP status and a consistent client response.
2183
+ * @see https://docs.medusajs.com/resources/lint/rules/use-medusa-error-not-generic-error
2184
+ */
2185
+ 'medusa/use-medusa-error-not-generic-error'?: Linter.RuleEntry<[]>;
2186
+ /**
2187
+ * Prefer `req.validatedBody` / `req.validatedQuery` when a `validateAndTransformBody` / `validateAndTransformQuery` middleware is applied to the route.
2188
+ * @see https://docs.medusajs.com/resources/lint/rules/use-validated-body-or-query
2189
+ */
2190
+ 'medusa/use-validated-body-or-query'?: Linter.RuleEntry<[]>;
2191
+ /**
2192
+ * Widget files must export a named `config` from `defineWidgetConfig(...)`.
2193
+ * @see https://docs.medusajs.com/resources/lint/rules/widget-must-export-config
2194
+ */
2195
+ 'medusa/widget-must-export-config'?: Linter.RuleEntry<[]>;
2196
+ /**
2197
+ * Widget files must default-export the widget component.
2198
+ * @see https://docs.medusajs.com/resources/lint/rules/widget-must-have-default-export
2199
+ */
2200
+ 'medusa/widget-must-have-default-export'?: Linter.RuleEntry<[]>;
2201
+ /**
2202
+ * Widget `zone` in `defineWidgetConfig` must be a string literal (or array of string literals).
2203
+ * @see https://docs.medusajs.com/resources/lint/rules/widget-zone-must-be-string-literal
2204
+ */
2205
+ 'medusa/widget-zone-must-be-string-literal'?: Linter.RuleEntry<[]>;
2206
+ /**
2207
+ * Workflow id (first argument of `createWorkflow`) must be kebab-case and should match the exported workflow name or filename.
2208
+ * @see https://docs.medusajs.com/resources/lint/rules/workflow-id-matches-export-or-filename
2209
+ */
2210
+ 'medusa/workflow-id-matches-export-or-filename'?: Linter.RuleEntry<[]>;
2211
+ /**
2212
+ * A `createWorkflow` constructor that returns a value must return `new WorkflowResponse(...)`.
2213
+ * @see https://docs.medusajs.com/resources/lint/rules/workflow-must-return-workflow-response
2214
+ */
2215
+ 'medusa/workflow-must-return-workflow-response'?: Linter.RuleEntry<[]>;
2216
+ /**
2217
+ * Zod should be imported from `@medusajs/framework/zod` (Medusa v2.13+), not the bare `zod` package.
2218
+ * @see https://docs.medusajs.com/resources/lint/rules/zod-import-source
2219
+ */
2220
+ 'medusa/zod-import-source'?: Linter.RuleEntry<[]>;
1881
2221
  /**
1882
2222
  * Enforce a particular style for multiline comments
1883
2223
  * @see https://eslint.org/docs/latest/rules/multiline-comment-style
@@ -2105,7 +2445,7 @@ interface RuleOptions {
2105
2445
  * Disallow expressions where the operation doesn't affect the value
2106
2446
  * @see https://eslint.org/docs/latest/rules/no-constant-binary-expression
2107
2447
  */
2108
- 'no-constant-binary-expression'?: Linter.RuleEntry<[]>;
2448
+ 'no-constant-binary-expression'?: Linter.RuleEntry<NoConstantBinaryExpression>;
2109
2449
  /**
2110
2450
  * Disallow constant expressions in conditions
2111
2451
  * @see https://eslint.org/docs/latest/rules/no-constant-condition
@@ -12464,6 +12804,7 @@ type MaxLinesPerFunction = [] | [({
12464
12804
  type MaxNestedCallbacks = [] | [(number | {
12465
12805
  maximum?: number;
12466
12806
  max?: number;
12807
+ checkConstructorCallCallbacks?: boolean;
12467
12808
  })];
12468
12809
  // ----- max-params -----
12469
12810
  type MaxParams = [] | [(number | {
@@ -12486,6 +12827,11 @@ type MaxStatements = [] | [(number | {
12486
12827
  type MaxStatementsPerLine = [] | [{
12487
12828
  max?: number;
12488
12829
  }];
12830
+ // ----- medusa/no-service-mutations-in-api-route -----
12831
+ type MedusaNoServiceMutationsInApiRoute = [] | [{
12832
+ allowedMutations?: string[];
12833
+ additionalMutationPrefixes?: string[];
12834
+ }];
12489
12835
  // ----- multiline-comment-style -----
12490
12836
  type MultilineCommentStyle = ([] | [("starred-block" | "bare-block")] | [] | ["separate-lines"] | ["separate-lines", {
12491
12837
  checkJSDoc?: boolean;
@@ -12528,6 +12874,10 @@ type NoConfusingArrow = [] | [{
12528
12874
  type NoConsole = [] | [{
12529
12875
  allow?: [string, ...(string)[]];
12530
12876
  }];
12877
+ // ----- no-constant-binary-expression -----
12878
+ type NoConstantBinaryExpression = [] | [{
12879
+ checkRelationalComparisons?: boolean;
12880
+ }];
12531
12881
  // ----- no-constant-condition -----
12532
12882
  type NoConstantCondition = [] | [{
12533
12883
  checkLoops?: ("all" | "allExceptWhileTrue" | "none" | true | false);
@@ -16088,6 +16438,10 @@ type PreferRegexLiterals = [] | [{
16088
16438
  // ----- preserve-caught-error -----
16089
16439
  type PreserveCaughtError = [] | [{
16090
16440
  requireCatchParameter?: boolean;
16441
+ errorClassNames?: (string | {
16442
+ name: string;
16443
+ argumentPosition: number;
16444
+ })[];
16091
16445
  }];
16092
16446
  // ----- quote-props -----
16093
16447
  type QuoteProps = ([] | [("always" | "as-needed" | "consistent" | "consistent-as-needed")] | [] | [("always" | "as-needed" | "consistent" | "consistent-as-needed")] | [("always" | "as-needed" | "consistent" | "consistent-as-needed"), {
@@ -21177,7 +21531,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
21177
21531
  onlyEquality?: boolean;
21178
21532
  }];
21179
21533
  // Names of all the configs
21180
- type ConfigNames = 'config/gitignore' | 'config/ignores' | 'config/javascript/setup' | 'config/javascript/rules' | 'config/eslint-comments/rules' | 'config/node/setup' | 'config/node/rules' | 'config/imports/rules' | 'config/command/rules' | 'config/perfectionist/setup' | 'config/imports/rules' | 'config/e18e/rules' | 'config/unicorn/rules' | 'config/jsdoc/rules' | 'config/jsx/setup' | 'config/typescript/setup' | 'config/typescript/parser' | 'config/typescript/type-aware-parser' | 'config/typescript/rules' | 'config/typescript/rules-type-aware' | 'config/typescript/erasable-syntax-only' | 'config/stylistic/rules' | 'config/regexp/rules' | 'config/sanity/setup' | 'config/sanity/rules' | 'config/test/setup' | 'config/test/rules' | 'config/storybook/setup' | 'config/vue/setup' | 'config/vue/rules' | 'config/react/setup' | 'config/react/rules' | 'config/react/typescript' | 'config/react/type-aware-rules' | 'config/nextjs/setup' | 'config/nextjs/rules' | 'config/solid/setup' | 'config/solid/rules' | 'config/svelte/setup' | 'config/svelte/rules' | 'config/unocss' | 'config/astro/setup' | 'config/astro/rules' | 'config/jsonc/setup' | 'config/jsonc/rules' | 'config/sort/package-json' | 'config/sort/tsconfig-json' | 'config/pnpm/package-json' | 'config/pnpm/pnpm-workspace-yaml' | 'config/pnpm/pnpm-workspace-yaml-sort' | 'config/yaml/setup' | 'config/yaml/rules' | 'config/yaml/pnpm-workspace' | 'config/toml/setup' | 'config/toml/rules' | 'config/markdown/setup' | 'config/markdown/processor' | 'config/markdown/parser' | 'config/markdown/rules' | 'config/markdown/disables' | 'config/formatter/setup' | 'config/formatter/css' | 'config/formatter/scss' | 'config/formatter/less' | 'config/formatter/html' | 'config/formatter/xml' | 'config/formatter/svg' | 'config/formatter/markdown' | 'config/formatter/astro' | 'config/formatter/astro/disables' | 'config/formatter/graphql' | 'config/disables/scripts' | 'config/disables/cli' | 'config/disables/bin' | 'config/disables/dts' | 'config/disables/cjs' | 'config/disables/config-files';
21534
+ type ConfigNames = 'config/gitignore' | 'config/ignores' | 'config/javascript/setup' | 'config/javascript/rules' | 'config/eslint-comments/rules' | 'config/node/setup' | 'config/node/rules' | 'config/imports/rules' | 'config/command/rules' | 'config/perfectionist/setup' | 'config/imports/rules' | 'config/e18e/rules' | 'config/unicorn/rules' | 'config/jsdoc/rules' | 'config/jsx/setup' | 'config/typescript/setup' | 'config/typescript/parser' | 'config/typescript/type-aware-parser' | 'config/typescript/rules' | 'config/typescript/rules-type-aware' | 'config/typescript/erasable-syntax-only' | 'config/stylistic/rules' | 'config/regexp/rules' | 'config/medusa/strict/0' | 'config/medusa/strict/1' | 'config/medusa/strict/2' | 'config/medusa/strict/3' | 'config/medusa/strict/4' | 'config/medusa/strict/5' | 'config/medusa/strict/6' | 'config/medusa/strict/7' | 'config/medusa/strict/8' | 'config/medusa/strict/9' | 'config/medusa/strict/10' | 'config/medusa/strict/11' | 'config/medusa/strict/12' | 'config/medusa/strict/13' | 'config/medusa/strict/14' | 'config/medusa/strict/15' | 'config/medusa/strict/16' | 'config/medusa/strict/17' | 'config/medusa/strict/18' | 'config/medusa/strict/19' | 'config/medusa/strict/20' | 'config/medusa/strict/21' | 'config/medusa/strict/22' | 'config/medusa/strict/23' | 'config/sanity/setup' | 'config/sanity/rules' | 'config/test/setup' | 'config/test/rules' | 'config/storybook/setup' | 'config/vue/setup' | 'config/vue/rules' | 'config/react/setup' | 'config/react/rules' | 'config/react/typescript' | 'config/react/type-aware-rules' | 'config/nextjs/setup' | 'config/nextjs/rules' | 'config/solid/setup' | 'config/solid/rules' | 'config/svelte/setup' | 'config/svelte/rules' | 'config/unocss' | 'config/astro/setup' | 'config/astro/rules' | 'config/jsonc/setup' | 'config/jsonc/rules' | 'config/sort/package-json' | 'config/sort/tsconfig-json' | 'config/pnpm/package-json' | 'config/pnpm/pnpm-workspace-yaml' | 'config/pnpm/pnpm-workspace-yaml-sort' | 'config/yaml/setup' | 'config/yaml/rules' | 'config/yaml/pnpm-workspace' | 'config/toml/setup' | 'config/toml/rules' | 'config/markdown/setup' | 'config/markdown/processor' | 'config/markdown/parser' | 'config/markdown/rules' | 'config/markdown/disables' | 'config/formatter/setup' | 'config/formatter/css' | 'config/formatter/scss' | 'config/formatter/less' | 'config/formatter/html' | 'config/formatter/xml' | 'config/formatter/svg' | 'config/formatter/markdown' | 'config/formatter/astro' | 'config/formatter/astro/disables' | 'config/formatter/graphql' | 'config/disables/scripts' | 'config/disables/cli' | 'config/disables/bin' | 'config/disables/dts' | 'config/disables/cjs' | 'config/disables/config-files';
21181
21535
  //#endregion
21182
21536
  //#region src/vendor/prettier-types.d.ts
21183
21537
  /**
@@ -21419,6 +21773,15 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
21419
21773
  * @default true
21420
21774
  */
21421
21775
  markdown?: boolean | OptionsOverrides;
21776
+ /**
21777
+ * Enable Medusa rules.
21778
+ *
21779
+ * Requires installing:
21780
+ * - `@medusajs/eslint-plugin`
21781
+ *
21782
+ * @default false
21783
+ */
21784
+ medusa?: boolean | OptionsMedusa;
21422
21785
  /**
21423
21786
  * Enable nextjs rules.
21424
21787
  *
@@ -21438,6 +21801,7 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
21438
21801
  jsdoc?: TypedFlatConfigItem['rules'];
21439
21802
  jsonc?: TypedFlatConfigItem['rules'];
21440
21803
  markdown?: TypedFlatConfigItem['rules'];
21804
+ medusa?: TypedFlatConfigItem['rules'];
21441
21805
  nextjs?: TypedFlatConfigItem['rules'];
21442
21806
  react?: TypedFlatConfigItem['rules'];
21443
21807
  sanity?: TypedFlatConfigItem['rules'];
@@ -21697,6 +22061,20 @@ interface OptionsJSX {
21697
22061
  a11y?: boolean | OptionsJSXA11y;
21698
22062
  }
21699
22063
  interface OptionsJSXA11y extends OptionsOverrides {}
22064
+ interface OptionsMedusa extends OptionsOverrides {
22065
+ /**
22066
+ * Medusa rule preset.
22067
+ *
22068
+ * - `recommended`: Rules for Medusa applications.
22069
+ * - `strict`: Recommended rules plus type-aware and cross-file rules.
22070
+ * - `modules`: Rules for standalone module or module-provider packages.
22071
+ *
22072
+ * The `strict` preset requires a tsconfig that includes all linted TypeScript files.
22073
+ *
22074
+ * @default 'recommended'
22075
+ */
22076
+ preset?: 'modules' | 'recommended' | 'strict';
22077
+ }
21700
22078
  interface OptionsNextjs {
21701
22079
  /**
21702
22080
  * Specify a root directory within a monorepo.
@@ -22030,6 +22408,7 @@ declare const defaultPluginRenaming: {
22030
22408
  '@eslint-react': string;
22031
22409
  '@eslint-react/dom': string;
22032
22410
  '@eslint-react/naming-convention': string;
22411
+ '@medusajs': string;
22033
22412
  '@next/next': string;
22034
22413
  '@stylistic': string;
22035
22414
  '@typescript-eslint': string;
@@ -22103,6 +22482,9 @@ declare function jsx(options?: OptionsJSX): Promise<TypedFlatConfigItem[]>;
22103
22482
  //#region src/configs/markdown.d.ts
22104
22483
  declare function markdown(options?: OptionsComponentExts & OptionsFiles & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
22105
22484
  //#endregion
22485
+ //#region src/configs/medusa.d.ts
22486
+ declare function medusa(options?: OptionsMedusa & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
22487
+ //#endregion
22106
22488
  //#region src/configs/nextjs.d.ts
22107
22489
  declare function nextjs(options?: OptionsFiles & OptionsNextjs & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
22108
22490
  //#endregion
@@ -22372,4 +22754,4 @@ declare function renameRules(rules: Record<string, any>, map: Record<string, str
22372
22754
  */
22373
22755
  declare function toArray<T>(value: T | T[]): T[];
22374
22756
  //#endregion
22375
- export { Awaitable, CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SANITY, GLOB_SCSS, GLOB_SEARCH_EXCLUDE, GLOB_SRC, GLOB_SRC_EXT, GLOB_STORYBOOK, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsE18e, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSX, OptionsJSXA11y, OptionsNextjs, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsSanity, OptionsStylistic, OptionsTailwindcss, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, PACKAGE_NAME, ResolvedOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, astro, combine, command, comments, config, config as inferno, defaultPluginRenaming, disables, e18e, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInCursorAgent, isInEditorEnv, isInGitHooksOrLintStaged, isInVSCodeESLintExtension, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, normalizeRules, packageExportsSortOrder, packageSortOrder, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sanity, solid, sortPackageJson, sortTsconfig, storybook, stylistic, svelte, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
22757
+ export { Awaitable, CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SANITY, GLOB_SCSS, GLOB_SEARCH_EXCLUDE, GLOB_SRC, GLOB_SRC_EXT, GLOB_STORYBOOK, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsE18e, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSX, OptionsJSXA11y, OptionsMedusa, OptionsNextjs, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsSanity, OptionsStylistic, OptionsTailwindcss, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, PACKAGE_NAME, ResolvedOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, astro, combine, command, comments, config, config as inferno, defaultPluginRenaming, disables, e18e, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInCursorAgent, isInEditorEnv, isInGitHooksOrLintStaged, isInVSCodeESLintExtension, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, medusa, nextjs, node, normalizeRules, packageExportsSortOrder, packageSortOrder, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sanity, solid, sortPackageJson, sortTsconfig, storybook, stylistic, svelte, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
package/dist/index.js CHANGED
@@ -905,6 +905,7 @@ async function javascript(options = {}) {
905
905
  "no-dupe-keys": "error",
906
906
  "no-duplicate-case": "error",
907
907
  "no-empty": ["error", { allowEmptyCatch: true }],
908
+ "no-empty-function": "off",
908
909
  "no-empty-character-class": "error",
909
910
  "no-empty-pattern": "error",
910
911
  "no-eval": "error",
@@ -1438,6 +1439,27 @@ async function markdown(options = {}) {
1438
1439
  ];
1439
1440
  }
1440
1441
  //#endregion
1442
+ //#region src/configs/medusa.ts
1443
+ const MedusaPluginName = "@medusajs/eslint-plugin";
1444
+ async function medusa(options = {}) {
1445
+ const { overrides = {}, preset = "recommended" } = options;
1446
+ await ensurePackages([MedusaPluginName]);
1447
+ const presetConfigs = (await interopDefault(import(MedusaPluginName))).configs[preset];
1448
+ if (!presetConfigs) throw new Error(`[${PACKAGE_NAME}] Failed to find config ${preset} in ${MedusaPluginName}`);
1449
+ return presetConfigs.map(({ plugins, rules, ...config }, index) => {
1450
+ const scopedOverrides = Object.fromEntries(Object.entries(overrides).filter(([rule]) => rule in (rules ?? {})));
1451
+ return {
1452
+ ...config,
1453
+ name: `config/medusa/${preset}/${index}`,
1454
+ ...plugins ? { plugins } : {},
1455
+ ...rules ? { rules: {
1456
+ ...normalizeRules(rules),
1457
+ ...scopedOverrides
1458
+ } } : {}
1459
+ };
1460
+ });
1461
+ }
1462
+ //#endregion
1441
1463
  //#region src/configs/nextjs.ts
1442
1464
  async function nextjs(options = {}) {
1443
1465
  const { files = [GLOB_SRC], overrides = {} } = options;
@@ -1446,7 +1468,7 @@ async function nextjs(options = {}) {
1446
1468
  function getRules(name) {
1447
1469
  const rules = pluginNextJS.configs?.[name]?.rules;
1448
1470
  if (!rules) throw new Error(`[${PACKAGE_NAME}] Failed to find config ${name} in @next/eslint-plugin-next`);
1449
- return normalizeRules$1(rules);
1471
+ return normalizeRules(rules);
1450
1472
  }
1451
1473
  return [{
1452
1474
  name: "config/nextjs/setup",
@@ -1469,9 +1491,6 @@ async function nextjs(options = {}) {
1469
1491
  }
1470
1492
  }];
1471
1493
  }
1472
- function normalizeRules$1(rules) {
1473
- return Object.fromEntries(Object.entries(rules).map(([key, value]) => [key, typeof value === "string" ? [value] : value]));
1474
- }
1475
1494
  //#endregion
1476
1495
  //#region src/configs/node.ts
1477
1496
  async function node() {
@@ -2830,6 +2849,7 @@ async function typescript(options = {}) {
2830
2849
  ...renamePresetRules(pluginTs.configs.strict?.rules ?? {}, configuredRules),
2831
2850
  ...renamePresetRules(pluginTs.configs.stylistic?.rules ?? {}, configuredRules),
2832
2851
  "no-dupe-class-members": "off",
2852
+ "no-empty-function": "off",
2833
2853
  "no-redeclare": "off",
2834
2854
  "no-use-before-define": "off",
2835
2855
  "no-useless-constructor": "off",
@@ -2843,6 +2863,7 @@ async function typescript(options = {}) {
2843
2863
  "ts/method-signature-style": ["error", "property"],
2844
2864
  "ts/no-dupe-class-members": "error",
2845
2865
  "ts/no-dynamic-delete": "off",
2866
+ "ts/no-empty-function": "off",
2846
2867
  "ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
2847
2868
  "ts/no-explicit-any": "off",
2848
2869
  "ts/no-extraneous-class": "off",
@@ -3254,6 +3275,7 @@ const defaultPluginRenaming = {
3254
3275
  "@eslint-react": "react",
3255
3276
  "@eslint-react/dom": "react-dom",
3256
3277
  "@eslint-react/naming-convention": "react-naming-convention",
3278
+ "@medusajs": "medusa",
3257
3279
  "@next/next": "next",
3258
3280
  "@stylistic": "style",
3259
3281
  "@typescript-eslint": "ts",
@@ -3274,7 +3296,7 @@ const defaultPluginRenaming = {
3274
3296
  * The merged ESLint configurations.
3275
3297
  */
3276
3298
  function config(options = {}, ...userConfigs) {
3277
- const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJSDoc = false, jsx: enableJsx = true, nextjs: enableNextjs = false, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, sanity: enableSanity = false, solid: enableSolid = false, storybook: enableStorybook = false, svelte: enableSvelte = false, tailwindcss: enableTailwindcss = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
3299
+ const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJSDoc = false, jsx: enableJsx = true, medusa: enableMedusa = false, nextjs: enableNextjs = false, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, sanity: enableSanity = false, solid: enableSolid = false, storybook: enableStorybook = false, svelte: enableSvelte = false, tailwindcss: enableTailwindcss = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
3278
3300
  let isInEditor = options.isInEditor;
3279
3301
  if (isInEditor == null) {
3280
3302
  isInEditor = isInEditorEnv();
@@ -3324,6 +3346,10 @@ function config(options = {}, ...userConfigs) {
3324
3346
  overrides: getOverrides(options, "stylistic")
3325
3347
  }));
3326
3348
  if (enableRegexp) configs.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
3349
+ if (enableMedusa) configs.push(medusa({
3350
+ ...resolveSubOptions(options, "medusa"),
3351
+ overrides: getOverrides(options, "medusa")
3352
+ }));
3327
3353
  if (enableSanity) configs.push(sanity({
3328
3354
  ...resolveSubOptions(options, "sanity"),
3329
3355
  overrides: getOverrides(options, "sanity")
@@ -3435,6 +3461,7 @@ const CONFIG_PRESET_FULL_ON = {
3435
3461
  jsonc: true,
3436
3462
  jsx: { a11y: true },
3437
3463
  markdown: true,
3464
+ medusa: { preset: "strict" },
3438
3465
  nextjs: true,
3439
3466
  node: true,
3440
3467
  pnpm: true,
@@ -3469,6 +3496,7 @@ const CONFIG_PRESET_FULL_OFF = {
3469
3496
  jsonc: false,
3470
3497
  jsx: false,
3471
3498
  markdown: false,
3499
+ medusa: false,
3472
3500
  nextjs: false,
3473
3501
  node: false,
3474
3502
  pnpm: false,
@@ -3489,4 +3517,4 @@ const CONFIG_PRESET_FULL_OFF = {
3489
3517
  yaml: false
3490
3518
  };
3491
3519
  //#endregion
3492
- export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SANITY, GLOB_SCSS, GLOB_SEARCH_EXCLUDE, GLOB_SRC, GLOB_SRC_EXT, GLOB_STORYBOOK, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, PACKAGE_NAME, StylisticConfigDefaults, astro, combine, command, comments, config, config as inferno, defaultPluginRenaming, disables, e18e, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInCursorAgent, isInEditorEnv, isInGitHooksOrLintStaged, isInVSCodeESLintExtension, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, normalizeRules, packageExportsSortOrder, packageSortOrder, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sanity, solid, sortPackageJson, sortTsconfig, storybook, stylistic, svelte, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
3520
+ export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SANITY, GLOB_SCSS, GLOB_SEARCH_EXCLUDE, GLOB_SRC, GLOB_SRC_EXT, GLOB_STORYBOOK, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, PACKAGE_NAME, StylisticConfigDefaults, astro, combine, command, comments, config, config as inferno, defaultPluginRenaming, disables, e18e, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInCursorAgent, isInEditorEnv, isInGitHooksOrLintStaged, isInVSCodeESLintExtension, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, medusa, nextjs, node, normalizeRules, packageExportsSortOrder, packageSortOrder, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sanity, solid, sortPackageJson, sortTsconfig, storybook, stylistic, svelte, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@infernodesign/eslint-config",
3
3
  "description": "ESLint config for Inferno Design.",
4
- "version": "2.11.0",
4
+ "version": "2.12.1",
5
5
  "type": "module",
6
6
  "author": "Inferno Design <support@infernodesign.com>",
7
7
  "license": "MIT",
@@ -92,6 +92,7 @@
92
92
  "@eslint-react/eslint-plugin": "5.18.0",
93
93
  "@eslint/config-inspector": "3.1.0",
94
94
  "@infernodesign/typescript-config": "workspace:*",
95
+ "@medusajs/eslint-plugin": "2.18.0",
95
96
  "@next/eslint-plugin-next": "16.2.12",
96
97
  "@prettier/plugin-xml": "3.4.2",
97
98
  "@sanity-labs/eslint-plugin": "1.0.0",
@@ -128,6 +129,7 @@
128
129
  },
129
130
  "peerDependencies": {
130
131
  "@eslint-react/eslint-plugin": "^5.18.0",
132
+ "@medusajs/eslint-plugin": "^2.18.0",
131
133
  "@next/eslint-plugin-next": "^16.2.12",
132
134
  "@prettier/plugin-xml": "^3.4.2",
133
135
  "@sanity-labs/eslint-plugin": "^1.0.0",
@@ -152,6 +154,9 @@
152
154
  "@eslint-react/eslint-plugin": {
153
155
  "optional": true
154
156
  },
157
+ "@medusajs/eslint-plugin": {
158
+ "optional": true
159
+ },
155
160
  "@next/eslint-plugin-next": {
156
161
  "optional": true
157
162
  },