detect-eval-with-expression.js 372 B

1234567891011121314151617
  1. 'use strict';
  2. const RuleTester = require('eslint').RuleTester;
  3. const tester = new RuleTester();
  4. const ruleName = 'detect-eval-with-expression';
  5. tester.run(ruleName, require(`../rules/${ruleName}`), {
  6. valid: [{ code: 'eval(\'alert()\')' }],
  7. invalid: [
  8. {
  9. code: 'eval(a);',
  10. errors: [{ message: 'eval with argument of type Identifier' }]
  11. }
  12. ]
  13. });