@conarti/eslint-plugin-feature-sliced 1.0.3 → 1.0.5

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 (79) hide show
  1. package/CHANGELOG.md +36 -18
  2. package/README.md +132 -142
  3. package/dist/config.js +27 -27
  4. package/dist/configs/import-order/index.js +20 -20
  5. package/dist/configs/import-order/recommended.js +28 -28
  6. package/dist/configs/import-order/with-newlines-and-type-group.js +28 -28
  7. package/dist/configs/import-order/with-newlines.js +28 -28
  8. package/dist/configs/import-order/with-type-group.js +28 -28
  9. package/dist/configs/recommended.js +11 -11
  10. package/dist/configs/rules.js +11 -11
  11. package/dist/index.js +24 -24
  12. package/dist/lib/{fsd-lib → feature-sliced}/extract-feature-sliced-parts.js +18 -18
  13. package/dist/lib/{fsd-lib → feature-sliced}/extract-layer.js +21 -21
  14. package/dist/lib/{fsd-lib → feature-sliced}/extract-paths-info.js +59 -59
  15. package/dist/lib/{fsd-lib → feature-sliced}/extract-segment.js +18 -18
  16. package/dist/lib/{fsd-lib → feature-sliced}/extract-slice.js +10 -10
  17. package/dist/lib/{fsd-lib → feature-sliced}/index.js +10 -10
  18. package/dist/lib/{fsd-lib → feature-sliced}/layers.js +16 -16
  19. package/dist/lib/{fsd-lib → feature-sliced}/validate-extracted-feature-sliced-parts.js +29 -29
  20. package/dist/lib/{path-lib → path}/convert-to-absolute.js +18 -18
  21. package/dist/lib/{path-lib → path}/index.js +9 -9
  22. package/dist/lib/{path-lib → path}/is-path-relative.js +7 -7
  23. package/dist/lib/{path-lib → path}/join-path.js +12 -12
  24. package/dist/lib/{path-lib → path}/normalize-path.js +19 -19
  25. package/dist/lib/{rule-lib → rule}/create-rule.js +7 -7
  26. package/dist/lib/{rule-lib → rule}/extract-current-file-path.js +11 -11
  27. package/dist/lib/{rule-lib → rule}/extract-cwd.js +13 -13
  28. package/dist/lib/{rule-lib → rule}/extract-node-path.js +13 -13
  29. package/dist/lib/rule/extract-paths.js +21 -0
  30. package/dist/lib/{rule-lib → rule}/extract-rule-options.js +7 -7
  31. package/dist/lib/{rule-lib → rule}/get-source-range-without-quotes.js +7 -7
  32. package/dist/lib/{rule-lib/can-validate.js → rule/has-path.js} +11 -11
  33. package/dist/lib/{rule-lib → rule}/index.js +27 -23
  34. package/dist/lib/{rule-lib → rule}/is-ignored-current-file.js +12 -12
  35. package/dist/lib/rule/is-ignored-target.js +12 -0
  36. package/dist/lib/{rule-lib → rule}/is-ignored.js +12 -12
  37. package/dist/lib/rule/is-node-type.js +16 -0
  38. package/dist/lib/{rule-lib → rule}/models.js +2 -2
  39. package/dist/lib/shared/get-by-reg-exp.js +12 -12
  40. package/dist/lib/shared/index.js +11 -11
  41. package/dist/lib/shared/is-null.js +7 -7
  42. package/dist/lib/shared/is-object.js +7 -7
  43. package/dist/lib/shared/is-undefined.js +7 -7
  44. package/dist/rules/absolute-relative/config.js +2 -2
  45. package/dist/rules/absolute-relative/index.js +51 -52
  46. package/dist/rules/absolute-relative/model/{errors-lib.js → errors.js} +17 -17
  47. package/dist/rules/absolute-relative/model/index.js +5 -5
  48. package/dist/rules/absolute-relative/model/should-be-absolute.js +16 -16
  49. package/dist/rules/absolute-relative/model/should-be-relative.js +21 -21
  50. package/dist/rules/absolute-relative/model/validate-and-report.js +24 -24
  51. package/dist/rules/layers-slices/config.js +2 -2
  52. package/dist/rules/layers-slices/index.js +55 -56
  53. package/dist/rules/layers-slices/model/{errors-lib.js → errors.js} +22 -14
  54. package/dist/rules/layers-slices/model/index.js +5 -5
  55. package/dist/rules/layers-slices/model/is-not-suitable-for-validation.js +17 -0
  56. package/dist/rules/layers-slices/model/specifiers/extract-import-specifiers.js +8 -0
  57. package/dist/rules/layers-slices/model/specifiers/has-errors-at-all-specifiers.js +9 -0
  58. package/dist/rules/layers-slices/model/specifiers/index.js +7 -0
  59. package/dist/rules/layers-slices/model/specifiers/validate-specifiers.js +8 -0
  60. package/dist/rules/layers-slices/model/validate-and-report.js +46 -22
  61. package/dist/rules/layers-slices/model/validate-node/index.js +16 -0
  62. package/dist/rules/layers-slices/model/validate-node/valid-by-layer-order.js +10 -0
  63. package/dist/rules/layers-slices/model/validate-node/valid-by-type-import.js +9 -0
  64. package/dist/rules/public-api/config.js +2 -2
  65. package/dist/rules/public-api/index.js +65 -65
  66. package/dist/rules/public-api/model/convert-to-public-api.js +24 -24
  67. package/dist/rules/public-api/model/{errors-lib.js → errors.js} +34 -34
  68. package/dist/rules/public-api/model/index.js +5 -5
  69. package/dist/rules/public-api/model/is-index-file.js +7 -7
  70. package/dist/rules/public-api/model/is-layer-public-api.js +23 -23
  71. package/dist/rules/public-api/model/is-segments-public-api.js +11 -11
  72. package/dist/rules/public-api/model/is-slice-public-api.js +7 -7
  73. package/dist/rules/public-api/model/should-be-from-public-api.js +21 -21
  74. package/dist/rules/public-api/model/validate-and-report-program.js +15 -15
  75. package/dist/rules/public-api/model/validate-and-report.js +18 -18
  76. package/package.json +15 -14
  77. package/dist/lib/fsd-lib/extract-paths.js +0 -19
  78. package/dist/lib/rule-lib/is-node-type.js +0 -17
  79. package/dist/rules/layers-slices/model/can-import-layer.js +0 -22
