message: tested no-empty-character-class implementation
diff: @@ -251,3 +251,42 @@ test('disallow var', async t => {
  },
  ]);
  });
  +
  +test('no empty character class in regular expression', async t => {
  + const validTestCases = [
  + 'let foo = /^abc[a-zA-Z]/;foo;',
  + 'let regExp = new RegExp(\"^abc[]\");regExp;',
  + 'let foo = /^abc/;foo;',
  + 'let foo = /[\\[]/;foo;',
  + 'let foo = /[\\]]/;foo;',
  + 'let foo = /[a-zA-Z\\[]/;foo;',
  + 'let foo = /[[]/;foo;',
  + 'let foo = /[\\[a-z[]]/;foo;',
  + 'let foo = /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\^\\$\\|]/g;foo;',
  + 'let foo = /[\\]]/uy;foo;',
  + 'let foo = /[\\]]/s;foo;',
  + 'let foo = /\\[]/;foo;'
  + ]
  +
  + const invalidTestCases = [
  + 'let foo = /^abc[]/;foo;',
  + 'let foo = /foo[]bar/;foo;',
  + 'let foo = "";if (foo.match(/^abc[]/)) { foo; }',
  + 'let foo = /[]]/;foo;',
  + 'let foo = /\\[[]/;foo;',
  + 'let foo = /\\[\\[\\]a-z[]/;foo;'
  + ]
  +
  + for (const validTestCase of validTestCases) {
  + const {diagnostics} = await testLint(
  + validTestCase,
  + LINT_ENABLED_FORMAT_DISABLED_CONFIG,
  + );
  + t.is(diagnostics.length, 0);
  + }
  +
  + for (const invalidTestCase of invalidTestCases) {
  + let res = await testLint(invalidTestCase, LINT_ENABLED_FORMAT_DISABLED_CONFIG)
  + t.snapshot(res);
  + }
  +});
  \ No newline at end of file
  