Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/eslint/no_regex_spaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use oxc_span::Span;
use crate::{context::LintContext, rule::Rule, AstNode};

fn no_regex_spaces_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Spaces are hard to count.")
.with_help("Use a quantifier, e.g. {2}")
OxcDiagnostic::warn("Multiple consecutive spaces are hard to count.")
.with_help(format!("Use a quantifier: ` {{{size}}}`", size = span.size()))
.with_label(span)
}

Expand Down
104 changes: 52 additions & 52 deletions crates/oxc_linter/src/snapshots/no_regex_spaces.snap
Original file line number Diff line number Diff line change
@@ -1,184 +1,184 @@
---
source: crates/oxc_linter/src/tester.rs
---
⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:12]
1 │ var foo = / /;
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:15]
1 │ var foo = /bar baz/;
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:15]
1 │ var foo = /bar baz/;
· ────
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {4}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:16]
1 │ var foo = / a b c d /;
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:27]
1 │ var foo = RegExp(' a b c d ');
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:22]
1 │ var foo = RegExp('bar baz');
· ────
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {4}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:26]
1 │ var foo = new RegExp('bar baz');
· ────
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {4}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:15]
1 │ var foo = /bar {3}baz/;
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:15]
1 │ var foo = /bar ?baz/;
· ───
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {3}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:26]
1 │ var foo = new RegExp('bar *baz')
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:22]
1 │ var foo = RegExp('bar +baz')
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:26]
1 │ var foo = new RegExp('bar ');
· ────
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {4}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:17]
1 │ var foo = /bar\\ baz/;
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:15]
1 │ var foo = /(?: )/;
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:26]
1 │ var foo = RegExp('^foo(?= )');
· ───
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {3}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:14]
1 │ var foo = /\\ /
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:15]
1 │ var foo = / \\ /
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:12]
1 │ var foo = / foo /;
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:25]
1 │ var foo = new RegExp('\\d ')
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:25]
1 │ var foo = RegExp('\\u0041 ')
· ───
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {3}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:17]
1 │ var foo = /[ ] /;
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:12]
1 │ var foo = / [ ] /;
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:19]
1 │ var foo = RegExp(' [ ]');
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:24]
1 │ var foo = /[[ ] ] /v;
· ────
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {4}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:28]
1 │ var foo = new RegExp('[ ] ');
· ──
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {2}`

⚠ eslint(no-regex-spaces): Spaces are hard to count.
⚠ eslint(no-regex-spaces): Multiple consecutive spaces are hard to count.
╭─[no_regex_spaces.tsx:1:30]
1 │ var foo = new RegExp('[[ ] ] ', 'v');
· ────
╰────
help: Use a quantifier, e.g. {2}
help: Use a quantifier: ` {4}`