@@ -1,24 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertToPublicApi = void 0;
4
- const shared_1 = require("../../../lib/shared");
5
- function addSlashToStart(targetPath) {
6
- if ((0, shared_1.isNull)(targetPath)) {
7
- return '';
8
- }
9
- return `/${targetPath}`;
10
- }
11
- function extractValueToRemove(pathsInfo) {
12
- const { isSameSlice, fsdPartsOfTarget, } = pathsInfo;
13
- if (isSameSlice) {
14
- return fsdPartsOfTarget.segmentFiles;
15
- }
16
- return `${fsdPartsOfTarget.segment}${addSlashToStart(fsdPartsOfTarget.segmentFiles)}`;
17
- }
18
- function convertToPublicApi(pathsInfo) {
19
- const { normalizedTargetPath } = pathsInfo;
20
- const valueToRemove = extractValueToRemove(pathsInfo);
21
- const publicApiPath = normalizedTargetPath.replace(`/${valueToRemove}`, '');
22
- return [publicApiPath, valueToRemove];
23
- }
24
- exports.convertToPublicApi = convertToPublicApi;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToPublicApi = void 0;
4
+ const shared_1 = require("../../../lib/shared");
5
+ function addSlashToStart(targetPath) {
6
+ if ((0, shared_1.isNull)(targetPath)) {
7
+ return '';
8
+ }
9
+ return `/${targetPath}`;
10
+ }
11
+ function extractValueToRemove(pathsInfo) {
12
+ const { isSameSlice, fsdPartsOfTarget, } = pathsInfo;
13
+ if (isSameSlice) {
14
+ return fsdPartsOfTarget.segmentFiles;
15
+ }
16
+ return `${fsdPartsOfTarget.segment}${addSlashToStart(fsdPartsOfTarget.segmentFiles)}`;
17
+ }
18
+ function convertToPublicApi(pathsInfo) {
19
+ const { normalizedTargetPath } = pathsInfo;
20
+ const valueToRemove = extractValueToRemove(pathsInfo);
21
+ const publicApiPath = normalizedTargetPath.replace(`/${valueToRemove}`, '');
22
+ return [publicApiPath, valueToRemove];
23
+ }
24
+ exports.convertToPublicApi = convertToPublicApi;
@@ -1,34 +1,34 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reportLayersPublicApiNotAllowed = exports.reportShouldBeFromPublicApi = void 0;
4
- const fsd_lib_1 = require("../../../lib/fsd-lib");
5
- const rule_lib_1 = require("../../../lib/rule-lib");
6
- const convert_to_public_api_1 = require("./convert-to-public-api");
7
- function reportShouldBeFromPublicApi(node, context) {
8
- const pathsInfo = (0, fsd_lib_1.extractPathsInfo)(node, context);
9
- const [fixedPath, valueToRemove] = (0, convert_to_public_api_1.convertToPublicApi)(pathsInfo);
10
- context.report({
11
- node: node.source,
12
- messageId: "should-be-from-public-api",
13
- data: {
14
- fixedPath,
15
- },
16
- suggest: [
17
- {
18
- messageId: "remove-suggestion",
19
- data: {
20
- valueToRemove,
21
- },
22
- fix: (fixer) => fixer.replaceTextRange((0, rule_lib_1.getSourceRangeWithoutQuotes)(node.source.range), fixedPath),
23
- },
24
- ],
25
- });
26
- }
27
- exports.reportShouldBeFromPublicApi = reportShouldBeFromPublicApi;
28
- function reportLayersPublicApiNotAllowed(node, context) {
29
- context.report({
30
- node,
31
- messageId: "layers-public-api-not-allowed",
32
- });
33
- }
34
- exports.reportLayersPublicApiNotAllowed = reportLayersPublicApiNotAllowed;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reportLayersPublicApiNotAllowed = exports.reportShouldBeFromPublicApi = void 0;
4
+ const feature_sliced_1 = require("../../../lib/feature-sliced");
5
+ const rule_1 = require("../../../lib/rule");
6
+ const convert_to_public_api_1 = require("./convert-to-public-api");
7
+ function reportShouldBeFromPublicApi(node, context) {
8
+ const pathsInfo = (0, feature_sliced_1.extractPathsInfo)(node, context);
9
+ const [fixedPath, valueToRemove] = (0, convert_to_public_api_1.convertToPublicApi)(pathsInfo);
10
+ context.report({
11
+ node: node.source,
12
+ messageId: "should-be-from-public-api",
13
+ data: {
14
+ fixedPath,
15
+ },
16
+ suggest: [
17
+ {
18
+ messageId: "remove-suggestion",
19
+ data: {
20
+ valueToRemove,
21
+ },
22
+ fix: (fixer) => fixer.replaceTextRange((0, rule_1.getSourceRangeWithoutQuotes)(node.source.range), fixedPath),
23
+ },
24
+ ],
25
+ });
26
+ }
27
+ exports.reportShouldBeFromPublicApi = reportShouldBeFromPublicApi;
28
+ function reportLayersPublicApiNotAllowed(node, context) {
29
+ context.report({
30
+ node,
31
+ messageId: "layers-public-api-not-allowed",
32
+ });
33
+ }
34
+ exports.reportLayersPublicApiNotAllowed = reportLayersPublicApiNotAllowed;
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateAndReport = void 0;
4
- var validate_and_report_1 = require("./validate-and-report");
5
- Object.defineProperty(exports, "validateAndReport", { enumerable: true, get: function () { return validate_and_report_1.validateAndReport; } });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateAndReport = void 0;
4
+ var validate_and_report_1 = require("./validate-and-report");
5
+ Object.defineProperty(exports, "validateAndReport", { enumerable: true, get: function () { return validate_and_report_1.validateAndReport; } });
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isIndexFile = void 0;
4
- function isIndexFile(segmentFiles) {
5
- return /^index\.\w+/i.test(segmentFiles);
6
- }
7
- exports.isIndexFile = isIndexFile;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIndexFile = void 0;
4
+ function isIndexFile(segmentFiles) {
5
+ return /^index\.\w+/i.test(segmentFiles);
6
+ }
7
+ exports.isIndexFile = isIndexFile;
@@ -1,23 +1,23 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isLayerPublicApi = void 0;
7
- const picomatch_1 = __importDefault(require("picomatch"));
8
- const fsd_lib_1 = require("../../../lib/fsd-lib");
9
- const rule_lib_1 = require("../../../lib/rule-lib");
10
- const shared_1 = require("../../../lib/shared");
11
- function isLayerPublicApi(context) {
12
- const normalizedCurrentFilePath = (0, rule_lib_1.extractCurrentFilePath)(context);
13
- const cwd = (0, rule_lib_1.extractCwd)(context);
14
- const layer = (0, fsd_lib_1.extractLayer)(normalizedCurrentFilePath, cwd);
15
- if ((0, shared_1.isNull)(layer)) {
16
- return false;
17
- }
18
- const matcher = (0, picomatch_1.default)([
19
- `**/${layer}/index.*`,
20
- ]);
21
- return matcher(normalizedCurrentFilePath);
22
- }
23
- exports.isLayerPublicApi = isLayerPublicApi;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isLayerPublicApi = void 0;
7
+ const picomatch_1 = __importDefault(require("picomatch"));
8
+ const feature_sliced_1 = require("../../../lib/feature-sliced");
9
+ const rule_1 = require("../../../lib/rule");
10
+ const shared_1 = require("../../../lib/shared");
11
+ function isLayerPublicApi(context) {
12
+ const normalizedCurrentFilePath = (0, rule_1.extractCurrentFilePath)(context);
13
+ const cwd = (0, rule_1.extractCwd)(context);
14
+ const layer = (0, feature_sliced_1.extractLayer)(normalizedCurrentFilePath, cwd);
15
+ if ((0, shared_1.isNull)(layer)) {
16
+ return false;
17
+ }
18
+ const matcher = (0, picomatch_1.default)([
19
+ `**/${layer}/index.*`,
20
+ ]);
21
+ return matcher(normalizedCurrentFilePath);
22
+ }
23
+ exports.isLayerPublicApi = isLayerPublicApi;
@@ -1,11 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSegmentsPublicApi = void 0;
4
- const is_index_file_1 = require("./is-index-file");
5
- function isSegmentsPublicApi(pathsInfo) {
6
- const { fsdPartsOfTarget, validatedFeatureSlicedPartsOfTarget, isSameSegment, } = pathsInfo;
7
- const isSegmentPublicApi = validatedFeatureSlicedPartsOfTarget.hasNotSegmentFiles
8
- || (0, is_index_file_1.isIndexFile)(fsdPartsOfTarget.segmentFiles);
9
- return isSameSegment || isSegmentPublicApi;
10
- }
11
- exports.isSegmentsPublicApi = isSegmentsPublicApi;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSegmentsPublicApi = void 0;
4
+ const is_index_file_1 = require("./is-index-file");
5
+ function isSegmentsPublicApi(pathsInfo) {
6
+ const { fsdPartsOfTarget, validatedFeatureSlicedPartsOfTarget, isSameSegment, } = pathsInfo;
7
+ const isSegmentPublicApi = validatedFeatureSlicedPartsOfTarget.hasNotSegmentFiles
8
+ || (0, is_index_file_1.isIndexFile)(fsdPartsOfTarget.segmentFiles);
9
+ return isSameSegment || isSegmentPublicApi;
10
+ }
11
+ exports.isSegmentsPublicApi = isSegmentsPublicApi;
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSlicePublicApi = void 0;
4
- function isSlicePublicApi(pathsInfo) {
5
- return pathsInfo.validatedFeatureSlicedPartsOfTarget.hasNotSegment;
6
- }
7
- exports.isSlicePublicApi = isSlicePublicApi;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSlicePublicApi = void 0;
4
+ function isSlicePublicApi(pathsInfo) {
5
+ return pathsInfo.validatedFeatureSlicedPartsOfTarget.hasNotSegment;
6
+ }
7
+ exports.isSlicePublicApi = isSlicePublicApi;
@@ -1,21 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shouldBeFromPublicApi = void 0;
4
- const fsd_lib_1 = require("../../../lib/fsd-lib");
5
- const rule_lib_1 = require("../../../lib/rule-lib");
6
- const is_segments_public_api_1 = require("./is-segments-public-api");
7
- const is_slice_public_api_1 = require("./is-slice-public-api");
8
- function shouldBeFromSlicePublicApi(pathsInfo) {
9
- const isFromAnotherSlice = !pathsInfo.isSameSlice;
10
- return isFromAnotherSlice && !(0, is_slice_public_api_1.isSlicePublicApi)(pathsInfo);
11
- }
12
- function shouldBeFromSegmentsPublicApi(pathsInfo, validateOptions) {
13
- const needValidateSegments = validateOptions.level === "segments";
14
- return needValidateSegments && !(0, is_segments_public_api_1.isSegmentsPublicApi)(pathsInfo);
15
- }
16
- function shouldBeFromPublicApi(node, context, optionsWithDefault) {
17
- const pathsInfo = (0, fsd_lib_1.extractPathsInfo)(node, context);
18
- const ruleOptions = (0, rule_lib_1.extractRuleOptions)(optionsWithDefault);
19
- return shouldBeFromSlicePublicApi(pathsInfo) || shouldBeFromSegmentsPublicApi(pathsInfo, ruleOptions);
20
- }
21
- exports.shouldBeFromPublicApi = shouldBeFromPublicApi;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldBeFromPublicApi = void 0;
4
+ const feature_sliced_1 = require("../../../lib/feature-sliced");
5
+ const rule_1 = require("../../../lib/rule");
6
+ const is_segments_public_api_1 = require("./is-segments-public-api");
7
+ const is_slice_public_api_1 = require("./is-slice-public-api");
8
+ function shouldBeFromSlicePublicApi(pathsInfo) {
9
+ const isFromAnotherSlice = !pathsInfo.isSameSlice;
10
+ return isFromAnotherSlice && !(0, is_slice_public_api_1.isSlicePublicApi)(pathsInfo);
11
+ }
12
+ function shouldBeFromSegmentsPublicApi(pathsInfo, validateOptions) {
13
+ const needValidateSegments = validateOptions.level === "segments";
14
+ return needValidateSegments && !(0, is_segments_public_api_1.isSegmentsPublicApi)(pathsInfo);
15
+ }
16
+ function shouldBeFromPublicApi(node, context, optionsWithDefault) {
17
+ const pathsInfo = (0, feature_sliced_1.extractPathsInfo)(node, context);
18
+ const ruleOptions = (0, rule_1.extractRuleOptions)(optionsWithDefault);
19
+ return shouldBeFromSlicePublicApi(pathsInfo) || shouldBeFromSegmentsPublicApi(pathsInfo, ruleOptions);
20
+ }
21
+ exports.shouldBeFromPublicApi = shouldBeFromPublicApi;
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateAndReportProgram = void 0;
4
- const rule_lib_1 = require("../../../lib/rule-lib");
5
- const errors_lib_1 = require("./errors-lib");
6
- const is_layer_public_api_1 = require("./is-layer-public-api");
7
- function validateAndReportProgram(node, context, optionsWithDefault) {
8
- if ((0, rule_lib_1.isIgnoredCurrentFile)(context, optionsWithDefault)) {
9
- return;
10
- }
11
- if ((0, is_layer_public_api_1.isLayerPublicApi)(context)) {
12
- (0, errors_lib_1.reportLayersPublicApiNotAllowed)(node, context);
13
- }
14
- }
15
- exports.validateAndReportProgram = validateAndReportProgram;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateAndReportProgram = void 0;
4
+ const rule_1 = require("../../../lib/rule");
5
+ const errors_1 = require("./errors");
6
+ const is_layer_public_api_1 = require("./is-layer-public-api");
7
+ function validateAndReportProgram(node, context, optionsWithDefault) {
8
+ if ((0, rule_1.isIgnoredCurrentFile)(context, optionsWithDefault)) {
9
+ return;
10
+ }
11
+ if ((0, is_layer_public_api_1.isLayerPublicApi)(context)) {
12
+ (0, errors_1.reportLayersPublicApiNotAllowed)(node, context);
13
+ }
14
+ }
15
+ exports.validateAndReportProgram = validateAndReportProgram;
@@ -1,18 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateAndReport = void 0;
4
- const rule_lib_1 = require("../../../lib/rule-lib");
5
- const errors_lib_1 = require("./errors-lib");
6
- const should_be_from_public_api_1 = require("./should-be-from-public-api");
7
- function validateAndReport(node, context, optionsWithDefault) {
8
- if (!(0, rule_lib_1.canValidate)(node)) {
9
- return;
10
- }
11
- if ((0, rule_lib_1.isIgnoredCurrentFile)(context, optionsWithDefault)) {
12
- return;
13
- }
14
- if ((0, should_be_from_public_api_1.shouldBeFromPublicApi)(node, context, optionsWithDefault)) {
15
- (0, errors_lib_1.reportShouldBeFromPublicApi)(node, context);
16
- }
17
- }
18
- exports.validateAndReport = validateAndReport;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateAndReport = void 0;
4
+ const rule_1 = require("../../../lib/rule");
5
+ const errors_1 = require("./errors");
6
+ const should_be_from_public_api_1 = require("./should-be-from-public-api");
7
+ function validateAndReport(node, context, optionsWithDefault) {
8
+ if (!(0, rule_1.hasPath)(node)) {
9
+ return;
10
+ }
11
+ if ((0, rule_1.isIgnoredCurrentFile)(context, optionsWithDefault)) {
12
+ return;
13
+ }
14
+ if ((0, should_be_from_public_api_1.shouldBeFromPublicApi)(node, context, optionsWithDefault)) {
15
+ (0, errors_1.reportShouldBeFromPublicApi)(node, context);
16
+ }
17
+ }
18
+ exports.validateAndReport = validateAndReport;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conarti/eslint-plugin-feature-sliced",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Feature-sliced design methodology plugin",
5
5
  "repository": "https://github.com/conarti/eslint-plugin-fsd.git",
