UNPKG

@conarti/eslint-plugin-feature-sliced

Version:
56 lines (55 loc) 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const rule_1 = require("../../lib/rule"); const model_1 = require("./model"); exports.default = (0, rule_1.createRule)({ name: 'layers-slices', meta: { type: 'problem', docs: { description: 'Checks layer imports', }, messages: { ["can-not-import"]: 'You cannot import layer "{{ importLayer }}" into "{{ currentFileLayer }}" (shared -> entities -> features -> widgets -> pages -> processes -> app)', }, schema: [ { type: 'object', properties: { allowTypeImports: { type: 'boolean', }, ignorePatterns: { type: 'array', items: { type: 'string', }, }, ignoreInFilesPatterns: { type: 'array', items: { type: 'string', }, }, }, }, ], }, defaultOptions: [ { allowTypeImports: true, ignorePatterns: [], ignoreInFilesPatterns: [], }, ], create(context, optionsWithDefault) { return { ImportDeclaration(node) { (0, model_1.validateAndReport)(node, context, optionsWithDefault); }, ImportExpression(node) { (0, model_1.validateAndReport)(node, context, optionsWithDefault); }, }; }, });