Skip to content

Exempt "comparison" strings from `no-non-i18n-strings`

From https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/26789#note_181101781 :

I wonder if an improvement to the no-non-i18n-strings rule could be made such that it ignores "comparison" strings... I think the likelihood that we'll every want to use any of the following patterns is extremely minimal:

if (foo === __('Some Text')) {
  // ...
}

// or
switch (foo) {
  case __('Some Text'):
    // ... 
}

// or
const re = new RegExp(__('Some Text'))
re.match(...)

If we could detect and ignore these patterns that would be awesome.