Skip to content

Commit c41a287

Browse files
JLHwungaduh95
authored andcommitted
tools: add eslint-plugin-regexp
PR-URL: #62093 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 03839fb commit c41a287

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

eslint.config.mjs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const { default: js } = await importEslintTool('@eslint/js');
2020
const { default: babelEslintParser } = await importEslintTool('@babel/eslint-parser');
2121
const babelPluginSyntaxImportSource = resolveEslintTool('@babel/plugin-syntax-import-source');
2222
const { default: jsdoc } = await importEslintTool('eslint-plugin-jsdoc');
23+
const { default: regexpPlugin } = await importEslintTool('eslint-plugin-regexp');
2324
const { default: markdown } = await importEslintTool('@eslint/markdown');
2425
const { default: stylisticJs } = await importEslintTool('@stylistic/eslint-plugin');
2526

@@ -84,6 +85,7 @@ export default [
8485
// #region general config
8586
js.configs.recommended,
8687
jsdoc.configs['flat/recommended'],
88+
regexpPlugin.configs.recommended,
8789
{
8890
files: ['**/*.js'],
8991
languageOptions: {
@@ -275,6 +277,42 @@ export default [
275277
'jsdoc/reject-any-type': 'off',
276278
'jsdoc/reject-function-type': 'off',
277279

280+
// RegExp recommended rules that we disable.
281+
// Todo: Investigate which rules should be enabled.
282+
'prefer-regex-literals': 'off',
283+
'regexp/control-character-escape': 'off',
284+
'regexp/match-any': 'off',
285+
'regexp/negation': 'off',
286+
'regexp/no-contradiction-with-assertion': 'off',
287+
'regexp/no-dupe-characters-character-class': 'off',
288+
'regexp/no-dupe-disjunctions': 'off',
289+
'regexp/no-empty-alternative': 'off',
290+
'regexp/no-legacy-features': 'off',
291+
'regexp/no-misleading-capturing-group': 'off',
292+
'regexp/no-obscure-range': 'off',
293+
'regexp/no-potentially-useless-backreference': 'off',
294+
'regexp/no-super-linear-backtracking': 'off',
295+
'regexp/no-trivially-nested-quantifier': 'off',
296+
'regexp/no-unused-capturing-group': 'off',
297+
'regexp/no-useless-assertions': 'off',
298+
'regexp/no-useless-character-class': 'off',
299+
'regexp/no-useless-escape': 'off',
300+
'regexp/no-useless-flag': 'off',
301+
'regexp/no-useless-lazy': 'off',
302+
'regexp/no-useless-non-capturing-group': 'off',
303+
'regexp/no-useless-quantifier': 'off',
304+
'regexp/no-useless-range': 'off',
305+
'regexp/optimal-lookaround-quantifier': 'off',
306+
'regexp/optimal-quantifier-concatenation': 'off',
307+
'regexp/prefer-character-class': 'off',
308+
'regexp/prefer-d': 'off',
309+
'regexp/prefer-question-quantifier': 'off',
310+
'regexp/prefer-star-quantifier': 'off',
311+
'regexp/prefer-w': 'off',
312+
'regexp/sort-flags': 'off',
313+
'regexp/strict': 'off',
314+
'regexp/use-ignore-case': 'off',
315+
278316
// Stylistic rules.
279317
'@stylistic/js/arrow-parens': 'error',
280318
'@stylistic/js/arrow-spacing': 'error',

tools/eslint/package-lock.json

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/eslint/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"eslint": "^10.0.2",
1313
"eslint-formatter-tap": "^9.0.1",
1414
"eslint-plugin-jsdoc": "^62.7.1",
15+
"eslint-plugin-regexp": "^3.0.0",
1516
"globals": "^17.3.0"
1617
}
1718
}

0 commit comments

Comments
 (0)