feat: add require-string-literal-i18n-helpers rule
Lints against calling translation helpers with anything else than strings.
Calling those helpers with expressions would fool the gettext:regenerate
script that gathers localized strings as it extracts
string arguments and can not resolve expressions properly.
This rule reports 14 related errors when ran on GitLab's current master
(a3a0c0ba62c
):
yarn lint:eslint:all
yarn run v1.22.5
$ yarn run internal:eslint .
$ eslint --max-warnings 0 --report-unused-disable-directives --ext .js,.vue .
IncrementalWebpackCompiler: Status – disabled
/Users/paul/projects/gdk/gitlab/app/assets/javascripts/design_management/utils/error_messages.js
103:12 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
/Users/paul/projects/gdk/gitlab/app/assets/javascripts/notes/stores/actions.js
623:18 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
659:18 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
/Users/paul/projects/gdk/gitlab/app/assets/javascripts/packages/details/components/package_history.vue
63:14 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
/Users/paul/projects/gdk/gitlab/app/assets/javascripts/packages/shared/constants.js
39:50 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
/Users/paul/projects/gdk/gitlab/app/assets/javascripts/packages_and_registries/package_registry/components/details/package_history.vue
64:14 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
/Users/paul/projects/gdk/gitlab/app/assets/javascripts/packages_and_registries/package_registry/constants.js
72:50 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
/Users/paul/projects/gdk/gitlab/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue
40:14 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
/Users/paul/projects/gdk/gitlab/app/assets/javascripts/vue_shared/components/filtered_search_bar/constants.js
23:63 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
24:61 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
28:34 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
32:35 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
33:34 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
/Users/paul/projects/gdk/gitlab/ee/app/assets/javascripts/vue_shared/dashboards/components/alerts.vue
31:22 error Translation helpers must be called with a string @gitlab/no-expression-i18n-helpers
/Users/paul/projects/gdk/gitlab/spec/frontend_integration/test_helpers/mock_server/graphql.js
6:1 error Unused eslint-disable directive (no problems were reported from 'import/no-unresolved')
✖ 15 problems (15 errors, 0 warnings)
Related to #41 (closed)
Edited by Paul Gascou-Vaillancourt