words.js 557 B

123456789101112131415161718192021222324
  1. const testFile = require('../../helpers/testFile');
  2. const runTest = require('../../helpers/runTest');
  3. const cases = {
  4. valid: [
  5. {
  6. code: 'const a = "absfoo";',
  7. options: [{ mode: 'all', words: { exclude: ['.*foo.*'] } }],
  8. },
  9. {
  10. code: 'const a = "fooabc";',
  11. options: [{ mode: 'all', words: { exclude: ['^foo.*'] } }],
  12. },
  13. ],
  14. invalid: [
  15. {
  16. code: 'const a = "afoo";',
  17. options: [{ mode: 'all', words: { exclude: ['^foo'] } }],
  18. errors: 1,
  19. },
  20. ],
  21. };
  22. runTest('no-literal-string: words', cases);