jsx-attributes.js 667 B

12345678910111213141516171819202122232425
  1. const testFile = require('../../helpers/testFile');
  2. const runTest = require('../../helpers/runTest');
  3. const options = [{ mode: 'all', 'should-validate-template': true }];
  4. const cases = {
  5. valid: [
  6. {
  7. code: '<DIV foo="bar" />',
  8. options: [{ mode: 'jsx-only', 'jsx-attributes': { exclude: ['foo'] } }],
  9. },
  10. {
  11. code: '<DIV foo="bar2" />',
  12. options: [{ mode: 'all', 'jsx-attributes': { include: ['bar'] } }],
  13. },
  14. ],
  15. invalid: [
  16. {
  17. code: '<DIV foo="bar" />',
  18. options: [{ mode: 'jsx-only', 'jsx-attributes': { include: ['foo'] } }],
  19. errors: 1,
  20. },
  21. ],
  22. };
  23. runTest('no-literal-string: jsx-attributes', cases);