jsx-components.js 635 B

12345678910111213141516171819202122232425
  1. const testFile = require('../../helpers/testFile');
  2. const runTest = require('../../helpers/runTest');
  3. const cases = {
  4. valid: [
  5. { code: '<Trans>arrow</Trans>' },
  6. {
  7. code: '<Icon>arrow</Icon>',
  8. options: [{ 'jsx-components': { exclude: ['Icon'] } }],
  9. },
  10. {
  11. code: '<><span>hello</span><p>{i18next.t("KEY")}</p></>',
  12. options: [{ 'jsx-components': { include: ['p'] } }],
  13. },
  14. ],
  15. invalid: [
  16. {
  17. code: '<><span>hello<span><p>world</p></>',
  18. options: [{ 'jsx-components': { include: ['span'] } }],
  19. errors: 1,
  20. },
  21. ],
  22. };
  23. runTest('no-literal-string: jsx-components', cases);