Repository: sindresorhus/awesome-lint
Pull request #127 (2020-10-22 14:23:43)

Fix matching of opening curly quote in description
Without this fix, an item of the form:

```markdown
- [What Google Learned From Its Quest to Build the Perfect Team](https://www.nytimes.com/2016/02/28/magazine/what-google-learned-from-its-quest-to-build-the-perfect-team.html) - “Google's data indicated that psychological safety, more than anything else, was critical to making a team work. (…) The behaviors that create psychological safety — conversational turn-taking and empathy — are part of the same unwritten rules we often turn to, as individuals, when we need to establish a bond.”
```

gets reported under the following linting error:

```shell-session
  ✖  105:176  List item description must start with valid casing            remark-lint:awesome-list-item
```

See for instance: https://github.com/kdeldycke/awesome-management/runs/1291575555?check_suite_focus=true


Patch:
diff --git a/rules/list-item.js b/rules/list-item.js
index 22da87c..ee55076 100644
--- a/rules/list-item.js
+++ b/rules/list-item.js
@@ -20,6 +20,7 @@ const listItemPrefixCaseWhitelist = new Set([
 
 // Valid node types in list item link
 const listItemLinkNodeWhitelist = new Set([
+	'emphasis',
 	'inlineCode',
 	'text'
 ]);
@@ -250,7 +251,7 @@ function validateListItemPrefixCasing(prefix, file) {
 	}
 
 	if (!listItemPrefixCaseWhitelist.has(caseOf(firstWord))) {
-		if (!/\d/.test(firstWord) && !/^["'(]/.test(firstWord)) {
+		if (!/\d/.test(firstWord) && !/^["“'(]/.test(firstWord)) {
 			if (!identifierWhitelist.has(firstWord)) {
 				file.message('List item description must start with valid casing', prefix);
 				return false;


Test patch:
diff --git a/test/fixtures/list-item/0.md b/test/fixtures/list-item/0.md
index b032dfa..747bd52 100644
--- a/test/fixtures/list-item/0.md
+++ b/test/fixtures/list-item/0.md
@@ -44,9 +44,11 @@ These are valid list items that don't need a description.
 - [Mark Text](https://github.com/marktext/marktext) - Real-time preview Markdown editor.
 - [iqvoc](https://github.com/innoq/iqvoc) - SKOS(-XL) Vocabulary Management System for the Semantic Web.
 - [Bridge](https://github.com/bridgedotnet/Bridge) - C# to JavaScript transpiler. Write modern mobile and web apps in C# and run them anywhere in JavaScript.
+- [Elisabeth Engel (@_lizzelo_)](https://twitter.com/_lizzelo_)
 
 - [foo](https://foo.com) - "Catan" inspired board game.
 - [foo](https://foo.com) - 'About This App' window.
+- [foo](https://foo.com) - The so-called `awesome-lint` project.
 
 Test description's ending punctuation.
 - [foo](https://foo.com) - Ending with a period.
@@ -63,14 +65,16 @@ Test description's ending punctuation.
 - [foo](https://foo.com) - Ending with another kind of “non-quoted question mark”?
 - [foo](https://foo.com) - Ending with another kind of “non-quoted ellipsis”…
 
-- [foo](https://foo.com) - "Description is a full quote ending with a period."
-- [foo](https://foo.com) - "Description is a full quote ending with an exclamation point!"
-- [foo](https://foo.com) - "Description is a full quote ending with a question mark?"
-- [foo](https://foo.com) - "Description is a full quote ending with an ellipsis…"
-- [foo](https://foo.com) - “Description is an other king of full quote ending with a period.”
-- [foo](https://foo.com) - “Description is an other king of full quote ending with an exclamation point!”
-- [foo](https://foo.com) - “Description is an other king of full quote ending with a question mark?”
-- [foo](https://foo.com) - “Description is an other king of full quote ending with an ellipsis…”
+- [foo](https://foo.com) - "Full straight-mark quote ending with a period."
+- [foo](https://foo.com) - "Full straight-mark quote ending with an exclamation point!"
+- [foo](https://foo.com) - "Full straight-mark quote ending with a question mark?"
+- [foo](https://foo.com) - "Full straight-mark quote ending with an ellipsis…"
+- [foo](https://foo.com) - “Full curved-mark quote ending with a period.”
+- [foo](https://foo.com) - “Full curved-mark quote ending with an exclamation point!”
+- [foo](https://foo.com) - “Full curved-mark quote ending with a question mark?”
+- [foo](https://foo.com) - “Full curved-mark quote ending with an ellipsis…”
+
+- [foo](https://foo.com) - “Article's quote full of edge cases with non-balanced quote marks . But too long to be in full (…) so here is the best part — making an important point — with a twist.”
 
 - [foo](https://foo.com) - Ending with a parenthetical. (Japanese)
 - [foo](https://foo.com) - Ending with an emphasis parenthetical. *(Japanese)*
@@ -112,19 +116,12 @@ These list items start with common lower-case acronyms.
 - Observables
 	- [bar](https://bar.com)
 
-<!--
-TODO: uncomment once support lands in remark https://github.com/remarkjs/remark/pull/347
-
 These sub-lists are indented with tabs instead of spaces.
 - [foo](https://foo.com)
 	- [bar](https://bar.com)
 	- [bar2](https://bar2.com)
 		- [baz](https://baz.com)
 		- [baz2](https://baz2.com)
--->
-
-<!--
-TODO: these list-items should possibly lint as valid, but they currently don't.
 
 These sub-lists use mixed indentation (spaces and tabs).
 - [Python](https://github.com/vinta/awesome-python#readme)
@@ -135,6 +132,9 @@ These sub-lists use mixed indentation (spaces and tabs).
 
 - [why-is-node-running](https://github.com/mafintosh/why-is-node-running) - Node.js is running but you don't know why?
 
+<!--
+TODO: these list-items should possibly lint as valid, but they currently don't.
+
 - ![v3](img/vapor-3.png) [API Error Middleware](https://github.com/skelpo/APIErrorMiddleware) – Vapor middleware for converting thrown errors to JSON responses.
 - ![v2](img/vapor-2.png) ![v3](img/vapor-3.png) [Bugsnag](https://github.com/nodes-vapor/bugsnag) – Report errors with Bugsnag.
 -->
diff --git a/test/fixtures/list-item/1.md b/test/fixtures/list-item/1.md
index f25e0ec..fbc00b8 100644
--- a/test/fixtures/list-item/1.md
+++ b/test/fixtures/list-item/1.md
@@ -19,7 +19,7 @@ Test description's ending punctuation.
 - [foo](https://foo.com) - Missing ending punctuation
 
 - [foo](https://foo.com) - ``
-- [foo](https://foo.com) - `invalid quote: too noisy`
+- [foo](https://foo.com) - `backtick quotes highlight text which as been ruled out as too noisy`
 - [foo](https://foo.com) - `still invalid quote, even with a period.`
 - [foo](https://foo.com) - `still invalid quote, even with an exclamation mark!`
 - [foo](https://foo.com) - `still invalid quote, even with a question mark?`
@@ -32,6 +32,8 @@ Test description's ending punctuation.
 - [foo](https://foo.com) - `still invalid quote, ending with too much punctuations`…...?
 - [foo](https://foo.com) - `still invalid quote, ending with too much punctuations...!?`…...?
 
+- [foo](https://foo.com) - ”Reversed curved double-quote.“
+
 - [foo](https://foo.com) - Quote-inducing double punctuation "end.".
 - [foo](https://foo.com) - Quote-inducing double punctuation "end."!
 - [foo](https://foo.com) - Quote-inducing double punctuation "end."?
diff --git a/test/rules/snapshots/list-item.js.md b/test/rules/snapshots/list-item.js.md
index 4f05c1f..dc65cfc 100644
--- a/test/rules/snapshots/list-item.js.md
+++ b/test/rules/snapshots/list-item.js.md
@@ -136,11 +136,6 @@ Generated by [AVA](https://ava.li).
         message: 'List item description must end with proper punctuation',
         ruleId: 'awesome-list-item',
       },
-      {
-        line: 36,
-        message: 'List item description must end with proper punctuation',
-        ruleId: 'awesome-list-item',
-      },
       {
         line: 37,
         message: 'List item description must end with proper punctuation',
@@ -212,12 +207,12 @@ Generated by [AVA](https://ava.li).
         ruleId: 'awesome-list-item',
       },
       {
-        line: 52,
+        line: 51,
         message: 'List item description must end with proper punctuation',
         ruleId: 'awesome-list-item',
       },
       {
-        line: 53,
+        line: 52,
         message: 'List item description must end with proper punctuation',
         ruleId: 'awesome-list-item',
       },
@@ -291,13 +286,23 @@ Generated by [AVA](https://ava.li).
         message: 'List item description must end with proper punctuation',
         ruleId: 'awesome-list-item',
       },
+      {
+        line: 68,
+        message: 'List item description must end with proper punctuation',
+        ruleId: 'awesome-list-item',
+      },
       {
         line: 69,
         message: 'List item description must end with proper punctuation',
         ruleId: 'awesome-list-item',
       },
       {
-        line: 70,
+        line: 71,
+        message: 'List item description must end with proper punctuation',
+        ruleId: 'awesome-list-item',
+      },
+      {
+        line: 72,
         message: 'List item description must end with proper punctuation',
         ruleId: 'awesome-list-item',
       },