@wondermarin/eslint-config 2.3.0 → 2.4.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.
Files changed (2) hide show
  1. package/dist/main.js +26 -13
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'node:fs';
2
- import path, { join } from 'node:path';
1
+ import path, { join, dirname } from 'node:path';
2
+ import fs, { existsSync } from 'node:fs';
3
3
  import globals from 'globals';
4
4
 
5
5
  // node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
@@ -57,6 +57,15 @@ function createDefu(merger) {
57
57
  );
58
58
  }
59
59
  var defu = createDefu();
60
+ function findProjectRoot() {
61
+ const startDir = process.cwd();
62
+ let currentDir = startDir;
63
+ while (!currentDir.endsWith("\\")) {
64
+ if (existsSync(join(currentDir, "package.json"))) return currentDir;
65
+ currentDir = dirname(currentDir);
66
+ }
67
+ return startDir;
68
+ }
60
69
 
61
70
  // src/configs/javascript.ts
62
71
  function javascriptConfig() {
@@ -408,7 +417,7 @@ async function interopDefault(module) {
408
417
  }
409
418
 
410
419
  // src/configs/typescript.ts
411
- async function typescriptConfig() {
420
+ async function typescriptConfig(projectRoot) {
412
421
  const [typescriptParser, typescriptPlugin] = await Promise.all([
413
422
  interopDefault(import('@typescript-eslint/parser')),
414
423
  interopDefault(import('@typescript-eslint/eslint-plugin'))
@@ -421,7 +430,7 @@ async function typescriptConfig() {
421
430
  parser: typescriptParser,
422
431
  parserOptions: {
423
432
  project: true,
424
- tsconfigRootDir: process.cwd()
433
+ tsconfigRootDir: projectRoot
425
434
  }
426
435
  },
427
436
  plugins: {
@@ -660,6 +669,7 @@ async function typescriptConfig() {
660
669
  checksConditionals: true,
661
670
  checksSpreads: true,
662
671
  checksVoidReturn: {
672
+ arguments: false,
663
673
  attributes: false,
664
674
  properties: false
665
675
  }
@@ -1519,7 +1529,7 @@ async function reactConfig() {
1519
1529
  }
1520
1530
  ];
1521
1531
  }
1522
- function baseConfig() {
1532
+ function baseConfig(projectRoot) {
1523
1533
  return [
1524
1534
  {
1525
1535
  name: "wondermarin/eslint-config",
@@ -1539,7 +1549,7 @@ function baseConfig() {
1539
1549
  },
1540
1550
  {
1541
1551
  name: "wondermarin/eslint-config/ignores",
1542
- ignores: includeIgnoreFile(join(process.cwd(), ".gitignore")).ignores
1552
+ ignores: includeIgnoreFile(join(projectRoot, ".gitignore")).ignores
1543
1553
  }
1544
1554
  ];
1545
1555
  }
@@ -1585,13 +1595,16 @@ async function wondermarin(options) {
1585
1595
  stylistic: true,
1586
1596
  json: true
1587
1597
  });
1588
- const config = [...baseConfig()];
1589
- if (options.javascript) config.push(...javascriptConfig());
1590
- if (options.typescript) config.push(...await typescriptConfig());
1591
- if (options.stylistic) config.push(...await stylisticConfig());
1592
- if (options.json) config.push(...await jsonConfig());
1593
- if (options.react) config.push(...await reactConfig());
1594
- return config;
1598
+ const projectRoot = findProjectRoot();
1599
+ const configs = await Promise.all([
1600
+ baseConfig(projectRoot),
1601
+ options.javascript ? javascriptConfig() : [],
1602
+ options.typescript ? typescriptConfig(projectRoot) : [],
1603
+ options.stylistic ? stylisticConfig() : [],
1604
+ options.json ? jsonConfig() : [],
1605
+ options.react ? reactConfig() : []
1606
+ ]);
1607
+ return configs.flat();
1595
1608
  }
1596
1609
  var main_default = wondermarin;
1597
1610
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wondermarin/eslint-config",
3
- "version": "2.3.0",
3
+ "version": "2.4.1",
4
4
  "description": "Personal ESLint config.",
5
5
  "homepage": "https://github.com/Wondermarin/eslint-config#readme",
6
6
  "repository": {