-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: compatibility with
eol-last
rule (#191)
* fix: compatibility with eol-last rule * Create .changeset/modern-windows-glow.md
- Loading branch information
Showing
5 changed files
with
150 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"eslint-plugin-astro": patch | ||
--- | ||
|
||
fix: compatibility with `eol-last` rule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { RuleTester, Linter } from "eslint" | ||
import { processor } from "../../../src/processor" | ||
|
||
describe("Integration test for eol-last", () => { | ||
const eolLast = new Linter().getRules().get("eol-last")! | ||
const tester = new RuleTester({ | ||
parser: require.resolve("./auto-parser"), | ||
parserOptions: { | ||
ecmaVersion: 2020, | ||
sourceType: "module", | ||
}, | ||
}) | ||
tester.run("eol-last", eolLast, { | ||
valid: [ | ||
{ | ||
// @ts-expect-error -- fine name with processor | ||
filename: { | ||
filename: "foo.astro", | ||
...processor, | ||
}, | ||
code: ` | ||
<script define:vars={{ foo: 42 }}> | ||
console.log(foo) | ||
</script>\n`, | ||
}, | ||
{ | ||
// @ts-expect-error -- fine name with processor | ||
filename: { | ||
filename: "foo.astro", | ||
...processor, | ||
}, | ||
code: ` | ||
<script define:vars={{ foo: 42 }}> | ||
console.log(foo) | ||
</script>`, | ||
options: ["never"], | ||
}, | ||
{ | ||
// @ts-expect-error -- fine name with processor | ||
filename: { | ||
filename: "foo.astro", | ||
...processor, | ||
}, | ||
code: ` | ||
<script define:vars={{ foo: 42 }}> | ||
console.log(foo)</script>`, | ||
options: ["never"], | ||
}, | ||
], | ||
invalid: [ | ||
{ | ||
// @ts-expect-error -- fine name with processor | ||
filename: { | ||
filename: "foo.astro", | ||
...processor, | ||
}, | ||
code: ` | ||
<script define:vars={{ foo: 42 }}> | ||
console.log(foo)</script>\n`, | ||
output: ` | ||
<script define:vars={{ foo: 42 }}> | ||
console.log(foo) | ||
</script>\n`, | ||
errors: [ | ||
{ | ||
message: "Newline required at end of file but not found.", | ||
line: 3, | ||
column: 27, | ||
}, | ||
], | ||
}, | ||
], | ||
}) | ||
}) |