import type { ESLint } from 'eslint'; import noEmptyObjectLiteral from './no-empty-object-literal'; import noImportDot from './no-import-dot'; import noUselessImportAlias from './no-useless-import-alias'; import restrictTemplateExpressions from './restrict-template-expressions'; type RuleLevel = 'error' | 'warn' | 'off' | 0 | 1 | 2; type RuleEntry = RuleLevel | [RuleLevel, Partial]; export interface LocalRuleOptions { /** Bans import from the specifier '.' and '..' and replaces it with '.+/index' */ 'custom/no-import-dot': RuleEntry; /** * Enforce template literal expressions to be of `string` type * @see [restrict-template-expressions](https://typescript-eslint.io/rules/restrict-template-expressions) */ 'typed-custom/restrict-template-expressions': RuleEntry<{ allow: string[] }>; /** Ban assignment of empty object literals `{}` and replace them with `Object.create(null)` */ 'custom/no-empty-object-literal': RuleEntry; /** Ban useless import alias */ 'custom/no-useless-import-alias': RuleEntry; } export const plugin: ESLint.Plugin = { name: 'custom', rules: { 'no-empty-object-literal': noEmptyObjectLiteral, 'no-import-dot': noImportDot, 'no-useless-import-alias': noUselessImportAlias, }, }; export const typedPlugin: ESLint.Plugin = { name: 'typed-custom', rules: { // @ts-expect-error type mismatch 'restrict-template-expressions': restrictTemplateExpressions, }, };