@infernodesign/eslint-config 2.10.2 → 2.12.0

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.d.ts CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {}
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.10.2";
11
+ var version = "2.12.0";
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"],
@@ -168,7 +173,8 @@ async function updateEslintFiles(result) {
168
173
  const eslintIgnores = [];
169
174
  if (fs.existsSync(pathESLintIgnore)) {
170
175
  p.log.step(c.cyan`Migrating existing .eslintignore`);
171
- const globs = parse(await fsPromises.readFile(pathESLintIgnore, "utf-8")).globs();
176
+ const content = await fsPromises.readFile(pathESLintIgnore, "utf-8");
177
+ const globs = parse(content).globs();
172
178
  for (const glob of globs) if (glob.type === "ignore") eslintIgnores.push(...glob.patterns);
173
179
  else if (glob.type === "unignore") eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
174
180
  }
@@ -190,19 +196,20 @@ async function updateEslintFiles(result) {
190
196
  //#endregion
191
197
  //#region src/cli/constants-generated.ts
192
198
  const versionsMap = {
193
- "@eslint-react/eslint-plugin": "^5.10.4",
194
- "@next/eslint-plugin-next": "^16.2.10",
199
+ "@eslint-react/eslint-plugin": "^5.18.0",
200
+ "@medusajs/eslint-plugin": "^2.18.0",
201
+ "@next/eslint-plugin-next": "^16.2.12",
195
202
  "@sanity-labs/eslint-plugin": "^1.0.0",
196
- "@unocss/eslint-plugin": "^66.7.4",
197
- "astro-eslint-parser": "^2.1.0",
198
- "eslint": "^10.6.0",
199
- "eslint-plugin-astro": "^2.1.1",
200
- "eslint-plugin-better-tailwindcss": "^4.6.1",
203
+ "@unocss/eslint-plugin": "^66.7.5",
204
+ "astro-eslint-parser": "^3.0.0",
205
+ "eslint": "^10.8.0",
206
+ "eslint-plugin-astro": "^3.0.1",
207
+ "eslint-plugin-better-tailwindcss": "^4.7.0",
201
208
  "eslint-plugin-format": "^2.0.1",
202
209
  "eslint-plugin-react-refresh": "^0.5.3",
203
210
  "eslint-plugin-solid": "^0.14.5",
204
- "eslint-plugin-storybook": "^10.4.6",
205
- "eslint-plugin-svelte": "^3.20.0",
211
+ "eslint-plugin-storybook": "^10.5.5",
212
+ "eslint-plugin-svelte": "^3.22.0",
206
213
  "prettier-plugin-astro": "^0.14.1",
207
214
  "prettier-plugin-slidev": "^1.0.5",
208
215
  "svelte-eslint-parser": "^1.8.0"
@@ -228,12 +235,10 @@ async function updatePackageJson(result) {
228
235
  addedPackages.push(f);
229
236
  });
230
237
  break;
231
- case "unocss":
232
- dependenciesMap.unocss.forEach((f) => {
233
- pkg.devDependencies[f] = versionsMap[f];
234
- addedPackages.push(f);
235
- });
236
- break;
238
+ case "unocss": dependenciesMap.unocss.forEach((f) => {
239
+ pkg.devDependencies[f] = versionsMap[f];
240
+ addedPackages.push(f);
241
+ });
237
242
  }
238
243
  });
239
244
  for (const framework of result.frameworks) {