Skip to content

Commit e3452cb

Browse files
authored
Merge pull request #191 from coren-frankel/master
Add additional TSX comment syntax
2 parents 4120fdb + 8ba8614 commit e3452cb

File tree

4 files changed

+55
-12
lines changed

4 files changed

+55
-12
lines changed

syntax.json

+7
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@
242242
"start": "/\\*",
243243
"end": "\\*/"
244244
}
245+
},
246+
{
247+
"type": "block",
248+
"pattern": {
249+
"start": "{/\\*",
250+
"end": "\\*/}"
251+
}
245252
}
246253
]
247254
},

tests/test_closed.diff

+22-1
Original file line numberDiff line numberDiff line change
@@ -407,4 +407,25 @@ index 0000000..7cccc5b 100644
407407
-TODO: Render Liquid file
408408
{% assign featured_product = all_products["product_handle"] %}
409409
{% render "product", product: featured_product %}
410-
-{% endcomment %}
410+
-{% endcomment %}
411+
diff --git a/tests/example_file.tsx b/tests/example_file.tsx
412+
index 0000000..7cccc5b 100644
413+
--- a/tests/example_file.tsx
414+
+++ b/tests/example_file.tsx
415+
@@ -1,7 +1,3 @@
416+
-// TODO: rename component
417+
-export default async function Component() {
418+
+export default async function MyComponent() {
419+
- /* TODO: Use state here
420+
- labels: client */
421+
+ const [data, setData] = useState<string>("");
422+
423+
return (
424+
<div>
425+
- {/*
426+
- TODO: use styled component library
427+
- */}
428+
+ <StyledComponent>{data}</StyledComponent>
429+
</div>
430+
);
431+
}

tests/test_new.diff

+20-1
Original file line numberDiff line numberDiff line change
@@ -451,4 +451,23 @@ index 0000000..7cccc5b
451451
+TODO: Render Liquid file
452452
+{% assign featured_product = all_products["product_handle"] %}
453453
+{% render "product", product: featured_product %}
454-
+{% endcomment %}
454+
+{% endcomment %}
455+
diff --git a/tests/example_file.tsx b/tests/example_file.tsx
456+
new file mode 100644
457+
index 0000000..7cccc5b
458+
--- /dev/null
459+
+++ b/tests/example_file.tsx
460+
@@ -0,0 +1,13 @@
461+
+// TODO: rename component
462+
+export default async function Component() {
463+
+ /* TODO: Use state here
464+
+ labels: client */
465+
+
466+
+ return (
467+
+ <div>
468+
+ {/*
469+
+ TODO: use styled component library
470+
+ */}
471+
+ </div>
472+
+ );
473+
+}

tests/test_todo_parser.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ def test_php_issues(self):
3535
def test_java_issues(self):
3636
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2)
3737

38-
def test_json_with_comments_issues(self):
39-
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2)
40-
41-
def test_json5_issues(self):
42-
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2)
38+
def test_javascript_issues(self):
39+
# Includes 1 test for JSON with Comments, 1 test for JSON5, 3 tests for TSX.
40+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 5)
4341

4442
def test_ruby_issues(self):
4543
# Includes 2 tests for Crystal.
@@ -144,11 +142,9 @@ def test_julia_issues(self):
144142
def test_starlark_issues(self):
145143
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 5)
146144

147-
def test_json_with_comments_issues(self):
148-
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2)
149-
150-
def test_json5_issues(self):
151-
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2)
145+
def test_javascript_issues(self):
146+
# Includes 1 test for JSON with Comments, 1 test for JSON5, 3 tests for TSX.
147+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 5)
152148

153149
def test_autohotkey_issues(self):
154150
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1)

0 commit comments

Comments
 (0)