Skip to content

Commit

Permalink
Load plugins when running linting commands.
Browse files Browse the repository at this point in the history
Close #705.
  • Loading branch information
fnando committed Mar 29, 2023
1 parent 8587639 commit d8005c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Prefix your message with one of the following:
- [Security] in case of vulnerabilities.
-->

## Unreleased

- [Fixed] Load plugins when running `i18n lint:*` commands.

## v4.2.2 - Dec 30, 2022

- [Changed] Do not re-export files whose contents haven't changed.
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n-js/cli/lint_scripts_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class LintScriptsCommand < Command
end

config = load_config_file(config_file)
I18nJS.load_plugins!
I18nJS.initialize_plugins!(config: config)
Schema.validate!(config)

load_require_file!(require_file) if require_file
Expand Down
4 changes: 3 additions & 1 deletion lib/i18n-js/cli/lint_translations_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class LintTranslationsCommand < Command
end

config = load_config_file(config_file)
I18nJS.load_plugins!
I18nJS.initialize_plugins!(config: config)
Schema.validate!(config)

load_require_file!(require_file) if require_file
Expand All @@ -82,7 +84,7 @@ class LintTranslationsCommand < Command
.map {|key| key.gsub(/^.*?\./, "") }
end

default_locale_keys = mapping.delete(default_locale)
default_locale_keys = mapping.delete(default_locale) || mapping

if ignored_keys.any?
ui.stdout_print "=> Check #{options[:config_file].inspect} for " \
Expand Down

0 comments on commit d8005c4

Please sign in to comment.