@storm-software/eslint 0.19.0 → 0.20.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
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.18.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.20.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
package/dist/preset.d.mts CHANGED
@@ -5,6 +5,20 @@ import { Linter } from 'eslint';
5
5
 
6
6
 
7
7
  interface RuleOptions {
8
+ /**
9
+ * Checks dependencies in project's package.json for version mismatches
10
+ * @see https://github.com/nrwl/nx/blob/19.5.1/docs/generated/packages/eslint-plugin/documents/dependency-checks.md
11
+ */
12
+ '@nx/dependency-checks'?: Linter.RuleEntry<NxDependencyChecks>
13
+ /**
14
+ * Ensure that module boundaries are respected within the monorepo
15
+ * @see https://github.com/nrwl/nx/blob/19.5.1/docs/generated/packages/eslint-plugin/documents/enforce-module-boundaries.md
16
+ */
17
+ '@nx/enforce-module-boundaries'?: Linter.RuleEntry<NxEnforceModuleBoundaries>
18
+ /**
19
+ * Checks common nx-plugin configuration files for validity
20
+ */
21
+ '@nx/nx-plugin-checks'?: Linter.RuleEntry<NxNxPluginChecks>
8
22
  /**
9
23
  * Require that function overload signatures be consecutive
10
24
  * @see https://typescript-eslint.io/rules/adjacent-overload-signatures
@@ -1449,6 +1463,54 @@ interface RuleOptions {
1449
1463
  }
1450
1464
 
1451
1465
  /* ======= Declarations ======= */
1466
+ // ----- @nx/dependency-checks -----
1467
+ type NxDependencyChecks = []|[{
1468
+ buildTargets?: string[]
1469
+ ignoredDependencies?: string[]
1470
+ ignoredFiles?: string[]
1471
+ checkMissingDependencies?: boolean
1472
+ checkObsoleteDependencies?: boolean
1473
+ checkVersionMismatches?: boolean
1474
+ includeTransitiveDependencies?: boolean
1475
+ useLocalPathsForWorkspaceDependencies?: boolean
1476
+ }]
1477
+ // ----- @nx/enforce-module-boundaries -----
1478
+ type NxEnforceModuleBoundaries = []|[{
1479
+ enforceBuildableLibDependency?: boolean
1480
+ allowCircularSelfDependency?: boolean
1481
+ checkDynamicDependenciesExceptions?: string[]
1482
+ banTransitiveDependencies?: boolean
1483
+ checkNestedExternalImports?: boolean
1484
+ allow?: string[]
1485
+ buildTargets?: string[]
1486
+ depConstraints?: ({
1487
+ sourceTag?: string
1488
+ onlyDependOnLibsWithTags?: string[]
1489
+ allowedExternalImports?: string[]
1490
+ bannedExternalImports?: string[]
1491
+ notDependOnLibsWithTags?: string[]
1492
+ } | {
1493
+
1494
+ allSourceTags?: [string, string, ...(string)[]]
1495
+ onlyDependOnLibsWithTags?: string[]
1496
+ allowedExternalImports?: string[]
1497
+ bannedExternalImports?: string[]
1498
+ notDependOnLibsWithTags?: string[]
1499
+ })[]
1500
+ }]
1501
+ // ----- @nx/nx-plugin-checks -----
1502
+ type NxNxPluginChecks = []|[{
1503
+
1504
+ generatorsJson?: string
1505
+
1506
+ executorsJson?: string
1507
+
1508
+ migrationsJson?: string
1509
+
1510
+ packageJson?: string
1511
+
1512
+ allowedVersionStrings?: string[]
1513
+ }]
1452
1514
  // ----- @typescript-eslint/array-type -----
1453
1515
  type TypescriptEslintArrayType = []|[{
1454
1516
 
package/dist/preset.d.ts CHANGED
@@ -5,6 +5,20 @@ import { Linter } from 'eslint';
5
5
 
6
6
 
7
7
  interface RuleOptions {
8
+ /**
9
+ * Checks dependencies in project's package.json for version mismatches
10
+ * @see https://github.com/nrwl/nx/blob/19.5.1/docs/generated/packages/eslint-plugin/documents/dependency-checks.md
11
+ */
12
+ '@nx/dependency-checks'?: Linter.RuleEntry<NxDependencyChecks>
13
+ /**
14
+ * Ensure that module boundaries are respected within the monorepo
15
+ * @see https://github.com/nrwl/nx/blob/19.5.1/docs/generated/packages/eslint-plugin/documents/enforce-module-boundaries.md
16
+ */
17
+ '@nx/enforce-module-boundaries'?: Linter.RuleEntry<NxEnforceModuleBoundaries>
18
+ /**
19
+ * Checks common nx-plugin configuration files for validity
20
+ */
21
+ '@nx/nx-plugin-checks'?: Linter.RuleEntry<NxNxPluginChecks>
8
22
  /**
9
23
  * Require that function overload signatures be consecutive
10
24
  * @see https://typescript-eslint.io/rules/adjacent-overload-signatures
@@ -1449,6 +1463,54 @@ interface RuleOptions {
1449
1463
  }
1450
1464
 
1451
1465
  /* ======= Declarations ======= */
1466
+ // ----- @nx/dependency-checks -----
1467
+ type NxDependencyChecks = []|[{
1468
+ buildTargets?: string[]
1469
+ ignoredDependencies?: string[]
1470
+ ignoredFiles?: string[]
1471
+ checkMissingDependencies?: boolean
1472
+ checkObsoleteDependencies?: boolean
1473
+ checkVersionMismatches?: boolean
1474
+ includeTransitiveDependencies?: boolean
1475
+ useLocalPathsForWorkspaceDependencies?: boolean
1476
+ }]
1477
+ // ----- @nx/enforce-module-boundaries -----
1478
+ type NxEnforceModuleBoundaries = []|[{
1479
+ enforceBuildableLibDependency?: boolean
1480
+ allowCircularSelfDependency?: boolean
1481
+ checkDynamicDependenciesExceptions?: string[]
1482
+ banTransitiveDependencies?: boolean
1483
+ checkNestedExternalImports?: boolean
1484
+ allow?: string[]
1485
+ buildTargets?: string[]
1486
+ depConstraints?: ({
1487
+ sourceTag?: string
1488
+ onlyDependOnLibsWithTags?: string[]
1489
+ allowedExternalImports?: string[]
1490
+ bannedExternalImports?: string[]
1491
+ notDependOnLibsWithTags?: string[]
1492
+ } | {
1493
+
1494
+ allSourceTags?: [string, string, ...(string)[]]
1495
+ onlyDependOnLibsWithTags?: string[]
1496
+ allowedExternalImports?: string[]
1497
+ bannedExternalImports?: string[]
1498
+ notDependOnLibsWithTags?: string[]
1499
+ })[]
1500
+ }]
1501
+ // ----- @nx/nx-plugin-checks -----
1502
+ type NxNxPluginChecks = []|[{
1503
+
1504
+ generatorsJson?: string
1505
+
1506
+ executorsJson?: string
1507
+
1508
+ migrationsJson?: string
1509
+
1510
+ packageJson?: string
1511
+
1512
+ allowedVersionStrings?: string[]
1513
+ }]
1452
1514
  // ----- @typescript-eslint/array-type -----
1453
1515
  type TypescriptEslintArrayType = []|[{
1454
1516
 
package/dist/preset.mjs CHANGED
@@ -1,7 +1,9 @@
1
- import tseslint from 'typescript-eslint';
1
+ import tsEslint from 'typescript-eslint';
2
2
  import eslintPluginUnicorn from 'eslint-plugin-unicorn';
3
3
  import markdown from 'eslint-plugin-markdown';
4
4
  import globals from 'globals';
5
+ import nxPlugin from '@nx/eslint-plugin';
6
+ import jsoncParser from 'jsonc-eslint-parser';
5
7
 
6
8
  function getDefaultExportFromCjs (x) {
7
9
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -340,7 +342,18 @@ const formatConfig = (name, config = []) => {
340
342
  });
341
343
  };
342
344
 
343
- function stormPreset(options = {}, ...userConfigs) {
345
+ function stormPreset(options = {
346
+ moduleBoundaries: {
347
+ enforceBuildableLibDependency: true,
348
+ allow: [],
349
+ depConstraints: [
350
+ {
351
+ sourceTag: "*",
352
+ onlyDependOnLibsWithTags: ["*"]
353
+ }
354
+ ]
355
+ }
356
+ }, ...userConfigs) {
344
357
  const rules = {
345
358
  "unicorn/number-literal-case": 0,
346
359
  "unicorn/template-indent": 0,
@@ -368,7 +381,7 @@ function stormPreset(options = {}, ...userConfigs) {
368
381
  // https://eslint.org/docs/latest/rules/
369
382
  eslint.configs.recommended,
370
383
  // https://typescript-eslint.io/
371
- ...tseslint.configs.recommended,
384
+ ...tsEslint.configs.recommended,
372
385
  // https://github.com/sindresorhus/eslint-plugin-unicorn
373
386
  eslintPluginUnicorn.configs["flat/recommended"],
374
387
  // Preset overrides
@@ -407,6 +420,44 @@ function stormPreset(options = {}, ...userConfigs) {
407
420
  ...options.markdown?.rules
408
421
  }
409
422
  },
423
+ // Nx plugin
424
+ { plugins: { "@nx": nxPlugin } },
425
+ {
426
+ languageOptions: {
427
+ parser: tsEslint.parser,
428
+ globals: {
429
+ ...globals.node
430
+ }
431
+ },
432
+ rules: {
433
+ "@typescript-eslint/explicit-module-boundary-types": ["error"]
434
+ }
435
+ },
436
+ {
437
+ files: ["*.json", "*.jsonc"],
438
+ languageOptions: {
439
+ parser: jsoncParser
440
+ },
441
+ rules: {}
442
+ },
443
+ {
444
+ files: ["*.ts", "*.tsx", "*.js", "*.jsx"],
445
+ rules: {
446
+ "@nx/enforce-module-boundaries": [
447
+ "error",
448
+ options.moduleBoundaries ? options.moduleBoundaries : {
449
+ enforceBuildableLibDependency: true,
450
+ allow: [],
451
+ depConstraints: [
452
+ {
453
+ sourceTag: "*",
454
+ onlyDependOnLibsWithTags: ["*"]
455
+ }
456
+ ]
457
+ }
458
+ ]
459
+ }
460
+ },
410
461
  // User overrides
411
462
  ...userConfigs
412
463
  ].filter(Boolean);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/eslint",
3
- "version": "0.19.0",
3
+ "version": "0.20.1",
4
4
  "type": "module",
5
5
  "description": "⚡ A package containing the base ESLint configuration used by Storm Software across many projects.",
6
6
  "repository": {