@conarti/eslint-plugin-feature-sliced
Version:
Feature-sliced design methodology plugin
35 lines (34 loc) • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.reportLayersPublicApiNotAllowed = exports.reportShouldBeFromPublicApi = void 0;
const feature_sliced_1 = require("../../../lib/feature-sliced");
const rule_1 = require("../../../lib/rule");
const convert_to_public_api_1 = require("./convert-to-public-api");
function reportShouldBeFromPublicApi(node, context) {
const pathsInfo = (0, feature_sliced_1.extractPathsInfo)(node, context);
const [fixedPath, valueToRemove] = (0, convert_to_public_api_1.convertToPublicApi)(pathsInfo);
context.report({
node: node.source,
messageId: "should-be-from-public-api",
data: {
fixedPath,
},
suggest: [
{
messageId: "remove-suggestion",
data: {
valueToRemove,
},
fix: (fixer) => fixer.replaceTextRange((0, rule_1.getSourceRangeWithoutQuotes)(node.source.range), fixedPath),
},
],
});
}
exports.reportShouldBeFromPublicApi = reportShouldBeFromPublicApi;
function reportLayersPublicApiNotAllowed(node, context) {
context.report({
node,
messageId: "layers-public-api-not-allowed",
});
}
exports.reportLayersPublicApiNotAllowed = reportLayersPublicApiNotAllowed;