Merge pull request #191 from coren-frankel/master

Add additional TSX comment syntax
This commit is contained in:
Alastair Mooney 2024-07-05 17:13:22 +01:00 committed by GitHub
commit e3452cb1e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 55 additions and 12 deletions

View File

@ -242,6 +242,13 @@
"start": "/\\*", "start": "/\\*",
"end": "\\*/" "end": "\\*/"
} }
},
{
"type": "block",
"pattern": {
"start": "{/\\*",
"end": "\\*/}"
}
} }
] ]
}, },

View File

@ -407,4 +407,25 @@ index 0000000..7cccc5b 100644
-TODO: Render Liquid file -TODO: Render Liquid file
{% assign featured_product = all_products["product_handle"] %} {% assign featured_product = all_products["product_handle"] %}
{% render "product", product: featured_product %} {% render "product", product: featured_product %}
-{% endcomment %} -{% endcomment %}
diff --git a/tests/example_file.tsx b/tests/example_file.tsx
index 0000000..7cccc5b 100644
--- a/tests/example_file.tsx
+++ b/tests/example_file.tsx
@@ -1,7 +1,3 @@
-// TODO: rename component
-export default async function Component() {
+export default async function MyComponent() {
- /* TODO: Use state here
- labels: client */
+ const [data, setData] = useState<string>("");
return (
<div>
- {/*
- TODO: use styled component library
- */}
+ <StyledComponent>{data}</StyledComponent>
</div>
);
}

View File

@ -451,4 +451,23 @@ index 0000000..7cccc5b
+TODO: Render Liquid file +TODO: Render Liquid file
+{% assign featured_product = all_products["product_handle"] %} +{% assign featured_product = all_products["product_handle"] %}
+{% render "product", product: featured_product %} +{% render "product", product: featured_product %}
+{% endcomment %} +{% endcomment %}
diff --git a/tests/example_file.tsx b/tests/example_file.tsx
new file mode 100644
index 0000000..7cccc5b
--- /dev/null
+++ b/tests/example_file.tsx
@@ -0,0 +1,13 @@
+// TODO: rename component
+export default async function Component() {
+ /* TODO: Use state here
+ labels: client */
+
+ return (
+ <div>
+ {/*
+ TODO: use styled component library
+ */}
+ </div>
+ );
+}

View File

@ -35,11 +35,9 @@ class NewIssueTests(unittest.TestCase):
def test_java_issues(self): def test_java_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2) self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2)
def test_json_with_comments_issues(self): def test_javascript_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2) # Includes 1 test for JSON with Comments, 1 test for JSON5, 3 tests for TSX.
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 5)
def test_json5_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2)
def test_ruby_issues(self): def test_ruby_issues(self):
# Includes 2 tests for Crystal. # Includes 2 tests for Crystal.
@ -144,11 +142,9 @@ class ClosedIssueTests(unittest.TestCase):
def test_starlark_issues(self): def test_starlark_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 5) self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 5)
def test_json_with_comments_issues(self): def test_javascript_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2) # Includes 1 test for JSON with Comments, 1 test for JSON5, 3 tests for TSX.
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 5)
def test_json5_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2)
def test_autohotkey_issues(self): def test_autohotkey_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1) self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1)