pasika 0.8.0 → 0.8.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.
@@ -3088,10 +3088,16 @@ function isLocalesFile(filename) {
3088
3088
  const srcIdx = segments.lastIndexOf("src");
3089
3089
  return srcIdx !== -1 && segments[srcIdx + 1] === "locales";
3090
3090
  }
3091
+ function isTestFile(filename) {
3092
+ return /\.(?:test|spec)\.[cm]?tsx?$/.test(filename);
3093
+ }
3091
3094
  var LOCALE_NAME_RE = /^[a-z][a-zA-Z0-9]*$/;
3092
3095
  function looksLikeLocaleKey(name) {
3093
3096
  return LOCALE_NAME_RE.test(name);
3094
3097
  }
3098
+ function looksLikeUserFacingString(value) {
3099
+ return typeof value === "string" && /^\p{Lu}/u.test(value);
3100
+ }
3095
3101
  var localesLocationRule = {
3096
3102
  meta: {
3097
3103
  schema: [],
@@ -3101,7 +3107,7 @@ var localesLocationRule = {
3101
3107
  }
3102
3108
  },
3103
3109
  create(context) {
3104
- if (isLocalesFile(context.filename)) return {};
3110
+ if (isLocalesFile(context.filename) || isTestFile(context.filename)) return {};
3105
3111
  const filename = context.filename;
3106
3112
  const segments = path26.resolve(filename).split(path26.sep);
3107
3113
  const srcIdx = segments.lastIndexOf("src");
@@ -3111,8 +3117,10 @@ var localesLocationRule = {
3111
3117
  return {
3112
3118
  VariableDeclarator(node) {
3113
3119
  if (node.id.type === "Identifier" && node.init?.type === "ObjectExpression" && node.init.properties.length > 0 && looksLikeLocaleKey(node.id.name)) {
3114
- const hasStringValues = node.init.properties.some((p) => p.type === "Property" && p.value.type === "Literal");
3115
- if (hasStringValues) {
3120
+ const hasUserFacingStringValues = node.init.properties.some(
3121
+ (p) => p.type === "Property" && p.value.type === "Literal" && looksLikeUserFacingString(p.value.value)
3122
+ );
3123
+ if (hasUserFacingStringValues) {
3116
3124
  context.report({
3117
3125
  node,
3118
3126
  message: "User-facing strings must live in src/locales/, not inline in component files."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",