@conarti/eslint-plugin-feature-sliced 1.0.4 → 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 (78) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/config.js +27 -27
  3. package/dist/configs/import-order/index.js +20 -20
  4. package/dist/configs/import-order/recommended.js +28 -28
  5. package/dist/configs/import-order/with-newlines-and-type-group.js +28 -28
  6. package/dist/configs/import-order/with-newlines.js +28 -28
  7. package/dist/configs/import-order/with-type-group.js +28 -28
  8. package/dist/configs/recommended.js +11 -11
  9. package/dist/configs/rules.js +11 -11
  10. package/dist/index.js +24 -24
  11. package/dist/lib/{fsd-lib → feature-sliced}/extract-feature-sliced-parts.js +18 -18
  12. package/dist/lib/{fsd-lib → feature-sliced}/extract-layer.js +21 -21
  13. package/dist/lib/{fsd-lib → feature-sliced}/extract-paths-info.js +59 -59
  14. package/dist/lib/{fsd-lib → feature-sliced}/extract-segment.js +18 -18
  15. package/dist/lib/{fsd-lib → feature-sliced}/extract-slice.js +10 -10
  16. package/dist/lib/{fsd-lib → feature-sliced}/index.js +10 -10
  17. package/dist/lib/{fsd-lib → feature-sliced}/layers.js +16 -16
  18. package/dist/lib/{fsd-lib → feature-sliced}/validate-extracted-feature-sliced-parts.js +29 -29
  19. package/dist/lib/{path-lib → path}/convert-to-absolute.js +18 -18
  20. package/dist/lib/{path-lib → path}/index.js +9 -9
  21. package/dist/lib/{path-lib → path}/is-path-relative.js +7 -7
  22. package/dist/lib/{path-lib → path}/join-path.js +12 -12
  23. package/dist/lib/{path-lib → path}/normalize-path.js +19 -19
  24. package/dist/lib/{rule-lib → rule}/create-rule.js +7 -7
  25. package/dist/lib/{rule-lib → rule}/extract-current-file-path.js +11 -11
  26. package/dist/lib/{rule-lib → rule}/extract-cwd.js +13 -13
  27. package/dist/lib/{rule-lib → rule}/extract-node-path.js +13 -13
  28. package/dist/lib/rule/extract-paths.js +21 -0
  29. package/dist/lib/{rule-lib → rule}/extract-rule-options.js +7 -7
  30. package/dist/lib/{rule-lib → rule}/get-source-range-without-quotes.js +7 -7
  31. package/dist/lib/{rule-lib/can-validate.js → rule/has-path.js} +11 -11
  32. package/dist/lib/{rule-lib → rule}/index.js +27 -23
  33. package/dist/lib/{rule-lib → rule}/is-ignored-current-file.js +12 -12
  34. package/dist/lib/rule/is-ignored-target.js +12 -0
  35. package/dist/lib/{rule-lib → rule}/is-ignored.js +12 -12
  36. package/dist/lib/rule/is-node-type.js +16 -0
  37. package/dist/lib/{rule-lib → rule}/models.js +2 -2
  38. package/dist/lib/shared/get-by-reg-exp.js +12 -12
  39. package/dist/lib/shared/index.js +11 -11
  40. package/dist/lib/shared/is-null.js +7 -7
  41. package/dist/lib/shared/is-object.js +7 -7
  42. package/dist/lib/shared/is-undefined.js +7 -7
  43. package/dist/rules/absolute-relative/config.js +2 -2
  44. package/dist/rules/absolute-relative/index.js +51 -52
  45. package/dist/rules/absolute-relative/model/{errors-lib.js → errors.js} +17 -17
  46. package/dist/rules/absolute-relative/model/index.js +5 -5
  47. package/dist/rules/absolute-relative/model/should-be-absolute.js +16 -16
  48. package/dist/rules/absolute-relative/model/should-be-relative.js +21 -21
  49. package/dist/rules/absolute-relative/model/validate-and-report.js +24 -24
  50. package/dist/rules/layers-slices/config.js +2 -2
  51. package/dist/rules/layers-slices/index.js +55 -56
  52. package/dist/rules/layers-slices/model/{errors-lib.js → errors.js} +22 -14
  53. package/dist/rules/layers-slices/model/index.js +5 -5
  54. package/dist/rules/layers-slices/model/is-not-suitable-for-validation.js +17 -0
  55. package/dist/rules/layers-slices/model/specifiers/extract-import-specifiers.js +8 -0
  56. package/dist/rules/layers-slices/model/specifiers/has-errors-at-all-specifiers.js +9 -0
  57. package/dist/rules/layers-slices/model/specifiers/index.js +7 -0
  58. package/dist/rules/layers-slices/model/specifiers/validate-specifiers.js +8 -0
  59. package/dist/rules/layers-slices/model/validate-and-report.js +46 -22
  60. package/dist/rules/layers-slices/model/validate-node/index.js +16 -0
  61. package/dist/rules/layers-slices/model/validate-node/valid-by-layer-order.js +10 -0
  62. package/dist/rules/layers-slices/model/validate-node/valid-by-type-import.js +9 -0
  63. package/dist/rules/public-api/config.js +2 -2
  64. package/dist/rules/public-api/index.js +65 -65
  65. package/dist/rules/public-api/model/convert-to-public-api.js +24 -24
  66. package/dist/rules/public-api/model/{errors-lib.js → errors.js} +34 -34
  67. package/dist/rules/public-api/model/index.js +5 -5
  68. package/dist/rules/public-api/model/is-index-file.js +7 -7
  69. package/dist/rules/public-api/model/is-layer-public-api.js +23 -23
  70. package/dist/rules/public-api/model/is-segments-public-api.js +11 -11
  71. package/dist/rules/public-api/model/is-slice-public-api.js +7 -7
  72. package/dist/rules/public-api/model/should-be-from-public-api.js +21 -21
  73. package/dist/rules/public-api/model/validate-and-report-program.js +15 -15
  74. package/dist/rules/public-api/model/validate-and-report.js +18 -18
  75. package/package.json +15 -14
  76. package/dist/lib/fsd-lib/extract-paths.js +0 -19
  77. package/dist/lib/rule-lib/is-node-type.js +0 -17
  78. package/dist/rules/layers-slices/model/can-import-layer.js +0 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conarti/eslint-plugin-feature-sliced",
3
- "version": "1.0.4",
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;