6
6
  "keywords": [
@@ -43,34 +43,35 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@total-typescript/ts-reset": "^0.4.2",
46
- "@tsconfig/node14": "^1.0.3",
47
- "@types/eslint": "^8.40.2",
48
- "@types/node": "^20.2.5",
46
+ "@tsconfig/node14": "^14.1.0",
47
+ "@types/eslint": "^8.44.0",
48
+ "@types/node": "^20.4.2",
49
49
  "@types/picomatch": "^2.3.0",
50
- "@typescript-eslint/eslint-plugin": "^5.59.9",
51
- "@typescript-eslint/parser": "^5.53.0",
52
- "@typescript-eslint/utils": "^5.59.9",
53
- "@vitest/coverage-v8": "^0.32.0",
54
- "@vitest/ui": "^0.32.0",
50
+ "@typescript-eslint/eslint-plugin": "^6.1.0",
51
+ "@typescript-eslint/parser": "^6.1.0",
52
+ "@typescript-eslint/utils": "^6.1.0",
53
+ "@vitest/coverage-v8": "^0.33.0",
54
+ "@vitest/ui": "^0.33.0",
55
55
  "conventional-changelog-cli": "^2.2.2",
56
- "eslint": "^8.42.0",
56
+ "eslint": "^8.45.0",
57
57
  "eslint-config-airbnb-base": "^15.0.0",
58
58
  "eslint-import-resolver-typescript": "^3.5.5",
59
- "eslint-plugin-eslint-plugin": "^5.0.0",
59
+ "eslint-plugin-eslint-plugin": "^5.1.1",
60
60
  "eslint-plugin-filenames-simple": "^0.8.0",
61
61
  "eslint-plugin-import": "^2.27.5",
62
+ "eslint-plugin-modules-newlines": "^0.0.7",
62
63
  "eslint-plugin-node": "^11.1.0",
63
- "eslint-plugin-unused-imports": "^2.0.0",
64
+ "eslint-plugin-unused-imports": "^3.0.0",
64
65
  "eslint-plugin-vitest": "^0.2.6",
65
66
  "execa": "5.1.1",
66
67
  "npm-run-all": "^4.1.5",
67
68
  "picocolors": "^1.0.0",
68
69
  "prompts": "^2.4.2",
69
70
  "rimraf": "^5.0.1",
70
- "semver": "^7.3.8",
71
+ "semver": "^7.5.4",
71
72
  "typescript": "^4.9.5",
72
73
  "vitepress": "^1.0.0-alpha.64",
73
- "vitest": "^0.32.0"
74
+ "vitest": "^0.33.0"
74
75
  },
