UNPKG

eslint-plugin-obsidian

Version:

ESLint rules for Obsidian

53 lines 2.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stronglyTypedInjectComponentGenerator = void 0; const utils_1 = require("@typescript-eslint/utils"); const createRule_1 = require("./createRule"); const context_1 = require("../../dto/context"); const createRule = utils_1.ESLintUtils.RuleCreator((name) => `https://wix-incubator.github.io/obsidian/docs/documentation/meta/eslint#${name}`); const stronglyTypedInjectComponentGenerator = () => { return createRule({ create: (context, options) => { return (0, createRule_1.create)(new context_1.Context(context), options); }, name: 'strongly-typed-inject-component', meta: { docs: { description: 'Calling injectComponent without prop types is a bad practice and a common source of bugs.', recommended: 'strict', }, messages: { 'strongly-typed-inject-component': '{{message}}', }, schema: [ { type: 'object', properties: { injectedPropsPattern: { type: 'string', }, }, additionalProperties: false, }, { type: 'object', properties: { ownPropsPattern: { type: 'string', }, }, additionalProperties: false, }, ], type: 'problem', }, defaultOptions: [ { injectedPropsPattern: '/\\b(Injected|InjectedProps)\\b/', ownPropsPattern: '/\\b(Own|Props|OwnProps)\\b/', }, ], }); }; exports.stronglyTypedInjectComponentGenerator = stronglyTypedInjectComponentGenerator; //# sourceMappingURL=index.js.map