@itcase/lint 1.1.100 → 1.1.102
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [1.1.102](https://github.com/ITCase/itcase-lint/compare/v1.1.101...v1.1.102) (2026-03-11)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **eslint:** Add res to reposne ([f6b241b](https://github.com/ITCase/itcase-lint/commit/f6b241bced3b6ecebf8a2257f09045849b763629))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **eslint:** E > Event | Element ([a9fc74e](https://github.com/ITCase/itcase-lint/commit/a9fc74e2a9418cd35d516f378137eb7a2e3e9dc3))
|
|
10
|
+
* **other:** Updarw deps bot ([b973f18](https://github.com/ITCase/itcase-lint/commit/b973f18cd531aa18bbabd2187eb3c0960d1bda3f))
|
|
11
|
+
|
|
12
|
+
## [1.1.101](https://github.com/ITCase/itcase-lint/compare/v1.1.100...v1.1.101) (2026-03-06)
|
|
13
|
+
|
|
14
|
+
### Refactoring
|
|
15
|
+
|
|
16
|
+
* **eslint:** Remove regexp pattern ([c395da5](https://github.com/ITCase/itcase-lint/commit/c395da53639ede77960ce9f42786f928278a8ca1))
|
|
17
|
+
|
|
1
18
|
## [1.1.100](https://github.com/ITCase/itcase-lint/compare/v1.1.99...v1.1.100) (2026-03-06)
|
|
2
19
|
|
|
3
20
|
### Bug Fixes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Запрещённые сокращения и допустимые замены.
|
|
3
|
-
*
|
|
3
|
+
* Проверяется только точное совпадение имени идентификатора (например "btn", но не "primaryBtn").
|
|
4
4
|
* - forbidden: сокращение для сообщения об ошибке.
|
|
5
5
|
* - use: что писать вместо (строка или массив вариантов).
|
|
6
6
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Запрещённые сокращения и допустимые замены.
|
|
3
|
-
*
|
|
3
|
+
* Проверяется только точное совпадение имени идентификатора (например "btn", но не "primaryBtn").
|
|
4
4
|
* - forbidden: сокращение для сообщения об ошибке.
|
|
5
5
|
* - use: что писать вместо (строка или массив вариантов).
|
|
6
6
|
*/
|
|
7
7
|
const RESTRICTED_WORDS = [
|
|
8
|
+
{ forbidden: 'e', use: ['event', 'element'] },
|
|
8
9
|
{ forbidden: 'btn', use: 'button' },
|
|
9
10
|
{ forbidden: 'lbl', use: 'label' },
|
|
10
11
|
{ forbidden: 'lnk', use: 'link' },
|
|
@@ -13,6 +14,7 @@ const RESTRICTED_WORDS = [
|
|
|
13
14
|
{ forbidden: 'pw', use: 'password' },
|
|
14
15
|
{ forbidden: 'pwd', use: 'password' },
|
|
15
16
|
{ forbidden: 'usr', use: 'user' },
|
|
17
|
+
{ forbidden: 'res', use: 'response' },
|
|
16
18
|
{ forbidden: 'mod', use: ['modify', 'module'] },
|
|
17
19
|
{ forbidden: 'tmp', use: 'temporary' },
|
|
18
20
|
{ forbidden: 'dir', use: ['directory', 'direction'] },
|
|
@@ -32,30 +34,8 @@ const RESTRICTED_WORDS = [
|
|
|
32
34
|
{ forbidden: 'req', use: 'request' },
|
|
33
35
|
{ forbidden: 'str', use: 'string' },
|
|
34
36
|
{ forbidden: 'tst', use: 'test' },
|
|
35
|
-
{ forbidden: 'val', use: 'value' },
|
|
36
37
|
];
|
|
37
38
|
|
|
38
|
-
/** Escape special regex characters in the forbidden word. */
|
|
39
|
-
function escapeRegex(source) {
|
|
40
|
-
return source.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Regex to match abbreviation inside identifier (camelCase):
|
|
44
|
-
* - at start (^) or after lowercase ([a-z]);
|
|
45
|
-
* - then the abbreviation (first char may be upper in camelCase, e.g. Btn);
|
|
46
|
-
* - then end ($) or next uppercase ([A-Z]).
|
|
47
|
-
* Matches: "btn", "primaryBtn", "submitBtn". Does not match: "button".
|
|
48
|
-
*/
|
|
49
|
-
function abbreviationPattern(forbidden) {
|
|
50
|
-
if (forbidden.length === 0)
|
|
51
|
-
return '(?!.)';
|
|
52
|
-
const first = forbidden[0];
|
|
53
|
-
const restEscaped = escapeRegex(forbidden.slice(1));
|
|
54
|
-
const firstCharClass = first === first.toUpperCase()
|
|
55
|
-
? escapeRegex(first)
|
|
56
|
-
: `[${first}${first.toUpperCase()}]`;
|
|
57
|
-
return `(^|[a-z])${firstCharClass}${restEscaped}([A-Z]|$)`;
|
|
58
|
-
}
|
|
59
39
|
function buildNoRestrictedSyntaxOptions() {
|
|
60
40
|
if (RESTRICTED_WORDS.length === 0) {
|
|
61
41
|
return 'off';
|
|
@@ -65,11 +45,9 @@ function buildNoRestrictedSyntaxOptions() {
|
|
|
65
45
|
const useText = useList.length === 1
|
|
66
46
|
? `Use "${useList[0]}" instead.`
|
|
67
47
|
: `Use "${useList.join('" or "')}" instead.`;
|
|
68
|
-
const pattern = abbreviationPattern(forbidden);
|
|
69
|
-
const patternEscaped = pattern.replace(/\//g, '\\/');
|
|
70
48
|
return {
|
|
71
|
-
message: `Using "${forbidden}"
|
|
72
|
-
selector: `Identifier[name
|
|
49
|
+
message: `Using "${forbidden}" as an identifier is not allowed. ${useText}`,
|
|
50
|
+
selector: `Identifier[name="${forbidden}"]`,
|
|
73
51
|
};
|
|
74
52
|
});
|
|
75
53
|
return ['error', ...selectors];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/lint",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.102",
|
|
4
4
|
"author": "ITCase",
|
|
5
5
|
"description": "Code style linter configuration presets",
|
|
6
6
|
"engines": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"@figma/eslint-plugin-figma-plugins": "^1.0.0",
|
|
52
52
|
"@eslint/js": "^10.0.1",
|
|
53
53
|
"@eslint/markdown": "^7.5.1",
|
|
54
|
-
"@html-eslint/eslint-plugin": "^0.58.
|
|
55
|
-
"@html-eslint/parser": "^0.58.
|
|
54
|
+
"@html-eslint/eslint-plugin": "^0.58.1",
|
|
55
|
+
"@html-eslint/parser": "^0.58.1",
|
|
56
56
|
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
57
57
|
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
58
58
|
"@typescript-eslint/parser": "^8.56.1",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
95
95
|
"@rollup/plugin-terser": "^1.0.0",
|
|
96
96
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
97
|
-
"@types/node": "^25.3.
|
|
97
|
+
"@types/node": "^25.3.5",
|
|
98
98
|
"@types/react": "^18.3.0",
|
|
99
99
|
"@typescript-eslint/rule-tester": "^8.56.1",
|
|
100
100
|
"conventional-changelog-conventionalcommits": "^9.3.0",
|