75
76
  "engines": {
76
77
  "node": "^14.17.0 || ^16.0.0 || >= 18.0.0"
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractPaths = void 0;
4
- const path_lib_1 = require("../path-lib");
5
- const rule_lib_1 = require("../rule-lib");
6
- function extractPaths(node, context) {
7
- const normalizedCurrentFilePath = (0, rule_lib_1.extractCurrentFilePath)(context);
8
- const { targetPath, normalizedTargetPath, } = (0, rule_lib_1.extractNodePath)(node);
9
- const absoluteTargetPath = (0, path_lib_1.convertToAbsolute)(normalizedCurrentFilePath, normalizedTargetPath);
10
- const cwd = (0, rule_lib_1.extractCwd)(context);
11
- return {
12
- targetPath,
13
- normalizedTargetPath,
14
- normalizedCurrentFilePath,
15
- absoluteTargetPath,
16
- normalizedCwd: cwd,
17
- };
18
- }
19
- exports.extractPaths = extractPaths;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNodeType = void 0;
4
- const types_1 = require("@typescript-eslint/types");
5
- function isNodeType(node) {
6
- const isImport = node.type === types_1.AST_NODE_TYPES.ImportDeclaration;
7
- const isExport = node.type === types_1.AST_NODE_TYPES.ExportAllDeclaration
8
- || node.type === types_1.AST_NODE_TYPES.ExportNamedDeclaration;
9
- if (isImport) {
10
- return node.importKind === 'type';
11
- }
12
- if (isExport) {
13
- return node.exportKind === 'type';
14
- }
15
- return false;
16
- }
17
- exports.isNodeType = isNodeType;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.canImportLayer = void 0;
4
- const fsd_lib_1 = require("../../../lib/fsd-lib");
5
- const rule_lib_1 = require("../../../lib/rule-lib");
6
- function canImportLayer(pathsInfo, node, ruleOptions) {
7
- const { fsdPartsOfTarget, fsdPartsOfCurrentFile, isSameSlice, isSameLayerWithoutSlices, hasUnknownLayers, } = pathsInfo;
8
- if (hasUnknownLayers) {
9
- return true;
10
- }
11
- const { allowTypeImports } = ruleOptions;
12
- const isType = (0, rule_lib_1.isNodeType)(node);
13
- const isTypeAndAllowedToImport = allowTypeImports && isType;
14
- const importLayerOrder = (0, fsd_lib_1.getLayerWeight)(fsdPartsOfTarget.layer);
15
- const currentFileLayerOrder = (0, fsd_lib_1.getLayerWeight)(fsdPartsOfCurrentFile.layer);
16
- const isImportLayerBelowCurrent = currentFileLayerOrder > importLayerOrder;
17
- return isSameSlice
18
- || isTypeAndAllowedToImport
19
- || isSameLayerWithoutSlices
20
- || isImportLayerBelowCurrent;
21
- }
22
- exports.canImportLayer = canImportLayer;