@kashi-ui/eslint-plugin 0.0.0-stage → 2.30.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kashi contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,77 @@
1
- # Temporary Holding Version
1
+ # @kashi-ui/eslint-plugin
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ لینت نگارش فارسی و راست‌به‌چپ برای ESLint 9 و 10. اشتباه‌های رایج پروژه‌های فارسی را همان موقع تایپ نشان می‌دهد و هرجا امن باشد خودش درست می‌کند: «ي/ك» عربی، نیم‌فاصله، ارقام، علامت‌ها، نویسه‌های کنترل جهت، `<html dir lang>`، style و کلاس‌های فیزیکی Tailwind، و آیکون‌های جهت‌داری که قرینه نمی‌شوند. برای هر پروژهٔ فارسی، با [کاشی](https://kashi.sepantapouya.com) یا بدون آن.
4
+
5
+ راهنمای کامل با نمونهٔ درست و غلط هر قانون: [kashi.sepantapouya.com/docs/lint](https://kashi.sepantapouya.com/docs/lint/)
6
+
7
+ ```bash
8
+ npm i -D @kashi-ui/eslint-plugin
9
+ ```
10
+
11
+ ```js
12
+ // eslint.config.mjs
13
+ import kashi from "@kashi-ui/eslint-plugin";
14
+
15
+ export default [
16
+ kashi.configs.react, // بدون React یا Tailwind: kashi.configs.recommended
17
+ // kashi.configs.kashi, // در پروژه‌های کاشی
18
+ ];
19
+ ```
20
+
21
+ | پیکربندی | چه دارد |
22
+ | --- | --- |
23
+ | `recommended` | قانون‌های متن (هشدار)، `no-bidi-control` و `html-dir-lang` (خطا)، `no-physical-style` (هشدار) |
24
+ | `react` | recommended به‌اضافهٔ `tailwind-logical` و `directional-icon` |
25
+ | `strict` | همهٔ قانون‌های متن و RTL به‌صورت خطا |
26
+ | `kashi` | `no-unknown-token`، `prefer-tokens` و `prefer-kashi-validators` |
27
+
28
+ ## قانون‌ها
29
+
30
+ | قانون | چه می‌گیرد | اصلاح |
31
+ | --- | --- | --- |
32
+ | `kashi/no-arabic-chars` | «ي»، «ى» و «ك» عربی و شکل‌های نمایشی عربی | خودکار |
33
+ | `kashi/persian-digits` | ارقام لاتین یا عربی کنار متن فارسی (`prefer: "latin"` برای برعکس) | خودکار |
34
+ | `kashi/zwnj` | نیم‌فاصلهٔ جاافتاده: «می شود»، «کتاب ها»، «بزرگ تر» | خودکار |
35
+ | `kashi/no-invalid-zwnj` | نیم‌فاصلهٔ تکراری یا بی‌جا | خودکار |
36
+ | `kashi/punctuation-spacing` | فاصله پیش از «،؛؟!» یا نبودنش پس از آن‌ها | خودکار |
37
+ | `kashi/persian-punctuation` | «?»، «,» و «;» لاتین در متن فارسی | خودکار |
38
+ | `kashi/no-kashida` | کشیده (ـ) | خودکار |
39
+ | `kashi/no-extra-diacritics` | اعراب تکراری یا بی‌پایه (`mode: "all"` برای همهٔ اعراب) | خودکار |
40
+ | `kashi/no-bidi-control` | نویسه‌های override (Trojan Source) و LRM/RLM بی‌جا | خودکار |
41
+ | `kashi/html-dir-lang` | `<html>` بی `dir` یا `lang`، یا ناهماهنگ | خودکار |
42
+ | `kashi/no-physical-style` | `marginLeft`، `left`، `textAlign: "right"` و `direction` در style | خودکار |
43
+ | `kashi/tailwind-logical` | `ml-*`، `left-*`، `text-right`، `rounded-l-*`… (نسخهٔ Tailwind خودکار تشخیص داده می‌شود) | خودکار |
44
+ | `kashi/directional-icon` | آیکون فلش و شورون چپ و راست بی قرینه‌سازی | — |
45
+ | `kashi/no-unknown-token` | `var(--k-…)` با نامی که در کاشی نیست | پیشنهاد |
46
+ | `kashi/prefer-tokens` | رنگ و اندازهٔ ثابتی که توکن کاشی دارد | پیشنهاد |
47
+ | `kashi/prefer-kashi-validators` | regex دستی کد ملی، موبایل، کارت، شبا… و تبدیل دستی ارقام | — |
48
+
49
+ قانون‌های متن رشته‌ها، template literalها، متن JSX، attributeهای متنی و قالب‌های Vue و Svelte را بررسی می‌کنند. نشانی، ایمیل، مسیر، جای‌نگهدار، کد، `import`، کلید شیء و متن داخل `<code>` دست نمی‌خورد.
50
+
51
+ ## تنظیم‌ها
52
+
53
+ ```js
54
+ {
55
+ settings: {
56
+ kashi: {
57
+ direction: "rtl", // جهت اصلی پروژه؛ تعیین می‌کند margin-left به inline-end برود یا inline-start
58
+ locale: "both", // زبان پیام‌ها: "fa" | "en" | "both"
59
+ tailwind: { version: "4.3", prefix: "tw-" },
60
+ },
61
+ },
62
+ }
63
+ ```
64
+
65
+ اصلاح خودکار ظاهر فعلی را در جهت اصلی پروژه نگه می‌دارد: در پروژهٔ راست‌به‌چپ `marginLeft` ← `marginInlineEnd` و `text-right` ← `text-start`.
66
+
67
+ ## ویرایشگر
68
+
69
+ با افزونهٔ ESLint در VS Code یا Cursor هشدارها همان موقع تایپ دیده می‌شوند و با Quick Fix یا هنگام ذخیره (`"source.fixAll.eslint": "explicit"`) درست می‌شوند.
70
+
71
+ ---
72
+
73
+ # English
74
+
75
+ Persian text and right-to-left lint rules for ESLint 9 and 10 (flat config), with autofix. Works in any project, not only Kashi ones. Messages are Persian, English or both (`settings.kashi.locale`). See the rule table above and the [docs](https://kashi.sepantapouya.com/docs/lint/).
76
+
77
+ MIT
@@ -0,0 +1,8 @@
1
+ export declare const KASHI_DATA: {
2
+ version: string;
3
+ names: string[];
4
+ colors: Record<string, string[]>;
5
+ space: Record<string, string>;
6
+ radius: Record<string, string>;
7
+ fontSize: Record<string, string>;
8
+ };