How to use the @fimbul/ymir.DeprecationTarget.Rule function in @fimbul/ymir

To help you get started, we’ve selected a few @fimbul/ymir examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fimbullinter / wotan / packages / wotan / src / linter.ts View on Github external
private prepareRules(
        config: EffectiveConfiguration,
        sourceFile: ts.SourceFile,
        programFactory: ProgramFactory | undefined,
        noWarn: boolean,
    ) {
        const rules: PreparedRule[] = [];
        for (const [ruleName, {options, severity, rulesDirectories, rule}] of config.rules) {
            if (severity === 'off')
                continue;
            const ctor = this.ruleLoader.loadRule(rule, rulesDirectories);
            if (ctor === undefined)
                continue;
            if (ctor.deprecated)
                this.deprecationHandler.handle(
                    DeprecationTarget.Rule,
                    ruleName,
                    typeof ctor.deprecated === 'string' ? ctor.deprecated : undefined,
                );
            if (programFactory === undefined && ctor.requiresTypeInformation) {
                if (noWarn) {
                    log('Rule %s requires type information', ruleName);
                } else {
                    this.logger.warn(`Rule '${ruleName}' requires type information.`);
                }
                continue;
            }
            if (ctor.supports !== undefined) {
                const supports = ctor.supports(sourceFile, {
                    get program() { return programFactory && programFactory.getProgram(); },
                    get compilerOptions() { return programFactory && programFactory.getCompilerOptions(); },
                    options,