Skip to content

Commit b9914c5

Browse files
committed
Fix ambiguous spellchecking cases
Fixes #214
1 parent 885cbfc commit b9914c5

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

lib/spell-check-rules.js

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const spellCheckRules = [
1212
value: 'TypeScript',
1313
},
1414
{
15-
test: 'python',
15+
test: /\bpython\b(?=\s+(?:programming|language|code|script|development|data|analysis|syntax|framework|library|pip|django|flask))/gi,
1616
value: 'Python',
1717
},
1818
{
@@ -28,15 +28,15 @@ const spellCheckRules = [
2828
value: 'PHP',
2929
},
3030
{
31-
test: 'ruby',
31+
test: /\bruby\b(?=\s+(?:programming|language|code|on\s+rails|gem|development|script|syntax|framework))/gi,
3232
value: 'Ruby',
3333
},
3434
{
35-
test: 'rust',
35+
test: /\brust\b(?=\s+(?:programming|language|code|development|syntax|framework|compiler|cargo|crate))/gi,
3636
value: 'Rust',
3737
},
3838
{
39-
test: 'swift',
39+
test: /\bswift\b(?=\s+(?:programming|language|code|ios|apple|development|compiler|syntax|framework))/gi,
4040
value: 'Swift',
4141
},
4242
{
@@ -47,10 +47,6 @@ const spellCheckRules = [
4747
test: 'scala',
4848
value: 'Scala',
4949
},
50-
{
51-
test: 'elixir',
52-
value: 'Elixir',
53-
},
5450
{
5551
test: 'clojure',
5652
value: 'Clojure',
@@ -68,23 +64,15 @@ const spellCheckRules = [
6864
value: 'Perl',
6965
},
7066
{
71-
test: 'groovy',
72-
value: 'Groovy',
73-
},
74-
{
75-
test: 'dart',
67+
test: /\bdart\b(?=\s+(?:programming|language|code|development|flutter|syntax|framework|pub|package))/gi,
7668
value: 'Dart',
7769
},
7870
{
7971
test: 'zig',
8072
value: 'Zig',
8173
},
8274
{
83-
test: 'nim',
84-
value: 'Nim',
85-
},
86-
{
87-
test: 'crystal',
75+
test: /\bcrystal\b(?=\s+(?:programming|language|code|development|syntax|framework))/gi,
8876
value: 'Crystal',
8977
},
9078

@@ -141,7 +129,7 @@ const spellCheckRules = [
141129
value: 'Django',
142130
},
143131
{
144-
test: 'flask',
132+
test: /\bflask\b(?=\s+(?:web|framework|python|development|app|application|server|microframework))/gi,
145133
value: 'Flask',
146134
},
147135
{
@@ -181,11 +169,11 @@ const spellCheckRules = [
181169
value: 'ASP.NET',
182170
},
183171
{
184-
test: /\b\.?net\b/gi, // Special: dot
172+
test: /\bnet\b/gi, // Match only "NET" without the dot
185173
value: '.NET',
186174
},
187175
{
188-
test: 'bootstrap',
176+
test: /\bbootstrap\b(?=\s+(?:css|framework|grid|responsive|component|theme|ui|design|frontend))/gi,
189177
value: 'Bootstrap',
190178
},
191179
{
@@ -535,7 +523,7 @@ const spellCheckRules = [
535523
value: 'React Native',
536524
},
537525
{
538-
test: 'flutter',
526+
test: /\bflutter\b(?=\s+(?:framework|app|development|dart|mobile|android|ios|widget|sdk))/gi,
539527
value: 'Flutter',
540528
},
541529
{
@@ -929,7 +917,7 @@ const spellCheckRules = [
929917
value: 'Brackets',
930918
},
931919
{
932-
test: 'vim',
920+
test: /\bvim\b(?=\s+(?:editor|command|terminal|text|config|plugin|script|mode))/gi,
933921
value: 'Vim',
934922
},
935923
{

rules/spell-check.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import spellCheckRules from '../lib/spell-check-rules.js';
88
const wordBreakCharacterAllowList = new Set([
99
'-',
1010
'_', // Allow underscores for package names like awesome_package
11+
'.', // Allow dots for names like .NET
1112
]);
1213

1314
// Convert string/regex patterns to compiled regexes

test/fixtures/spell-check/error0.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,7 @@ Test spell-check on basic text nodes.
101101
- redis database but Redis is correct
102102
- jest testing framework but Jest is correct
103103
- webpack bundler but Webpack is correct
104+
105+
- net framework should be .NET
106+
- Using NET Core should be .NET Core
107+
- Building with net 8 should be .NET 8

test/fixtures/spell-check/success0.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,10 @@ You might also like [awesome-nodejs](https://github.com/sindresorhus/awesome-nod
140140
- Code examples: `docker run` and `kubectl apply` should not trigger errors
141141
- Package names: awesome_typescript, vue_components, react_hooks should not trigger errors
142142
- URLs: https://react.dev, https://angular.io, https://python.org should not trigger errors
143+
144+
## .NET
145+
146+
[.NET](https://dotnet.microsoft.com) - .NET framework
147+
- Using .NET Core
148+
- Building with .NET 8
149+
- The .NET ecosystem

0 commit comments

Comments
 (0)