@aiready/consistency 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-test.log +25 -25
- package/dist/chunk-LD3CHHU2.mjs +1297 -0
- package/dist/cli.js +5 -3
- package/dist/cli.mjs +1 -1
- package/dist/index.js +5 -3
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/analyzers/naming-ast.ts +6 -3
package/dist/cli.js
CHANGED
|
@@ -972,17 +972,19 @@ function analyzeFileNamingAST(file, ast, allAbbreviations, allShortWords, disabl
|
|
|
972
972
|
if (!name) return;
|
|
973
973
|
const line = getLineNumber(node);
|
|
974
974
|
if (["main", "init", "setup", "bootstrap"].includes(name)) return;
|
|
975
|
-
const hasActionVerb = name.match(/^(get|set|is|has|can|should|create|update|delete|fetch|load|save|process|handle|validate|check|find|search|filter|map|reduce|make|do|run|start|stop|build|parse|format|render|calculate|compute|generate|transform|convert|normalize|sanitize|encode|decode|compress|extract|merge|split|join|sort|compare|test|verify|ensure|apply|execute|invoke|call|emit|dispatch|trigger|listen|subscribe|unsubscribe|add|remove|clear|reset|toggle|enable|disable|open|close|connect|disconnect|send|receive|read|write|import|export|register|unregister|mount|unmount|track|store|persist|upsert|derive|classify|combine|discover|activate|require|assert|expect|mask|escape|sign|put|list|complete|page|safe|mock|pick|pluralize|text)/);
|
|
975
|
+
const hasActionVerb = name.match(/^(get|set|is|has|can|should|create|update|delete|fetch|load|save|process|handle|validate|check|find|search|filter|map|reduce|make|do|run|start|stop|build|parse|format|render|calculate|compute|generate|transform|convert|normalize|sanitize|encode|decode|compress|extract|merge|split|join|sort|compare|test|verify|ensure|apply|execute|invoke|call|emit|dispatch|trigger|listen|subscribe|unsubscribe|add|remove|clear|reset|toggle|enable|disable|open|close|connect|disconnect|send|receive|read|write|import|export|register|unregister|mount|unmount|track|store|persist|upsert|derive|classify|combine|discover|activate|require|assert|expect|mask|escape|sign|put|list|complete|page|safe|mock|pick|pluralize|text|count|detect|select)/);
|
|
976
976
|
const isFactoryPattern = name.match(/(Factory|Builder|Creator|Generator|Provider|Adapter|Mock)$/);
|
|
977
977
|
const isEventHandler = name.match(/^on[A-Z]/);
|
|
978
978
|
const isDescriptiveLong = name.length > 15;
|
|
979
979
|
const isReactHook = name.match(/^use[A-Z]/);
|
|
980
|
-
const isHelperPattern = name.match(/^(to|from|with|without|for|as|into)\w+/);
|
|
980
|
+
const isHelperPattern = name.match(/^(to|from|with|without|for|as|into)\w+/) || name.match(/^\w+(To|From|With|Without|For|As|Into)\w*$/);
|
|
981
981
|
const isUtilityName = ["cn", "proxy", "sitemap", "robots", "gtag"].includes(name);
|
|
982
|
+
const isLanguageKeyword = ["constructor", "toString", "valueOf", "toJSON"].includes(name);
|
|
983
|
+
const isFrameworkPattern = name.match(/^(goto|fill|click|select|submit|wait|expect)\w*/);
|
|
982
984
|
const isDescriptivePattern = name.match(/^(default|total|count|sum|avg|max|min|initial|current|previous|next)\w+/) || name.match(/\w+(Count|Total|Sum|Average|List|Map|Set|Config|Settings|Options|Props|Data|Info|Details|State|Status|Response|Result)$/);
|
|
983
985
|
const capitalCount = (name.match(/[A-Z]/g) || []).length;
|
|
984
986
|
const isCompoundWord = capitalCount >= 3;
|
|
985
|
-
if (!hasActionVerb && !isFactoryPattern && !isEventHandler && !isDescriptiveLong && !isReactHook && !isHelperPattern && !isUtilityName && !isDescriptivePattern && !isCompoundWord) {
|
|
987
|
+
if (!hasActionVerb && !isFactoryPattern && !isEventHandler && !isDescriptiveLong && !isReactHook && !isHelperPattern && !isUtilityName && !isDescriptivePattern && !isCompoundWord && !isLanguageKeyword && !isFrameworkPattern) {
|
|
986
988
|
issues.push({
|
|
987
989
|
file,
|
|
988
990
|
line,
|
package/dist/cli.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -974,17 +974,19 @@ function analyzeFileNamingAST(file, ast, allAbbreviations, allShortWords, disabl
|
|
|
974
974
|
if (!name) return;
|
|
975
975
|
const line = getLineNumber(node);
|
|
976
976
|
if (["main", "init", "setup", "bootstrap"].includes(name)) return;
|
|
977
|
-
const hasActionVerb = name.match(/^(get|set|is|has|can|should|create|update|delete|fetch|load|save|process|handle|validate|check|find|search|filter|map|reduce|make|do|run|start|stop|build|parse|format|render|calculate|compute|generate|transform|convert|normalize|sanitize|encode|decode|compress|extract|merge|split|join|sort|compare|test|verify|ensure|apply|execute|invoke|call|emit|dispatch|trigger|listen|subscribe|unsubscribe|add|remove|clear|reset|toggle|enable|disable|open|close|connect|disconnect|send|receive|read|write|import|export|register|unregister|mount|unmount|track|store|persist|upsert|derive|classify|combine|discover|activate|require|assert|expect|mask|escape|sign|put|list|complete|page|safe|mock|pick|pluralize|text)/);
|
|
977
|
+
const hasActionVerb = name.match(/^(get|set|is|has|can|should|create|update|delete|fetch|load|save|process|handle|validate|check|find|search|filter|map|reduce|make|do|run|start|stop|build|parse|format|render|calculate|compute|generate|transform|convert|normalize|sanitize|encode|decode|compress|extract|merge|split|join|sort|compare|test|verify|ensure|apply|execute|invoke|call|emit|dispatch|trigger|listen|subscribe|unsubscribe|add|remove|clear|reset|toggle|enable|disable|open|close|connect|disconnect|send|receive|read|write|import|export|register|unregister|mount|unmount|track|store|persist|upsert|derive|classify|combine|discover|activate|require|assert|expect|mask|escape|sign|put|list|complete|page|safe|mock|pick|pluralize|text|count|detect|select)/);
|
|
978
978
|
const isFactoryPattern = name.match(/(Factory|Builder|Creator|Generator|Provider|Adapter|Mock)$/);
|
|
979
979
|
const isEventHandler = name.match(/^on[A-Z]/);
|
|
980
980
|
const isDescriptiveLong = name.length > 15;
|
|
981
981
|
const isReactHook = name.match(/^use[A-Z]/);
|
|
982
|
-
const isHelperPattern = name.match(/^(to|from|with|without|for|as|into)\w+/);
|
|
982
|
+
const isHelperPattern = name.match(/^(to|from|with|without|for|as|into)\w+/) || name.match(/^\w+(To|From|With|Without|For|As|Into)\w*$/);
|
|
983
983
|
const isUtilityName = ["cn", "proxy", "sitemap", "robots", "gtag"].includes(name);
|
|
984
|
+
const isLanguageKeyword = ["constructor", "toString", "valueOf", "toJSON"].includes(name);
|
|
985
|
+
const isFrameworkPattern = name.match(/^(goto|fill|click|select|submit|wait|expect)\w*/);
|
|
984
986
|
const isDescriptivePattern = name.match(/^(default|total|count|sum|avg|max|min|initial|current|previous|next)\w+/) || name.match(/\w+(Count|Total|Sum|Average|List|Map|Set|Config|Settings|Options|Props|Data|Info|Details|State|Status|Response|Result)$/);
|
|
985
987
|
const capitalCount = (name.match(/[A-Z]/g) || []).length;
|
|
986
988
|
const isCompoundWord = capitalCount >= 3;
|
|
987
|
-
if (!hasActionVerb && !isFactoryPattern && !isEventHandler && !isDescriptiveLong && !isReactHook && !isHelperPattern && !isUtilityName && !isDescriptivePattern && !isCompoundWord) {
|
|
989
|
+
if (!hasActionVerb && !isFactoryPattern && !isEventHandler && !isDescriptiveLong && !isReactHook && !isHelperPattern && !isUtilityName && !isDescriptivePattern && !isCompoundWord && !isLanguageKeyword && !isFrameworkPattern) {
|
|
988
990
|
issues.push({
|
|
989
991
|
file,
|
|
990
992
|
line,
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -289,14 +289,17 @@ function analyzeFileNamingAST(
|
|
|
289
289
|
if (['main', 'init', 'setup', 'bootstrap'].includes(name)) return;
|
|
290
290
|
|
|
291
291
|
// Check for action verbs and patterns
|
|
292
|
-
const hasActionVerb = name.match(/^(get|set|is|has|can|should|create|update|delete|fetch|load|save|process|handle|validate|check|find|search|filter|map|reduce|make|do|run|start|stop|build|parse|format|render|calculate|compute|generate|transform|convert|normalize|sanitize|encode|decode|compress|extract|merge|split|join|sort|compare|test|verify|ensure|apply|execute|invoke|call|emit|dispatch|trigger|listen|subscribe|unsubscribe|add|remove|clear|reset|toggle|enable|disable|open|close|connect|disconnect|send|receive|read|write|import|export|register|unregister|mount|unmount|track|store|persist|upsert|derive|classify|combine|discover|activate|require|assert|expect|mask|escape|sign|put|list|complete|page|safe|mock|pick|pluralize|text)/);
|
|
292
|
+
const hasActionVerb = name.match(/^(get|set|is|has|can|should|create|update|delete|fetch|load|save|process|handle|validate|check|find|search|filter|map|reduce|make|do|run|start|stop|build|parse|format|render|calculate|compute|generate|transform|convert|normalize|sanitize|encode|decode|compress|extract|merge|split|join|sort|compare|test|verify|ensure|apply|execute|invoke|call|emit|dispatch|trigger|listen|subscribe|unsubscribe|add|remove|clear|reset|toggle|enable|disable|open|close|connect|disconnect|send|receive|read|write|import|export|register|unregister|mount|unmount|track|store|persist|upsert|derive|classify|combine|discover|activate|require|assert|expect|mask|escape|sign|put|list|complete|page|safe|mock|pick|pluralize|text|count|detect|select)/);
|
|
293
293
|
|
|
294
294
|
const isFactoryPattern = name.match(/(Factory|Builder|Creator|Generator|Provider|Adapter|Mock)$/);
|
|
295
295
|
const isEventHandler = name.match(/^on[A-Z]/);
|
|
296
296
|
const isDescriptiveLong = name.length > 15;
|
|
297
297
|
const isReactHook = name.match(/^use[A-Z]/);
|
|
298
|
-
const isHelperPattern = name.match(/^(to|from|with|without|for|as|into)\w+/)
|
|
298
|
+
const isHelperPattern = name.match(/^(to|from|with|without|for|as|into)\w+/) ||
|
|
299
|
+
name.match(/^\w+(To|From|With|Without|For|As|Into)\w*$/); // xForY, xToY patterns
|
|
299
300
|
const isUtilityName = ['cn', 'proxy', 'sitemap', 'robots', 'gtag'].includes(name);
|
|
301
|
+
const isLanguageKeyword = ['constructor', 'toString', 'valueOf', 'toJSON'].includes(name);
|
|
302
|
+
const isFrameworkPattern = name.match(/^(goto|fill|click|select|submit|wait|expect)\w*/); // Page Object Model, test framework patterns
|
|
300
303
|
|
|
301
304
|
// Descriptive patterns: countX, totalX, etc.
|
|
302
305
|
const isDescriptivePattern = name.match(/^(default|total|count|sum|avg|max|min|initial|current|previous|next)\w+/) ||
|
|
@@ -306,7 +309,7 @@ function analyzeFileNamingAST(
|
|
|
306
309
|
const capitalCount = (name.match(/[A-Z]/g) || []).length;
|
|
307
310
|
const isCompoundWord = capitalCount >= 3; // daysSinceLastCommit has 4 capitals
|
|
308
311
|
|
|
309
|
-
if (!hasActionVerb && !isFactoryPattern && !isEventHandler && !isDescriptiveLong && !isReactHook && !isHelperPattern && !isUtilityName && !isDescriptivePattern && !isCompoundWord) {
|
|
312
|
+
if (!hasActionVerb && !isFactoryPattern && !isEventHandler && !isDescriptiveLong && !isReactHook && !isHelperPattern && !isUtilityName && !isDescriptivePattern && !isCompoundWord && !isLanguageKeyword && !isFrameworkPattern) {
|
|
310
313
|
issues.push({
|
|
311
314
|
file,
|
|
312
315
|
line,
|