@conarti/eslint-plugin-feature-sliced 2.0.0-rc.2 → 2.0.0-rc.4

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/dist/index.cjs CHANGED
@@ -28,11 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- default: () => src_default
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => index_default
34
34
  });
35
- module.exports = __toCommonJS(src_exports);
35
+ module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // src/config.ts
38
38
  var PLUGIN_NAME = "@conarti/feature-sliced";
@@ -67,7 +67,7 @@ var segments = [
67
67
  var pathSeparator = "/";
68
68
 
69
69
  // package.json
70
- var version = "2.0.0-rc.1";
70
+ var version = "2.0.0-rc.4";
71
71
 
72
72
  // src/rules/index.ts
73
73
  var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
@@ -343,7 +343,7 @@ function compareFeatureSlicedParts(fsPartsToCompare) {
343
343
  } = fsPartsToCompare;
344
344
  const hasUnknownLayers = target.validatedFeatureSlicedParts.hasNotLayer || currentFile.validatedFeatureSlicedParts.hasNotLayer;
345
345
  const isSameLayer = target.validatedFeatureSlicedParts.hasLayer && currentFile.validatedFeatureSlicedParts.hasLayer && target.fsdParts.layer === currentFile.fsdParts.layer;
346
- const isSameSlice = target.validatedFeatureSlicedParts.hasSlice && currentFile.validatedFeatureSlicedParts.hasSlice && target.fsdParts.slice === currentFile.fsdParts.slice;
346
+ const isSameSlice = isSameLayer && target.validatedFeatureSlicedParts.hasSlice && currentFile.validatedFeatureSlicedParts.hasSlice && target.fsdParts.slice === currentFile.fsdParts.slice;
347
347
  const isSameSegment = target.fsdParts.segment === currentFile.fsdParts.segment;
348
348
  const isSameLayerWithoutSlices = isSameLayer && !target.validatedFeatureSlicedParts.canLayerContainSlices && !currentFile.validatedFeatureSlicedParts.canLayerContainSlices;
349
349
  return {
@@ -460,7 +460,8 @@ function validateAndReport(node, context, optionsWithDefault, options = { needCh
460
460
  if (!hasPath(node)) {
461
461
  return;
462
462
  }
463
- if (isIgnoredCurrentFile(context, optionsWithDefault)) {
463
+ const isIgnoredForValidation = isIgnoredTarget(node, optionsWithDefault) || isIgnoredCurrentFile(context, optionsWithDefault);
464
+ if (isIgnoredForValidation) {
464
465
  return;
465
466
  }
466
467
  const pathsInfo = extractPathsInfo(node, context);
@@ -488,6 +489,12 @@ var absolute_relative_default = createEslintRule({
488
489
  {
489
490
  type: "object",
490
491
  properties: {
492
+ ignorePatterns: {
493
+ type: "array",
494
+ items: {
495
+ type: "string"
496
+ }
497
+ },
491
498
  ignoreInFilesPatterns: {
492
499
  type: "array",
493
500
  items: {
@@ -500,6 +507,7 @@ var absolute_relative_default = createEslintRule({
500
507
  },
501
508
  defaultOptions: [
502
509
  {
510
+ ignorePatterns: [],
503
511
  ignoreInFilesPatterns: []
504
512
  }
505
513
  ],
@@ -724,7 +732,8 @@ function extractValueToRemove(pathsInfo) {
724
732
  function convertToPublicApi(pathsInfo) {
725
733
  const { normalizedTargetPath } = pathsInfo;
726
734
  const valueToRemove = extractValueToRemove(pathsInfo);
727
- const publicApiPath = normalizedTargetPath.replace(`/${valueToRemove}`, "");
735
+ let publicApiPath = normalizedTargetPath.replace(`/${valueToRemove}`, "");
736
+ publicApiPath = publicApiPath.replace(/\.\w+$/, "");
728
737
  return [publicApiPath, valueToRemove];
729
738
  }
730
739
 
@@ -800,7 +809,8 @@ function validateAndReport3(node, context, optionsWithDefault) {
800
809
  if (!hasPath(node)) {
801
810
  return;
802
811
  }
803
- if (isIgnoredCurrentFile(context, optionsWithDefault)) {
812
+ const isIgnoredForValidation = isIgnoredTarget(node, optionsWithDefault) || isIgnoredCurrentFile(context, optionsWithDefault);
813
+ if (isIgnoredForValidation) {
804
814
  return;
805
815
  }
806
816
  if (shouldBeFromPublicApi(node, context, optionsWithDefault)) {
@@ -858,6 +868,12 @@ var public_api_default = createEslintRule({
858
868
  "slices" /* SLICES */
859
869
  ]
860
870
  },
871
+ ignorePatterns: {
872
+ type: "array",
873
+ items: {
874
+ type: "string"
875
+ }
876
+ },
861
877
  ignoreInFilesPatterns: {
862
878
  type: "array",
863
879
  items: {
@@ -871,6 +887,7 @@ var public_api_default = createEslintRule({
871
887
  defaultOptions: [
872
888
  {
873
889
  level: "slices" /* SLICES */,
890
+ ignorePatterns: [],
874
891
  ignoreInFilesPatterns: []
875
892
  }
876
893
  ],
@@ -1001,4 +1018,4 @@ function defineRules(options) {
1001
1018
  }
1002
1019
 
1003
1020
  // src/index.ts
1004
- var src_default = createPlugin;
1021
+ var index_default = createPlugin;
package/dist/index.d.cts CHANGED
@@ -16,6 +16,10 @@ declare const enum VALIDATION_LEVEL {
16
16
  }
17
17
 
18
18
  interface AbsoluteRelativeOptions {
19
+ /**
20
+ * Ignore certain import paths (import foo from '<path-to-ignore>')
21
+ */
22
+ ignorePatterns: string[];
19
23
  /**
20
24
  * Disable the rule in certain files
21
25
  */
@@ -45,6 +49,10 @@ interface PublicApiOptions {
45
49
  * @default 'slices'
46
50
  */
47
51
  level: VALIDATION_LEVEL;
52
+ /**
53
+ * Ignore certain import paths (import foo from '<path-to-ignore>')
54
+ */
55
+ ignorePatterns: string[];
48
56
  /**
49
57
  * Disable the rule in certain files
50
58
  */
package/dist/index.d.ts CHANGED
@@ -16,6 +16,10 @@ declare const enum VALIDATION_LEVEL {
16
16
  }
17
17
 
18
18
  interface AbsoluteRelativeOptions {
19
+ /**
20
+ * Ignore certain import paths (import foo from '<path-to-ignore>')
21
+ */
22
+ ignorePatterns: string[];
19
23
  /**
20
24
  * Disable the rule in certain files
21
25
  */
@@ -45,6 +49,10 @@ interface PublicApiOptions {
45
49
  * @default 'slices'
46
50
  */
47
51
  level: VALIDATION_LEVEL;
52
+ /**
53
+ * Ignore certain import paths (import foo from '<path-to-ignore>')
54
+ */
55
+ ignorePatterns: string[];
48
56
  /**
49
57
  * Disable the rule in certain files
50
58
  */
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var segments = [
31
31
  var pathSeparator = "/";
32
32
 
33
33
  // package.json
34
- var version = "2.0.0-rc.1";
34
+ var version = "2.0.0-rc.4";
35
35
 
36
36
  // src/rules/index.ts
37
37
  import pluginImport from "eslint-plugin-import-x";
@@ -49,10 +49,10 @@ function isPathRelative(path3) {
49
49
  }
50
50
 
51
51
  // src/lib/path/join-path.ts
52
- import path2 from "node:path";
52
+ import path2 from "path";
53
53
 
54
54
  // src/lib/path/normalize-path.ts
55
- import path from "node:path";
55
+ import path from "path";
56
56
  function normalizePath(targetPath) {
57
57
  const winSepRegExp = /\\/g;
58
58
  const withNormalizedSeparators = path.normalize(targetPath).replace(winSepRegExp, pathSeparator);
@@ -310,7 +310,7 @@ function compareFeatureSlicedParts(fsPartsToCompare) {
310
310
  } = fsPartsToCompare;
311
311
  const hasUnknownLayers = target.validatedFeatureSlicedParts.hasNotLayer || currentFile.validatedFeatureSlicedParts.hasNotLayer;
312
312
  const isSameLayer = target.validatedFeatureSlicedParts.hasLayer && currentFile.validatedFeatureSlicedParts.hasLayer && target.fsdParts.layer === currentFile.fsdParts.layer;
313
- const isSameSlice = target.validatedFeatureSlicedParts.hasSlice && currentFile.validatedFeatureSlicedParts.hasSlice && target.fsdParts.slice === currentFile.fsdParts.slice;
313
+ const isSameSlice = isSameLayer && target.validatedFeatureSlicedParts.hasSlice && currentFile.validatedFeatureSlicedParts.hasSlice && target.fsdParts.slice === currentFile.fsdParts.slice;
314
314
  const isSameSegment = target.fsdParts.segment === currentFile.fsdParts.segment;
315
315
  const isSameLayerWithoutSlices = isSameLayer && !target.validatedFeatureSlicedParts.canLayerContainSlices && !currentFile.validatedFeatureSlicedParts.canLayerContainSlices;
316
316
  return {
@@ -427,7 +427,8 @@ function validateAndReport(node, context, optionsWithDefault, options = { needCh
427
427
  if (!hasPath(node)) {
428
428
  return;
429
429
  }
430
- if (isIgnoredCurrentFile(context, optionsWithDefault)) {
430
+ const isIgnoredForValidation = isIgnoredTarget(node, optionsWithDefault) || isIgnoredCurrentFile(context, optionsWithDefault);
431
+ if (isIgnoredForValidation) {
431
432
  return;
432
433
  }
433
434
  const pathsInfo = extractPathsInfo(node, context);
@@ -455,6 +456,12 @@ var absolute_relative_default = createEslintRule({
455
456
  {
456
457
  type: "object",
457
458
  properties: {
459
+ ignorePatterns: {
460
+ type: "array",
461
+ items: {
462
+ type: "string"
463
+ }
464
+ },
458
465
  ignoreInFilesPatterns: {
459
466
  type: "array",
460
467
  items: {
@@ -467,6 +474,7 @@ var absolute_relative_default = createEslintRule({
467
474
  },
468
475
  defaultOptions: [
469
476
  {
477
+ ignorePatterns: [],
470
478
  ignoreInFilesPatterns: []
471
479
  }
472
480
  ],
@@ -698,7 +706,8 @@ function extractValueToRemove(pathsInfo) {
698
706
  function convertToPublicApi(pathsInfo) {
699
707
  const { normalizedTargetPath } = pathsInfo;
700
708
  const valueToRemove = extractValueToRemove(pathsInfo);
701
- const publicApiPath = normalizedTargetPath.replace(`/${valueToRemove}`, "");
709
+ let publicApiPath = normalizedTargetPath.replace(`/${valueToRemove}`, "");
710
+ publicApiPath = publicApiPath.replace(/\.\w+$/, "");
702
711
  return [publicApiPath, valueToRemove];
703
712
  }
704
713
 
@@ -774,7 +783,8 @@ function validateAndReport3(node, context, optionsWithDefault) {
774
783
  if (!hasPath(node)) {
775
784
  return;
776
785
  }
777
- if (isIgnoredCurrentFile(context, optionsWithDefault)) {
786
+ const isIgnoredForValidation = isIgnoredTarget(node, optionsWithDefault) || isIgnoredCurrentFile(context, optionsWithDefault);
787
+ if (isIgnoredForValidation) {
778
788
  return;
779
789
  }
780
790
  if (shouldBeFromPublicApi(node, context, optionsWithDefault)) {
@@ -832,6 +842,12 @@ var public_api_default = createEslintRule({
832
842
  "slices" /* SLICES */
833
843
  ]
834
844
  },
845
+ ignorePatterns: {
846
+ type: "array",
847
+ items: {
848
+ type: "string"
849
+ }
850
+ },
835
851
  ignoreInFilesPatterns: {
836
852
  type: "array",
837
853
  items: {
@@ -845,6 +861,7 @@ var public_api_default = createEslintRule({
845
861
  defaultOptions: [
846
862
  {
847
863
  level: "slices" /* SLICES */,
864
+ ignorePatterns: [],
848
865
  ignoreInFilesPatterns: []
849
866
  }
850
867
  ],
@@ -975,7 +992,7 @@ function defineRules(options) {
975
992
  }
976
993
 
977
994
  // src/index.ts
978
- var src_default = createPlugin;
995
+ var index_default = createPlugin;
979
996
  export {
980
- src_default as default
997
+ index_default as default
981
998
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@conarti/eslint-plugin-feature-sliced",
3
3
  "type": "module",
4
- "version": "2.0.0-rc.2",
4
+ "version": "2.0.0-rc.4",
5
5
  "description": "Feature-sliced design methodology plugin",
6
6
  "author": "Aleksandr Belous <abelous2009@gmail.com>",
7
7
  "license": "ISC",
@@ -36,7 +36,7 @@
36
36
  "stub": "tsup --format esm",
37
37
  "dev": "npx @eslint/config-inspector --config eslint.config.ts",
38
38
  "watch": "tsup --format esm,cjs --watch",
39
- "typecheck": "tsc --noEmit",
39
+ "type-check": "tsc --noEmit",
40
40
  "lint": "eslint .",
41
41
  "test": "vitest",
42
42
  "test:ui": "vitest --ui --api 9527",
@@ -56,9 +56,9 @@
56
56
  "eslint": ">=9"
57
57
  },
58
58
  "dependencies": {
59
- "@typescript-eslint/utils": "^8.8.0",
59
+ "@typescript-eslint/utils": "^8.45.0",
60
60
  "eslint-flat-config-utils": "^0.4.0",
61
- "eslint-plugin-import-x": "^4.3.1",
61
+ "eslint-plugin-import-x": "^4.16.1",
62
62
  "picomatch": "^2.3.1"
63
63
  },
64
64
  "devDependencies": {
@@ -67,7 +67,8 @@
67
67
  "@types/eslint": "^9.6.1",
68
68
  "@types/node": "^20.4.2",
69
69
  "@types/picomatch": "^2.3.0",
70
- "@typescript-eslint/parser": "^8.8.0",
70
+ "@typescript-eslint/parser": "^8.45.0",
71
+ "@typescript-eslint/rule-tester": "^8.45.0",
71
72
  "@vitest/coverage-v8": "^0.33.0",
72
73
  "@vitest/ui": "^0.33.0",
73
74
  "conventional-changelog-cli": "^2.2.2",
@@ -78,7 +79,7 @@
78
79
  "prompts": "^2.4.2",
79
80
  "rimraf": "^5.0.1",
80
81
  "semver": "^7.5.4",
81
- "tsup": "^8.3.0",
82
+ "tsup": "^8.5.0",
82
83
  "typescript": "^5.6.2",
83
84
  "vitepress": "^1.0.0-alpha.64",
84
85
  "vitest": "^0.33.0"