fix(linter/no_empty_file): point to start of file instead of the entire file (#1105)

Since it may contain lots of comments, which gives us a screenful of comments
This commit is contained in:
Boshen 2023-10-30 16:11:37 +08:00 committed by GitHub
parent cb2407de24
commit 22c31cef3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 23 deletions

View file

@ -49,7 +49,7 @@ impl Rule for NoEmptyFile {
return;
}
ctx.diagnostic(NoEmptyFileDiagnostic(program.span));
ctx.diagnostic(NoEmptyFileDiagnostic(Span::new(0, 0)));
}
}

View file

@ -10,141 +10,142 @@ expression: no_empty_file
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │
·
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │
· ────
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │
·
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
0 │
·
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │
·
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ ╭─▶
2 │ │
3 │ ╰─▶
1 │
· ▲
2 │
3 │
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ // comment
· ──────────
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ /* comment */
· ─────────────
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ #!/usr/bin/env node
· ───────────────────
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ 'use asm';
· ──────────
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ 'use strict';
· ─────────────
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ "use strict"
· ────────────
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ ""
· ──
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ ;
·
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ ;;
· ──
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ {}
· ──
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ {;;}
· ────
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ {{}}
· ────
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ "";
· ───
·
╰────
help: Delete this file or add some code to it.
⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
╭─[no_empty_file.tsx:1:1]
1 │ "use strict";
· ─────────────
·
╰────
help: Delete this file or add some code to it.