@itcase/lint 1.1.99 → 1.1.101
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,15 @@
|
|
|
1
|
+
## [1.1.101](https://github.com/ITCase/itcase-lint/compare/v1.1.100...v1.1.101) (2026-03-06)
|
|
2
|
+
|
|
3
|
+
### Refactoring
|
|
4
|
+
|
|
5
|
+
* **eslint:** Remove regexp pattern ([c395da5](https://github.com/ITCase/itcase-lint/commit/c395da53639ede77960ce9f42786f928278a8ca1))
|
|
6
|
+
|
|
7
|
+
## [1.1.100](https://github.com/ITCase/itcase-lint/compare/v1.1.99...v1.1.100) (2026-03-06)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **eslint:** Update rules ([5415d30](https://github.com/ITCase/itcase-lint/commit/5415d30190ea23e6b7a55f96734e0fb0e07185bd))
|
|
12
|
+
|
|
1
13
|
## [1.1.99](https://github.com/ITCase/itcase-lint/compare/v1.1.98...v1.1.99) (2026-03-06)
|
|
2
14
|
|
|
3
15
|
### Features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Запрещённые сокращения и допустимые замены.
|
|
3
|
-
*
|
|
3
|
+
* Проверяется только точное совпадение имени идентификатора (например "btn", но не "primaryBtn").
|
|
4
4
|
* - forbidden: сокращение для сообщения об ошибке.
|
|
5
5
|
* - use: что писать вместо (строка или массив вариантов).
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Запрещённые сокращения и допустимые замены.
|
|
3
|
-
*
|
|
3
|
+
* Проверяется только точное совпадение имени идентификатора (например "btn", но не "primaryBtn").
|
|
4
4
|
* - forbidden: сокращение для сообщения об ошибке.
|
|
5
5
|
* - use: что писать вместо (строка или массив вариантов).
|
|
6
6
|
*/
|
|
@@ -32,30 +32,8 @@ const RESTRICTED_WORDS = [
|
|
|
32
32
|
{ forbidden: 'req', use: 'request' },
|
|
33
33
|
{ forbidden: 'str', use: 'string' },
|
|
34
34
|
{ forbidden: 'tst', use: 'test' },
|
|
35
|
-
{ forbidden: 'val', use: 'value' },
|
|
36
35
|
];
|
|
37
36
|
|
|
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
37
|
function buildNoRestrictedSyntaxOptions() {
|
|
60
38
|
if (RESTRICTED_WORDS.length === 0) {
|
|
61
39
|
return 'off';
|
|
@@ -65,11 +43,9 @@ function buildNoRestrictedSyntaxOptions() {
|
|
|
65
43
|
const useText = useList.length === 1
|
|
66
44
|
? `Use "${useList[0]}" instead.`
|
|
67
45
|
: `Use "${useList.join('" or "')}" instead.`;
|
|
68
|
-
const pattern = abbreviationPattern(forbidden);
|
|
69
|
-
const patternEscaped = pattern.replace(/\//g, '\\/');
|
|
70
46
|
return {
|
|
71
|
-
message: `Using "${forbidden}"
|
|
72
|
-
selector: `Identifier[name
|
|
47
|
+
message: `Using "${forbidden}" as an identifier is not allowed. ${useText}`,
|
|
48
|
+
selector: `Identifier[name="${forbidden}"]`,
|
|
73
49
|
};
|
|
74
50
|
});
|
|
75
51
|
return ['error', ...selectors];
|
package/dist/eslint/storybook.js
CHANGED
package/dist/eslint.js
CHANGED
|
@@ -13,7 +13,7 @@ import globals from 'globals';
|
|
|
13
13
|
import eslintTypeScript from 'typescript-eslint';
|
|
14
14
|
import { s as sortUnionTypes, a as sortObjectTypes, b as sortObjects, c as sortExports, d as sortNamedExports, e as sortMaps, f as sortJSXProps, g as sortIntersectionTypes, h as sortInterfaces, i as sortEnums } from './sortUnionTypes_G8w5Oj3O.js';
|
|
15
15
|
import parser from '@typescript-eslint/parser';
|
|
16
|
-
import { i as itcaseLintPlugin, p as pluginName, r as ruleName, s as storybookConfig } from './
|
|
16
|
+
import { i as itcaseLintPlugin, p as pluginName, r as ruleName, s as storybookConfig } from './index_BUaP0Zu6.js';
|
|
17
17
|
import { noRestrictedSyntaxRestrictWords } from './eslint/restrictWords.js';
|
|
18
18
|
export { default as eslintFigma } from './eslint/figma.js';
|
|
19
19
|
import 'eslint-plugin-storybook';
|
|
@@ -280,9 +280,9 @@ const MESSAGE_IDS = {
|
|
|
280
280
|
urlMustContainFigma: 'urlMustContainFigma',
|
|
281
281
|
};
|
|
282
282
|
const MESSAGES = {
|
|
283
|
-
[MESSAGE_IDS.missingOrEmptyUrl]: 'parameters.design.url
|
|
284
|
-
[MESSAGE_IDS.typeMustBeFigma]: 'parameters.design.type
|
|
285
|
-
[MESSAGE_IDS.urlMustContainFigma]: 'parameters.design.url
|
|
283
|
+
[MESSAGE_IDS.missingOrEmptyUrl]: 'parameters.design.url is required and must not be empty.',
|
|
284
|
+
[MESSAGE_IDS.typeMustBeFigma]: 'parameters.design.type must be "figma".',
|
|
285
|
+
[MESSAGE_IDS.urlMustContainFigma]: 'parameters.design.url must contain a link to figma.com.',
|
|
286
286
|
};
|
|
287
287
|
|
|
288
288
|
function getPropertyName(key) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/lint",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.101",
|
|
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",
|