@conarti/eslint-plugin-feature-sliced
Version:
Feature-sliced design methodology plugin
22 lines (21 loc) • 833 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.shouldBeRelative = void 0;
const path_1 = require("../../../lib/path");
function shouldBeRelative(pathsInfo) {
const { validatedFeatureSlicedPartsOfCurrentFile, normalizedTargetPath, isSameLayerWithoutSlices, isSameLayer, isSameSlice, } = pathsInfo;
const isRelative = (0, path_1.isPathRelative)(normalizedTargetPath);
if (isRelative) {
return false;
}
const isImportToLayerPublicApi = validatedFeatureSlicedPartsOfCurrentFile.hasNotSlice && isSameLayer;
if (isImportToLayerPublicApi) {
return true;
}
if (isSameLayerWithoutSlices) {
return true;
}
const isSameLayerAndSlice = isSameLayer && isSameSlice;
return isSameLayerAndSlice;
}
exports.shouldBeRelative = shouldBeRelative;