• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4if (!common.hasCrypto)
5  common.skip('missing crypto');
6
7common.skipIfEslintMissing();
8
9const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
10const rule = require('../../tools/eslint-rules/no-unescaped-regexp-dot');
11
12new RuleTester().run('no-unescaped-regexp-dot', rule, {
13  valid: [
14    '/foo/',
15    String.raw`/foo\./`,
16    '/.+/',
17    '/.*/',
18    '/.?/',
19    '/.{5}/',
20    String.raw`/\\\./`,
21  ],
22  invalid: [
23    {
24      code: '/./',
25      errors: [{ message: 'Unescaped dot character in regular expression' }]
26    },
27    {
28      code: String.raw`/\\./`,
29      errors: [{ message: 'Unescaped dot character in regular expression' }]
30    },
31  ]
32});
33