Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
512 changes: 480 additions & 32 deletions src/typstToTextlintAst.ts

Large diffs are not rendered by default.

21 changes: 9 additions & 12 deletions test/integration/linting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,16 +314,13 @@ describe("linting", () => {
});

// see: https://github.com/textlint/textlint-plugin-typst/pull/31
it.fails(
"should handle elements immediately below comments",
async () => {
const result = await lintFile(
"element_immediately_below_comment_valid.typ",
);
const violations = getViolations(result);
expect(violations).toEqual([]);
},
);
it("should handle elements immediately below comments", async () => {
const result = await lintFile(
"element_immediately_below_comment_valid.typ",
);
const violations = getViolations(result);
expect(violations).toEqual([]);
});

it("should handle term lists", async () => {
const result = await lintFile("term_list_valid.typ");
Expand All @@ -332,7 +329,7 @@ describe("linting", () => {
});

// see: https://github.com/textlint/textlint-plugin-typst/pull/31
it.fails("should handle nested lists", async () => {
it("should handle nested lists", async () => {
const result = await lintFile("nested_list_valid.typ");
const violations = getViolations(result);
expect(violations).toEqual([]);
Expand Down Expand Up @@ -366,7 +363,7 @@ describe("linting", () => {
});

// see: https://github.com/textlint/textlint-plugin-typst/pull/31
it.fails("should detect violations in term lists", async () => {
it("should detect violations in term lists", async () => {
const result = await lintFile("term_list_invalid.typ");
const violations = getViolations(result);
expect(
Expand Down
166 changes: 82 additions & 84 deletions test/unit/fixtures/Break/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,40 +114,39 @@
"raw": " ",
"type": "Str",
"value": " "
}
],
"loc": {
"end": {
"column": 19,
"line": 1
},
"start": {
"column": 0,
"line": 1
}
},
"range": [0, 19],
"raw": "*Date:* 26.12.2022 ",
"type": "Paragraph"
},
{
"loc": {
"end": {
"column": 20,
"line": 1
{
"loc": {
"end": {
"column": 20,
"line": 1
},
"start": {
"column": 19,
"line": 1
}
},
"range": [19, 20],
"raw": "\\",
"type": "Str",
"value": "\\"
},
{
"loc": {
"end": {
"column": 0,
"line": 2
},
"start": {
"column": 20,
"line": 1
}
},
"range": [20, 21],
"raw": "\n",
"type": "Str",
"value": "\n"
},
"start": {
"column": 19,
"line": 1
}
},
"range": [19, 20],
"raw": "\\",
"type": "Break",
"value": "\\"
},
{
"children": [
{
"children": [
{
Expand Down Expand Up @@ -260,40 +259,39 @@
"raw": " ",
"type": "Str",
"value": " "
}
],
"loc": {
"end": {
"column": 29,
"line": 2
},
"start": {
"column": 0,
"line": 2
}
},
"range": [21, 50],
"raw": "*Topic:* Infrastructure Test ",
"type": "Paragraph"
},
{
"loc": {
"end": {
"column": 30,
"line": 2
{
"loc": {
"end": {
"column": 30,
"line": 2
},
"start": {
"column": 29,
"line": 2
}
},
"range": [50, 51],
"raw": "\\",
"type": "Str",
"value": "\\"
},
{
"loc": {
"end": {
"column": 0,
"line": 3
},
"start": {
"column": 30,
"line": 2
}
},
"range": [51, 52],
"raw": "\n",
"type": "Str",
"value": "\n"
},
"start": {
"column": 29,
"line": 2
}
},
"range": [50, 51],
"raw": "\\",
"type": "Break",
"value": "\\"
},
{
"children": [
{
"children": [
{
Expand Down Expand Up @@ -406,37 +404,37 @@
"raw": " ",
"type": "Str",
"value": " "
},
{
"loc": {
"end": {
"column": 18,
"line": 3
},
"start": {
"column": 17,
"line": 3
}
},
"range": [69, 70],
"raw": "\\",
"type": "Str",
"value": "\\"
}
],
"loc": {
"end": {
"column": 17,
"column": 18,
"line": 3
},
"start": {
"column": 0,
"line": 3
"line": 1
}
},
"range": [52, 69],
"raw": "*Severity:* High ",
"range": [0, 70],
"raw": "*Date:* 26.12.2022 \\\n*Topic:* Infrastructure Test \\\n*Severity:* High \\",
"type": "Paragraph"
},
{
"loc": {
"end": {
"column": 18,
"line": 3
},
"start": {
"column": 17,
"line": 3
}
},
"range": [69, 70],
"raw": "\\",
"type": "Break",
"value": "\\"
}
],
"loc": {
Expand Down
69 changes: 34 additions & 35 deletions test/unit/fixtures/Emphasis/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,40 +180,39 @@
"raw": "\n",
"type": "Str",
"value": "\n"
}
],
"loc": {
"end": {
"column": 0,
"line": 4
},
"start": {
"column": 0,
"line": 3
}
},
"range": [12, 22],
"raw": "_ a b c _\n",
"type": "Paragraph"
},
{
"loc": {
"end": {
"column": 1,
"line": 4
{
"loc": {
"end": {
"column": 1,
"line": 4
},
"start": {
"column": 0,
"line": 4
}
},
"range": [22, 23],
"raw": "\\",
"type": "Str",
"value": "\\"
},
{
"loc": {
"end": {
"column": 0,
"line": 5
},
"start": {
"column": 1,
"line": 4
}
},
"range": [23, 24],
"raw": "\n",
"type": "Str",
"value": "\n"
},
"start": {
"column": 0,
"line": 4
}
},
"range": [22, 23],
"raw": "\\",
"type": "Break",
"value": "\\"
},
{
"children": [
{
"loc": {
"end": {
Expand Down Expand Up @@ -335,11 +334,11 @@
},
"start": {
"column": 0,
"line": 5
"line": 3
}
},
"range": [24, 45],
"raw": "This is _emphasized_.",
"range": [12, 45],
"raw": "_ a b c _\n\\\nThis is _emphasized_.",
"type": "Paragraph"
}
],
Expand Down
Loading