Skip to content

Commit

Permalink
Merge pull request #1131 from tcoliver/reorder-yaml-title-rules
Browse files Browse the repository at this point in the history
Fix: capitalize-headings, yaml-title, yaml-title-alias require two lint passes to resolve
  • Loading branch information
pjkaufman authored Aug 4, 2024
2 parents f7a5ada + e4e590b commit 616a83b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/rules-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {LintCommand} from './ui/linter-components/custom-command-option';
import {convertStringVersionOfEscapeCharactersToEscapeCharacters} from './utils/strings';
import {getTextInLanguage} from './lang/helpers';
import CapitalizeHeadings from './rules/capitalize-headings';
import YamlTitle from './rules/yaml-title';
import YamlTitleAlias from './rules/yaml-title-alias';
import BlockquoteStyle from './rules/blockquote-style';
import {IgnoreTypes, ignoreListOfTypes} from './utils/ignore-types';
import MoveMathBlockIndicatorsToOwnLine from './rules/move-math-block-indicators-to-own-line';
Expand Down Expand Up @@ -116,6 +118,18 @@ export class RulesRunner {
timingBegin(postRuleLogText);
[newText] = CapitalizeHeadings.applyIfEnabled(newText, runOptions.settings, this.disabledRules);

[newText] = YamlTitle.applyIfEnabled(newText, runOptions.settings, this.disabledRules, {
fileName: runOptions.fileInfo.name,
defaultEscapeCharacter: runOptions.settings.commonStyles.escapeCharacter,
});

[newText] = YamlTitleAlias.applyIfEnabled(newText, runOptions.settings, this.disabledRules, {
fileName: runOptions.fileInfo.name,
aliasArrayStyle: runOptions.settings.commonStyles.aliasArrayStyle,
defaultEscapeCharacter: runOptions.settings.commonStyles.escapeCharacter,
removeUnnecessaryEscapeCharsForMultiLineArrays: runOptions.settings.commonStyles.removeUnnecessaryEscapeCharsForMultiLineArrays,
});

[newText] = BlockquoteStyle.applyIfEnabled(newText, runOptions.settings, this.disabledRules);

[newText] = ForceYamlEscape.applyIfEnabled(newText, runOptions.settings, this.disabledRules, {
Expand Down
1 change: 1 addition & 0 deletions src/rules/yaml-title-alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class YamlTitleAlias extends RuleBuilder<YamlTitleAliasOptions> {
nameKey: 'rules.yaml-title-alias.name',
descriptionKey: 'rules.yaml-title-alias.description',
type: RuleType.YAML,
hasSpecialExecutionOrder: true, // this rule must run after capitalize-headings in order to update the alias correctly
});
}
get OptionsClass(): new () => YamlTitleAliasOptions {
Expand Down
1 change: 1 addition & 0 deletions src/rules/yaml-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default class YamlTitle extends RuleBuilder<YamlTitleOptions> {
nameKey: 'rules.yaml-title.name',
descriptionKey: 'rules.yaml-title.description',
type: RuleType.YAML,
hasSpecialExecutionOrder: true, // this rule must run after capitalize-headings in order to update the title correctly
});
}
get OptionsClass(): new () => YamlTitleOptions {
Expand Down

0 comments on commit 616a83b

Please sign in to comment.