@swisspost/design-system-eslint 10.0.0-next.66 → 10.0.0-next.68
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/dist/configs/unicorn.d.ts +8 -0
- package/dist/configs/unicorn.d.ts.map +1 -0
- package/dist/configs/unicorn.js +26 -0
- package/dist/configs/unicorn.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/rules/html/migrations/index.d.ts +1 -0
- package/dist/rules/html/migrations/index.d.ts.map +1 -1
- package/dist/rules/html/migrations/index.js +5 -1
- package/dist/rules/html/migrations/index.js.map +1 -1
- package/dist/rules/html/migrations/no-deprecated-alert.d.ts.map +1 -1
- package/dist/rules/html/migrations/no-deprecated-alert.js +2 -1
- package/dist/rules/html/migrations/no-deprecated-alert.js.map +1 -1
- package/dist/rules/html/migrations/no-deprecated-css-classes.d.ts.map +1 -1
- package/dist/rules/html/migrations/no-deprecated-css-classes.js +2 -0
- package/dist/rules/html/migrations/no-deprecated-css-classes.js.map +1 -1
- package/dist/rules/html/migrations/no-deprecated-font-sizes.d.ts.map +1 -1
- package/dist/rules/html/migrations/no-deprecated-font-sizes.js +3 -1
- package/dist/rules/html/migrations/no-deprecated-font-sizes.js.map +1 -1
- package/dist/rules/html/migrations/no-deprecated-responsive-spacing-utilities.d.ts +4 -0
- package/dist/rules/html/migrations/no-deprecated-responsive-spacing-utilities.d.ts.map +1 -0
- package/dist/rules/html/migrations/no-deprecated-responsive-spacing-utilities.js +32 -0
- package/dist/rules/html/migrations/no-deprecated-responsive-spacing-utilities.js.map +1 -0
- package/dist/rules/html/migrations/no-deprecated-tag-danger.d.ts +4 -0
- package/dist/rules/html/migrations/no-deprecated-tag-danger.d.ts.map +1 -0
- package/dist/rules/html/migrations/no-deprecated-tag-danger.js +14 -0
- package/dist/rules/html/migrations/no-deprecated-tag-danger.js.map +1 -0
- package/dist/utils/class-binding-helpers.d.ts +13 -0
- package/dist/utils/class-binding-helpers.d.ts.map +1 -0
- package/dist/utils/class-binding-helpers.js +56 -0
- package/dist/utils/class-binding-helpers.js.map +1 -0
- package/dist/utils/create-class-update-rule.d.ts.map +1 -1
- package/dist/utils/create-class-update-rule.js +11 -53
- package/dist/utils/create-class-update-rule.js.map +1 -1
- package/dist/utils/create-responsive-class-update-rule.d.ts +29 -0
- package/dist/utils/create-responsive-class-update-rule.d.ts.map +1 -0
- package/dist/utils/create-responsive-class-update-rule.js +123 -0
- package/dist/utils/create-responsive-class-update-rule.js.map +1 -0
- package/dist/utils/empty-attrs-remover.d.ts +4 -0
- package/dist/utils/empty-attrs-remover.d.ts.map +1 -0
- package/dist/utils/empty-attrs-remover.js +10 -0
- package/dist/utils/empty-attrs-remover.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
/**
|
|
3
|
+
* ESLint configuration for eslint-plugin-unicorn rules.
|
|
4
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: () => TSESLint.FlatConfig.ConfigArray;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=unicorn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unicorn.d.ts","sourceRoot":"","sources":["../../src/configs/unicorn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;;GAGG;8BACgB,QAAQ,CAAC,UAAU,CAAC,WAAW;AAAlD,wBAcE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const eslint_plugin_unicorn_1 = __importDefault(require("eslint-plugin-unicorn"));
|
|
7
|
+
/**
|
|
8
|
+
* ESLint configuration for eslint-plugin-unicorn rules.
|
|
9
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
10
|
+
*/
|
|
11
|
+
exports.default = () => [
|
|
12
|
+
{
|
|
13
|
+
name: '@swisspost/design-system-eslint/unicorn-recommended',
|
|
14
|
+
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
15
|
+
plugins: {
|
|
16
|
+
unicorn: eslint_plugin_unicorn_1.default,
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
...eslint_plugin_unicorn_1.default.configs.recommended.rules,
|
|
20
|
+
// Disable rules that may conflict with the project's conventions
|
|
21
|
+
'unicorn/filename-case': 'off',
|
|
22
|
+
'unicorn/prevent-abbreviations': 'off',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
//# sourceMappingURL=unicorn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unicorn.js","sourceRoot":"","sources":["../../src/configs/unicorn.ts"],"names":[],"mappings":";;;;;AACA,kFAAkD;AAElD;;;GAGG;AACH,kBAAe,GAAoC,EAAE,CAAC;IACpD;QACE,IAAI,EAAE,qDAAqD;QAC3D,KAAK,EAAE,CAAC,sCAAsC,CAAC;QAC/C,OAAO,EAAE;YACP,OAAO,EAAE,+BAAa;SACvB;QACD,KAAK,EAAE;YACL,GAAG,+BAAa,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;YAC1C,iEAAiE;YACjE,uBAAuB,EAAE,KAAK;YAC9B,+BAA+B,EAAE,KAAK;SACvC;KACF;CACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare const configs: {
|
|
|
8
8
|
tsAll: TSESLint.FlatConfig.ConfigArray;
|
|
9
9
|
tsRecommended: TSESLint.FlatConfig.ConfigArray;
|
|
10
10
|
stencilRecommended: TSESLint.FlatConfig.Config;
|
|
11
|
+
unicornRecommended: TSESLint.FlatConfig.ConfigArray;
|
|
11
12
|
};
|
|
12
13
|
declare const _default: {
|
|
13
14
|
htmlParser: {
|
|
@@ -24,6 +25,7 @@ declare const _default: {
|
|
|
24
25
|
tsAll: TSESLint.FlatConfig.ConfigArray;
|
|
25
26
|
tsRecommended: TSESLint.FlatConfig.ConfigArray;
|
|
26
27
|
stencilRecommended: TSESLint.FlatConfig.Config;
|
|
28
|
+
unicornRecommended: TSESLint.FlatConfig.ConfigArray;
|
|
27
29
|
};
|
|
28
30
|
};
|
|
29
31
|
export default _default;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAa5C,QAAA,MAAM,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,MAKrC,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,MAQnC,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;;;CAOZ,CAAC;;;;;;;;;;;;;;;;;;;AAGF,wBAKE;AACF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ const recommended_1 = __importDefault(require("./configs/html/recommended"));
|
|
|
15
15
|
const all_2 = __importDefault(require("./configs/ts/all"));
|
|
16
16
|
const recommended_2 = __importDefault(require("./configs/ts/recommended"));
|
|
17
17
|
const recommended_3 = __importDefault(require("./configs/stencil/recommended"));
|
|
18
|
+
const unicorn_1 = __importDefault(require("./configs/unicorn"));
|
|
18
19
|
const htmlPlugin = {
|
|
19
20
|
rules: html_2.htmlRules,
|
|
20
21
|
meta: {
|
|
@@ -38,6 +39,7 @@ const configs = {
|
|
|
38
39
|
tsAll: (0, all_2.default)(tsPlugin, typescript_eslint_1.parser),
|
|
39
40
|
tsRecommended: (0, recommended_2.default)(tsPlugin, typescript_eslint_1.parser),
|
|
40
41
|
stencilRecommended: (0, recommended_3.default)(tsPlugin, typescript_eslint_1.parser),
|
|
42
|
+
unicornRecommended: (0, unicorn_1.default)(),
|
|
41
43
|
};
|
|
42
44
|
exports.configs = configs;
|
|
43
45
|
/* default and named exports allow people to use this package from both CJS and ESM. */
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AACA,yDAA2C;AAC3C,yCAA4C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AACA,yDAA2C;AAC3C,yCAA4C;AA8CnC,2FA9CA,iBAAU,OA8CA;AA5CnB,uCAAyC;AACzC,mCAAqC;AACrC,mCAAyC;AAEzC,6DAA+C;AAC/C,6EAA+D;AAC/D,2DAA2C;AAC3C,2EAA2D;AAC3D,gFAAqE;AACrE,gEAAyD;AAEzD,MAAM,UAAU,GAA+B;IAC7C,KAAK,EAAE,gBAAS;IAChB,IAAI,EAAE;QACJ,IAAI,EAAE,6CAA6C;KACpD;CACF,CAAC;AA4BmB,gCAAU;AA1B/B,MAAM,QAAQ,GAA+B;IAC3C,KAAK,EAAE;QACL,GAAG,YAAO,EAAE,8CAA8C;QAC1D,GAAG,sBAAc,EAAE,iCAAiC;KACrD;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,wCAAwC;KAC/C;CACF,CAAC;AAkB+B,4BAAQ;AAhBzC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,IAAA,aAAa,EAAC,UAAU,EAAE,iBAAU,CAAC;IAC9C,eAAe,EAAE,IAAA,qBAAqB,EAAC,UAAU,EAAE,iBAAU,CAAC;IAC9D,KAAK,EAAE,IAAA,aAAW,EAAC,QAAQ,EAAE,0BAAM,CAAC;IACpC,aAAa,EAAE,IAAA,qBAAmB,EAAC,QAAQ,EAAE,0BAAM,CAAC;IACpD,kBAAkB,EAAE,IAAA,qBAAwB,EAAC,QAAQ,EAAE,0BAAM,CAAC;IAC9D,kBAAkB,EAAE,IAAA,iBAAwB,GAAE;CAC/C,CAAC;AASyC,0BAAO;AAPlD,uFAAuF;AACvF,kBAAe;IACb,UAAU,EAAV,iBAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;CACR,CAAC"}
|
|
@@ -4,5 +4,6 @@ export declare const htmlMigrationRules: {
|
|
|
4
4
|
"no-deprecated-breakpoints-phase-2": import("@typescript-eslint/utils/ts-eslint").RuleModule<string, [], import("../../../utils/create-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
5
|
"no-deprecated-font-sizes": import("@typescript-eslint/utils/ts-eslint").RuleModule<string, [], import("../../../utils/create-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
6
6
|
"no-deprecated-alert": import("@typescript-eslint/utils/ts-eslint").RuleModule<"deprecatedAlert", [], import("../../../utils/create-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
7
|
+
"no-deprecated-responsive-spacing-utilities": import("@typescript-eslint/utils/ts-eslint").RuleModule<string, [], import("../../../utils/create-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
7
8
|
};
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rules/html/migrations/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rules/html/migrations/index.ts"],"names":[],"mappings":"AAyDA,eAAO,MAAM,kBAAkB;;;;;;;CA4B9B,CAAC"}
|
|
@@ -52,8 +52,10 @@ const no_deprecated_font_sizes_1 = __importStar(require("./no-deprecated-font-si
|
|
|
52
52
|
const no_deprecated_chip_filter_1 = __importStar(require("./no-deprecated-chip-filter"));
|
|
53
53
|
const no_deprecated_alert_1 = __importStar(require("./no-deprecated-alert"));
|
|
54
54
|
const no_deprecated_position_helpers_1 = __importStar(require("./no-deprecated-position-helpers"));
|
|
55
|
+
const no_deprecated_tag_danger_1 = __importStar(require("./no-deprecated-tag-danger"));
|
|
55
56
|
const no_deprecated_breakpoints_1 = require("./no-deprecated-breakpoints");
|
|
56
57
|
const no_deprecated_css_classes_1 = __importStar(require("./no-deprecated-css-classes"));
|
|
58
|
+
const no_deprecated_responsive_spacing_utilities_1 = __importStar(require("./no-deprecated-responsive-spacing-utilities"));
|
|
57
59
|
exports.htmlMigrationRules = {
|
|
58
60
|
[no_deprecated_breakpoints_1.namePhase1]: no_deprecated_breakpoints_1.rulePhase1,
|
|
59
61
|
[no_deprecated_breakpoints_1.namePhase2]: no_deprecated_breakpoints_1.rulePhase2,
|
|
@@ -63,7 +65,7 @@ exports.htmlMigrationRules = {
|
|
|
63
65
|
[no_deprecated_spacing_utilities_1.rules[0].name]: no_deprecated_spacing_utilities_1.rules[0].rule,
|
|
64
66
|
[no_deprecated_spacing_utilities_1.rules[1].name]: no_deprecated_spacing_utilities_1.rules[1].rule,
|
|
65
67
|
[no_deprecated_sizing_utilities_1.rules[0].name]: no_deprecated_sizing_utilities_1.rules[0].rule,
|
|
66
|
-
[no_deprecated_sizing_utilities_1.rules[
|
|
68
|
+
[no_deprecated_sizing_utilities_1.rules[1].name]: no_deprecated_sizing_utilities_1.rules[1].rule,
|
|
67
69
|
[no_deprecated_gutter_utilities_1.rules[0].name]: no_deprecated_gutter_utilities_1.rules[0].rule,
|
|
68
70
|
[no_deprecated_gutter_utilities_1.rules[1].name]: no_deprecated_gutter_utilities_1.rules[1].rule,
|
|
69
71
|
[no_deprecated_gap_utilities_1.rules[0].name]: no_deprecated_gap_utilities_1.rules[0].rule,
|
|
@@ -80,5 +82,7 @@ exports.htmlMigrationRules = {
|
|
|
80
82
|
[no_deprecated_chip_filter_1.name]: no_deprecated_chip_filter_1.default,
|
|
81
83
|
[no_deprecated_alert_1.name]: no_deprecated_alert_1.default,
|
|
82
84
|
[no_deprecated_css_classes_1.name]: no_deprecated_css_classes_1.default,
|
|
85
|
+
[no_deprecated_tag_danger_1.name]: no_deprecated_tag_danger_1.default,
|
|
86
|
+
[no_deprecated_responsive_spacing_utilities_1.name]: no_deprecated_responsive_spacing_utilities_1.default,
|
|
83
87
|
};
|
|
84
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rules/html/migrations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAkG;AAClG,+EAAoG;AACpG,6FAEuC;AACvC,uFAA0F;AAC1F,qFAAwF;AACxF,qFAAwF;AACxF,+EAAkF;AAClF,+DAA4E;AAC5E,yFAEqC;AACrC,mGAE0C;AAC1C,yGAE6C;AAC7C,uFAEoC;AACpC,mGAE0C;AAC1C,yFAEqC;AACrC,uFAEoC;AACpC,yFAEqC;AACrC,6EAAyF;AACzF,mGAE0C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rules/html/migrations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAkG;AAClG,+EAAoG;AACpG,6FAEuC;AACvC,uF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AC,mCAAwB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,mCAAwB,CAAC,CAAC,CAAC,CAAC,IAAI;IACpE,CAAC,mBAAkB,CAAC,EAAE,sBAAc;IACpC,CAAC,gCAA8B,CAAC,EAAE,mCAA0B;IAC5D,CAAC,qCAAmC,CAAC,EAAE,wCAA+B;IACtE,CAAC,+BAAyB,CAAC,EAAE,kCAAqB;IAClD,CAAC,qCAAmC,CAAC,EAAE,wCAA+B;IACtE,CAAC,gCAA8B,CAAC,EAAE,mCAA0B;IAC5D,CAAC,qCAAmC,CAAC,EAAE,wCAA+B;IACtE,CAAC,wCAAsC,CAAC,EAAE,2CAAkC;IAC5E,CAAC,+BAA6B,CAAC,EAAE,kCAAyB;IAC1D,CAAC,gCAA0B,CAAC,EAAE,mCAAsB;IACpD,CAAC,0BAAqB,CAAC,EAAE,6BAAiB;IAC1C,CAAC,gCAA8B,CAAC,EAAE,mCAAsB;IACxD,CAAC,+BAAyB,CAAC,EAAE,kCAAqB;IAClD,CAAC,iDAA8C,CAAC,EAAE,oDAA0C;CAC7F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-deprecated-alert.d.ts","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-alert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-deprecated-alert.d.ts","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-alert.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,wBAAwB,CAAC;;AAE1C,wBAwCG"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.name = void 0;
|
|
4
4
|
const create_rule_1 = require("../../../utils/create-rule");
|
|
5
|
+
const empty_attrs_remover_1 = require("../../../utils/empty-attrs-remover");
|
|
5
6
|
exports.name = 'no-deprecated-alert';
|
|
6
7
|
exports.default = (0, create_rule_1.createRule)({
|
|
7
8
|
name: exports.name,
|
|
@@ -30,7 +31,7 @@ exports.default = (0, create_rule_1.createRule)({
|
|
|
30
31
|
messageId: 'deprecatedAlert',
|
|
31
32
|
loc: node.loc,
|
|
32
33
|
fix(fixer) {
|
|
33
|
-
const fixedHtml = $node.toString();
|
|
34
|
+
const fixedHtml = (0, empty_attrs_remover_1.removeEmptyAttrs)($node.toString(), context, node);
|
|
34
35
|
return fixer.replaceTextRange(node.range, fixedHtml);
|
|
35
36
|
},
|
|
36
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-deprecated-alert.js","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-alert.ts"],"names":[],"mappings":";;;AAAA,4DAAwD;
|
|
1
|
+
{"version":3,"file":"no-deprecated-alert.js","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-alert.ts"],"names":[],"mappings":";;;AAAA,4DAAwD;AAExD,4EAAsE;AAEzD,QAAA,IAAI,GAAG,qBAAqB,CAAC;AAE1C,kBAAe,IAAA,wBAAU,EAAC;IACxB,IAAI,EAAJ,YAAI;IACJ,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,GAAG,EAAE,MAAM;YACX,WAAW,EAAE,mEAAmE;SACjF;QACD,QAAQ,EAAE;YACR,eAAe,EACb,oFAAoF;SACvF;QACD,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,GAAG,CAAC,IAAc;gBAChB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;oBAC5C,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;wBAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;wBAE/B,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;4BACnE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,aAAa,CAAC;4BAE9B,OAAO,CAAC,MAAM,CAAC;gCACb,SAAS,EAAE,iBAAiB;gCAC5B,GAAG,EAAE,IAAI,CAAC,GAAG;gCACb,GAAG,CAAC,KAAK;oCACP,MAAM,SAAS,GAAG,IAAA,sCAAgB,EAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;oCACpE,OAAO,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;gCACvD,CAAC;6BACF,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-deprecated-css-classes.d.ts","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-css-classes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-deprecated-css-classes.d.ts","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-css-classes.ts"],"names":[],"mappings":"AAuGA,eAAO,MAAM,UAAU;;;GAGpB,CAAC;AAEJ,eAAO,MAAQ,IAAI,UAAE,IAAI,+KAKvB,CAAC;AAEH,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-deprecated-css-classes.js","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-css-classes.ts"],"names":[],"mappings":";;;;AAAA,sFAAuF;AAEvF,kBAAkB;AAClB,MAAM,UAAU,GAAa;IAC3B,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,iBAAiB;IACjB,kBAAkB;IAClB,uBAAuB;IACvB,wBAAwB;IACxB,qBAAqB;IACrB,qBAAqB;IACrB,qBAAqB;IACrB,qBAAqB;IACrB,qBAAqB;IACrB,qBAAqB;IACrB,sBAAsB;IACtB,YAAY;IACZ,WAAW;IACX,WAAW;IACX,UAAU;IACV,UAAU;IACV,WAAW;IACX,aAAa;IACb,eAAe;IACf,aAAa;IACb,aAAa;IACb,WAAW;IACX,UAAU;IACV,wBAAwB;IACxB,wBAAwB;IACxB,sBAAsB;IACtB,eAAe;IACf,sBAAsB;IACtB,YAAY;IACZ,mBAAmB;IACnB,WAAW;IACX,kBAAkB;IAClB,WAAW;IACX,kBAAkB;IAClB,YAAY;IACZ,mBAAmB;IACnB,eAAe;IACf,sBAAsB;IACtB,UAAU;IACV,UAAU;IACV,UAAU;IACV,WAAW;IACX,UAAU;IACV,mBAAmB;IACnB,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,gBAAgB;IAChB,UAAU;IACV,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,eAAe;IACf,iBAAiB;IACjB,aAAa;IACb,YAAY;IACZ,eAAe;IACf,eAAe;IACf,aAAa;IACb,YAAY;IACZ,SAAS;IACT,yBAAyB;IACzB,2BAA2B;IAC3B,2BAA2B;IAC3B,WAAW;IACX,QAAQ;IACR,iBAAiB;IACjB,cAAc;IACd,eAAe;IACf,eAAe;IACf,kBAAkB;IAClB,qBAAqB;IACrB,aAAa;IACb,UAAU;IACV,gBAAgB;IAChB,uBAAuB;IACvB,aAAa;IACb,oBAAoB;IACpB,YAAY;IACZ,mBAAmB;IACnB,YAAY;IACZ,mBAAmB;IACnB,aAAa;IACb,oBAAoB;IACpB,gBAAgB;IAChB,uBAAuB;
|
|
1
|
+
{"version":3,"file":"no-deprecated-css-classes.js","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-css-classes.ts"],"names":[],"mappings":";;;;AAAA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oB;IACpB,gBAAgB;IAChB,uBAAuB;IACvB,aAAa;IACb,YAAY;CACb,CAAC;AAEW,QAAA,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACpD,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;IAC1C,GAAG,EAAE,EAAE;CACR,CAAC,CAAC,CAAC;AAES,KAAiB,IAAA,uDAA4B,EAAC;IACzD,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,gDAAgD;IAC7D,UAAU,EAAV,kBAAU;CACX,CAAC,EALa,YAAI,YAAE,YAAI,WAKtB;AAEH,kBAAe,YAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-deprecated-font-sizes.d.ts","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-font-sizes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-deprecated-font-sizes.d.ts","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-font-sizes.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,6BAA6B,CAAC;AAE/C,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAuB9C,CAAC;;AAYF,wBA6CG"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.classesMap = exports.name = void 0;
|
|
4
4
|
const create_rule_1 = require("../../../utils/create-rule");
|
|
5
|
+
const empty_attrs_remover_1 = require("../../../utils/empty-attrs-remover");
|
|
5
6
|
exports.name = 'no-deprecated-font-sizes';
|
|
6
7
|
// Size (sizing utility classes) is for post-icon components; font (font curve utilities) is for the rest (text content)
|
|
7
8
|
exports.classesMap = [
|
|
@@ -63,7 +64,8 @@ exports.default = (0, create_rule_1.createRule)({
|
|
|
63
64
|
const fixedNode = $node
|
|
64
65
|
.removeClass(classMap.old)
|
|
65
66
|
.addClass(isIcon ? classMap.size : classMap.font);
|
|
66
|
-
|
|
67
|
+
const fixedHtml = (0, empty_attrs_remover_1.removeEmptyAttrs)(fixedNode.toString(), context, node);
|
|
68
|
+
return fixer.replaceTextRange(node.range, fixedHtml);
|
|
67
69
|
},
|
|
68
70
|
}
|
|
69
71
|
: {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-deprecated-font-sizes.js","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-font-sizes.ts"],"names":[],"mappings":";;;AAAA,4DAAwD;
|
|
1
|
+
{"version":3,"file":"no-deprecated-font-sizes.js","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-font-sizes.ts"],"names":[],"mappings":";;;AAAA,4DAAwD;AAExD,4EAAsE;AAEzD,QAAA,IAAI,GAAG,0BAA0B,CAAC;AAQ/C,wHAAwH;AAC3G,QAAA,UAAU,GAA4B;IACjD,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE;IACzD,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;IACxD,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;IACxD,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;IACxD,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;IACxD,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE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AAG,CAAC,QAAQ,CAAC,IAAI;oCACf,CAAC,CAAC;wCACE,GAAG,CAAC,KAAK;4CACP,MAAM,SAAS,GAAG,KAAK;iDACpB,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC;iDACzB,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;4CAEpD,MAAM,SAAS,GAAG,IAAA,sCAAgB,EAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;4CACxE,OAAO,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;wCACvD,CAAC;qCACF;oCACH,CAAC,CAAC,EAAE,CAAC;6BACR,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const name = "no-deprecated-responsive-spacing-utilities";
|
|
2
|
+
export declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<string, [], import("../../../utils/create-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>, data: import("../../../utils/create-responsive-class-update-rule").ResponsiveClassUpdateData;
|
|
3
|
+
export default rule;
|
|
4
|
+
//# sourceMappingURL=no-deprecated-responsive-spacing-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-deprecated-responsive-spacing-utilities.d.ts","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-responsive-spacing-utilities.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,IAAI,+CAA+C,CAAC;AAEjE,eAAO,MAAQ,IAAI,iLAAE,IAAI,wFAKvB,CAAC;AAEH,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.data = exports.rule = exports.name = void 0;
|
|
5
|
+
const create_responsive_class_update_rule_1 = require("../../../utils/create-responsive-class-update-rule");
|
|
6
|
+
// Class name prefixes that had responsive variants
|
|
7
|
+
const prefixes = ['m', 'mt', 'mb', 'ml', 'mr', 'p', 'pt', 'pb', 'pl', 'pr', 'gap'];
|
|
8
|
+
// Previous size tokens mapped to the new responsive pixel class suffixes.
|
|
9
|
+
// Entries marked needsReview: true are not 1:1 migrations and must be manually checked.
|
|
10
|
+
const sizeMap = {
|
|
11
|
+
'tiny': { suffixes: ['-12', '-md-16'] },
|
|
12
|
+
'small': { suffixes: ['-12', '-sm-16'] },
|
|
13
|
+
'regular': { suffixes: ['-16', '-md-24'] },
|
|
14
|
+
'large': { suffixes: ['-16', '-md-24', '-lg-32'], needsReview: true },
|
|
15
|
+
'big': { suffixes: ['-24', '-md-32', '-lg-40'], needsReview: true },
|
|
16
|
+
'bigger-big': { suffixes: ['-24', '-md-48'] },
|
|
17
|
+
'huge': { suffixes: ['-32', '-md-40', '-lg-56'], needsReview: true },
|
|
18
|
+
'giant': { suffixes: ['-56', '-md-80'] },
|
|
19
|
+
};
|
|
20
|
+
const classesMap = prefixes.flatMap(prefix => Object.entries(sizeMap).map(([token, { suffixes, needsReview }]) => ({
|
|
21
|
+
old: `${prefix}-${token}-r`,
|
|
22
|
+
new: suffixes.map(s => `${prefix}${s}`),
|
|
23
|
+
needsReview,
|
|
24
|
+
})));
|
|
25
|
+
exports.name = 'no-deprecated-responsive-spacing-utilities';
|
|
26
|
+
_a = (0, create_responsive_class_update_rule_1.createResponsiveClassUpdateRule)({
|
|
27
|
+
name: exports.name,
|
|
28
|
+
description: 'Flags all deprecated responsive spacing utility classes and replaces them with the new ones.',
|
|
29
|
+
classesMap,
|
|
30
|
+
}), exports.rule = _a.rule, exports.data = _a.data;
|
|
31
|
+
exports.default = exports.rule;
|
|
32
|
+
//# sourceMappingURL=no-deprecated-responsive-spacing-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-deprecated-responsive-spacing-utilities.js","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-responsive-spacing-utilities.ts"],"names":[],"mappings":";;;;AAAA,4GAAqG;AAErG,mDAAmD;AACnD,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAEnF,0EAA0E;AAC1E,wFAAwF;AACxF,MAAM,OAAO,GAAkE;IAC7E,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE;IACvC,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE;IACxC,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE;IAC1C,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE;IACrE,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE;IACnE,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE;IAC7C,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE;IACpE,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE;CACzC,CAAC;AAEF,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAC3C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACnE,GAAG,EAAE,GAAG,MAAM,IAAI,KAAK,IAAI;IAC3B,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC;IACvC,WAAW;CACZ,CAAC,CAAC,CACJ,CAAC;AAEW,QAAA,IAAI,GAAG,4CAA4C,CAAC;AAEpD,KAAiB,IAAA,qEAA+B,EAAC;IAC5D,IAAI,EAAJ,YAAI;IACJ,WAAW,EACT,8FAA8F;IAChG,UAAU;CACX,CAAC,EALa,YAAI,YAAE,YAAI,WAKtB;AAEH,kBAAe,YAAI,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const messageId = "deprecatedTagDanger";
|
|
2
|
+
export declare const name: string, rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<string, [], import("../../../utils/create-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
|
+
export default rule;
|
|
4
|
+
//# sourceMappingURL=no-deprecated-tag-danger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-deprecated-tag-danger.d.ts","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-tag-danger.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAE/C,eAAO,MAAQ,IAAI,UAAE,IAAI,+KAKvB,CAAC;AAEH,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.rule = exports.name = exports.messageId = void 0;
|
|
5
|
+
const create_class_update_rule_1 = require("../../../utils/create-class-update-rule");
|
|
6
|
+
exports.messageId = 'deprecatedTagDanger';
|
|
7
|
+
_a = (0, create_class_update_rule_1.createClassUpdateRuleWrapper)({
|
|
8
|
+
name: 'no-deprecated-tag-danger',
|
|
9
|
+
type: 'problem',
|
|
10
|
+
description: 'Flags deprecated "tag-danger" class and replaces it with "tag-error".',
|
|
11
|
+
classesMap: [{ old: 'tag-danger', new: 'tag-error' }],
|
|
12
|
+
}), exports.name = _a.name, exports.rule = _a.rule;
|
|
13
|
+
exports.default = exports.rule;
|
|
14
|
+
//# sourceMappingURL=no-deprecated-tag-danger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-deprecated-tag-danger.js","sourceRoot":"","sources":["../../../../src/rules/html/migrations/no-deprecated-tag-danger.ts"],"names":[],"mappings":";;;;AAAA,sFAAuF;AAE1E,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAElC,KAAiB,IAAA,uDAA4B,EAAC;IACzD,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,uEAAuE;IACpF,UAAU,EAAE,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;CACtD,CAAC,EALa,YAAI,YAAE,YAAI,WAKtB;AAEH,kBAAe,YAAI,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AnyNode } from 'domhandler';
|
|
2
|
+
import type { Cheerio } from 'cheerio';
|
|
3
|
+
export declare function getDynamicClassType(attrName: string, value: string | undefined, oldClass: string): {
|
|
4
|
+
isClassBinding: boolean;
|
|
5
|
+
isNgClass: boolean;
|
|
6
|
+
isClass: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function isStringLiteral(value: string): boolean;
|
|
9
|
+
export declare function isObjectLiteral(value: string): boolean;
|
|
10
|
+
export declare function getNewAttrValue($node: Cheerio<AnyNode>, attrName: string, oldClass: string, newClass: string, value: string): string | null;
|
|
11
|
+
export declare function updateStringLiteral(value: string, oldClass: string, newClass: string): string;
|
|
12
|
+
export declare function updateObjectLiteral(rawAttr: string, oldClass: string, newClass: string): string | null;
|
|
13
|
+
//# sourceMappingURL=class-binding-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-binding-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/class-binding-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGvC,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,QAAQ,EAAE,MAAM,GACf;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAUnE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAItD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,EACvB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,IAAI,CAQf;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQ7F;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,IAAI,CAWf"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDynamicClassType = getDynamicClassType;
|
|
4
|
+
exports.isStringLiteral = isStringLiteral;
|
|
5
|
+
exports.isObjectLiteral = isObjectLiteral;
|
|
6
|
+
exports.getNewAttrValue = getNewAttrValue;
|
|
7
|
+
exports.updateStringLiteral = updateStringLiteral;
|
|
8
|
+
exports.updateObjectLiteral = updateObjectLiteral;
|
|
9
|
+
// Determine type of dynamic class attribute
|
|
10
|
+
function getDynamicClassType(attrName, value, oldClass) {
|
|
11
|
+
const escaped = oldClass.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
12
|
+
const regex = new RegExp(`(^|[^A-Za-z0-9_-])${escaped}([^A-Za-z0-9_-]|$)`);
|
|
13
|
+
const hasExactClass = typeof value === 'string' && regex.test(value);
|
|
14
|
+
return {
|
|
15
|
+
isClassBinding: attrName === `[class.${oldClass}]`,
|
|
16
|
+
isNgClass: attrName.toLowerCase() === '[ngclass]' && hasExactClass,
|
|
17
|
+
isClass: attrName.toLowerCase() === '[class]' && hasExactClass,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function isStringLiteral(value) {
|
|
21
|
+
const first = value[0], last = value.at(-1);
|
|
22
|
+
return ['"', "'", '`'].includes(first) && first === last;
|
|
23
|
+
}
|
|
24
|
+
function isObjectLiteral(value) {
|
|
25
|
+
return value.startsWith('{') && value.endsWith('}');
|
|
26
|
+
}
|
|
27
|
+
function getNewAttrValue($node, attrName, oldClass, newClass, value) {
|
|
28
|
+
if (isStringLiteral(value))
|
|
29
|
+
return updateStringLiteral(value, oldClass, newClass);
|
|
30
|
+
if (isObjectLiteral(value)) {
|
|
31
|
+
const rawAttr = $node.attr(attrName);
|
|
32
|
+
if (!rawAttr)
|
|
33
|
+
return null;
|
|
34
|
+
return updateObjectLiteral(rawAttr, oldClass, newClass);
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
function updateStringLiteral(value, oldClass, newClass) {
|
|
39
|
+
const quote = value[0];
|
|
40
|
+
const inner = value.slice(1, -1);
|
|
41
|
+
const parts = inner
|
|
42
|
+
.split(/\s+/)
|
|
43
|
+
.map(cls => (cls === oldClass ? newClass : cls))
|
|
44
|
+
.filter(Boolean);
|
|
45
|
+
return parts.length ? quote + parts.join(' ') + quote : '';
|
|
46
|
+
}
|
|
47
|
+
function updateObjectLiteral(rawAttr, oldClass, newClass) {
|
|
48
|
+
const sanitized = rawAttr.replace(/['"\s]/g, '');
|
|
49
|
+
const inner = sanitized.slice(1, -1);
|
|
50
|
+
const keys = inner.split(',').map(p => p.split(':')[0]);
|
|
51
|
+
if (!keys.includes(oldClass))
|
|
52
|
+
return null;
|
|
53
|
+
const escapedOldClass = oldClass.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
54
|
+
return rawAttr.replace(new RegExp(`(?<![\\w-])${escapedOldClass}(?![\\w-])`, 'g'), newClass ?? '');
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=class-binding-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-binding-helpers.js","sourceRoot":"","sources":["../../src/utils/class-binding-helpers.ts"],"names":[],"mappings":";;AAIA,kDAcC;AAED,0CAIC;AAED,0CAEC;AAED,0CAcC;AAED,kDAQC;AAED,kDAeC;AApED,4CAA4C;AAC5C,SAAgB,mBAAmB,CACjC,QAAgB,EAChB,KAAyB,EACzB,QAAgB;IAEhB,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAChE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,qBAAqB,OAAO,oBAAoB,CAAC,CAAC;IAC3E,MAAM,aAAa,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAErE,OAAO;QACL,cAAc,EAAE,QAAQ,KAAK,UAAU,QAA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,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE;QACV,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,EAAE,CAAC;CACL;AAED,KAAK,qBAAqB,CAAC,CAAC,IAAI,cAAc,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAChE,KAAK,4BAA4B,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAExE,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpE,QAAQ,qBAAqB,CAAC,CAAC,CAAC,qKAiG9B,CAAC;AAEL,eAAO,MAAM,4BAA4B,GAAI,QAAQ,4BAA4B;;;;CAUhF,CAAC"}
|
|
@@ -4,6 +4,8 @@ exports.createClassUpdateRuleWrapper = exports.createClassUpdateRule = void 0;
|
|
|
4
4
|
const create_rule_1 = require("./create-rule");
|
|
5
5
|
const generate_mutations_1 = require("./generate-mutations");
|
|
6
6
|
const generate_messages_1 = require("./generate-messages");
|
|
7
|
+
const class_binding_helpers_1 = require("./class-binding-helpers");
|
|
8
|
+
const empty_attrs_remover_1 = require("./empty-attrs-remover");
|
|
7
9
|
const createClassUpdateRule = (config) => (0, create_rule_1.createRule)({
|
|
8
10
|
name: config.name,
|
|
9
11
|
meta: {
|
|
@@ -34,7 +36,8 @@ const createClassUpdateRule = (config) => (0, create_rule_1.createRule)({
|
|
|
34
36
|
// Remove empty class attribute
|
|
35
37
|
if (!fixedNode.attr('class')?.trim())
|
|
36
38
|
fixedNode.removeAttr('class');
|
|
37
|
-
|
|
39
|
+
const fixedHtml = (0, empty_attrs_remover_1.removeEmptyAttrs)($node.toString(), context, node);
|
|
40
|
+
return fixer.replaceTextRange(node.range, fixedHtml);
|
|
38
41
|
},
|
|
39
42
|
});
|
|
40
43
|
return;
|
|
@@ -48,7 +51,7 @@ const createClassUpdateRule = (config) => (0, create_rule_1.createRule)({
|
|
|
48
51
|
const attribs = root.attribs;
|
|
49
52
|
for (const attrName of Object.keys(attribs)) {
|
|
50
53
|
const value = $node.attr(attrName);
|
|
51
|
-
const { isClassBinding, isNgClass, isClass } = getDynamicClassType(attrName, value, oldClass);
|
|
54
|
+
const { isClassBinding, isNgClass, isClass } = (0, class_binding_helpers_1.getDynamicClassType)(attrName, value, oldClass);
|
|
52
55
|
if (!isClassBinding && !isNgClass && !isClass)
|
|
53
56
|
continue;
|
|
54
57
|
context.report({
|
|
@@ -62,22 +65,24 @@ const createClassUpdateRule = (config) => (0, create_rule_1.createRule)({
|
|
|
62
65
|
return null;
|
|
63
66
|
$node.attr(fixedAttrName, oldAttrValue);
|
|
64
67
|
$node.removeAttr(`[class.${oldClass}]`);
|
|
65
|
-
|
|
68
|
+
const fixedHtml = (0, empty_attrs_remover_1.removeEmptyAttrs)($node.toString(), context, node);
|
|
69
|
+
return fixer.replaceTextRange(node.range, fixedHtml);
|
|
66
70
|
}
|
|
67
71
|
const raw = $node.attr(attrName)?.trim();
|
|
68
72
|
if (!raw)
|
|
69
73
|
return null;
|
|
70
|
-
const newValue = getNewAttrValue($node, attrName, oldClass, newClass, raw);
|
|
74
|
+
const newValue = (0, class_binding_helpers_1.getNewAttrValue)($node, attrName, oldClass, newClass, raw);
|
|
71
75
|
if (newValue === null)
|
|
72
76
|
return null;
|
|
73
|
-
const targetAttr =
|
|
77
|
+
const targetAttr = attrName;
|
|
74
78
|
if (newValue === '')
|
|
75
79
|
$node.removeAttr(targetAttr);
|
|
76
80
|
else
|
|
77
81
|
$node.attr(targetAttr, newValue);
|
|
78
82
|
if (isNgClass && attrName !== targetAttr)
|
|
79
83
|
$node.removeAttr(attrName);
|
|
80
|
-
|
|
84
|
+
const fixedHtml = (0, empty_attrs_remover_1.removeEmptyAttrs)($node.toString(), context, node);
|
|
85
|
+
return fixer.replaceTextRange(node.range, fixedHtml);
|
|
81
86
|
},
|
|
82
87
|
});
|
|
83
88
|
}
|
|
@@ -87,53 +92,6 @@ const createClassUpdateRule = (config) => (0, create_rule_1.createRule)({
|
|
|
87
92
|
},
|
|
88
93
|
});
|
|
89
94
|
exports.createClassUpdateRule = createClassUpdateRule;
|
|
90
|
-
// Determine type of dynamic class attribute
|
|
91
|
-
function getDynamicClassType(attrName, value, oldClass) {
|
|
92
|
-
const escaped = oldClass.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
93
|
-
const regex = new RegExp(`(^|[^A-Za-z0-9_-])${escaped}([^A-Za-z0-9_-]|$)`);
|
|
94
|
-
const hasExactClass = typeof value === 'string' && regex.test(value);
|
|
95
|
-
return {
|
|
96
|
-
isClassBinding: attrName === `[class.${oldClass}]`,
|
|
97
|
-
isNgClass: attrName.toLowerCase() === '[ngclass]' && hasExactClass,
|
|
98
|
-
isClass: attrName.toLowerCase() === '[class]' && hasExactClass,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function getNewAttrValue($node, attrName, oldClass, newClass, value) {
|
|
102
|
-
if (isStringLiteral(value))
|
|
103
|
-
return updateStringLiteral(value, oldClass, newClass);
|
|
104
|
-
if (isObjectLiteral(value)) {
|
|
105
|
-
const rawAttr = $node.attr(attrName);
|
|
106
|
-
if (!rawAttr)
|
|
107
|
-
return null;
|
|
108
|
-
return updateObjectLiteral(rawAttr, oldClass, newClass);
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
function isStringLiteral(value) {
|
|
113
|
-
const first = value[0], last = value.at(-1);
|
|
114
|
-
return ['"', "'", '`'].includes(first) && first === last;
|
|
115
|
-
}
|
|
116
|
-
function isObjectLiteral(value) {
|
|
117
|
-
return value.startsWith('{') && value.endsWith('}');
|
|
118
|
-
}
|
|
119
|
-
function updateStringLiteral(value, oldClass, newClass) {
|
|
120
|
-
const quote = value[0];
|
|
121
|
-
const inner = value.slice(1, -1);
|
|
122
|
-
const parts = inner
|
|
123
|
-
.split(/\s+/)
|
|
124
|
-
.map(cls => (cls === oldClass ? newClass : cls))
|
|
125
|
-
.filter(Boolean); // remove empty strings if deleting class
|
|
126
|
-
return parts.length ? quote + parts.join(' ') + quote : '';
|
|
127
|
-
}
|
|
128
|
-
function updateObjectLiteral(rawAttr, oldClass, newClass) {
|
|
129
|
-
const sanitized = rawAttr.replace(/['"\s]/g, '');
|
|
130
|
-
const inner = sanitized.slice(1, -1);
|
|
131
|
-
const keys = inner.split(',').map(p => p.split(':')[0]);
|
|
132
|
-
if (!keys.includes(oldClass))
|
|
133
|
-
return null;
|
|
134
|
-
const escapedOldClass = oldClass.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
135
|
-
return rawAttr.replace(new RegExp(`(?<![\\w-])${escapedOldClass}(?![\\w-])`, 'g'), newClass ?? '');
|
|
136
|
-
}
|
|
137
95
|
const createClassUpdateRuleWrapper = (config) => {
|
|
138
96
|
const data = (0, generate_mutations_1.generateReplacedClassMutations)(config.classesMap);
|
|
139
97
|
const rule = (0, exports.createClassUpdateRule)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-class-update-rule.js","sourceRoot":"","sources":["../../src/utils/create-class-update-rule.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAG3C,6DAAsE;AACtE,2DAAoE;
|
|
1
|
+
{"version":3,"file":"create-class-update-rule.js","sourceRoot":"","sources":["../../src/utils/create-class-update-rule.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAG3C,6DAAsE;AACtE,2DAAoE;AACpE,mEAA+E;AAC/E,+DAAyD;AA0BlD,MAAM,qBAAqB,GAAG,CACnC,MAAgC,EAChC,EAAE,CACF,IAAA,wBAAU,EAAC;IACT,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,GAAG,EAAE,MAAM;YACX,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC;QACD,QAA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,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC3C,CAAC,CAAC;AAVW,QAAA,4BAA4B,gCAUvC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
export interface ResponsiveClassMapping {
|
|
3
|
+
old: string;
|
|
4
|
+
new: string[];
|
|
5
|
+
needsReview?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ResponsiveClassUpdateData {
|
|
8
|
+
mutations: Record<string, [string, string[]]>;
|
|
9
|
+
}
|
|
10
|
+
interface ResponsiveRuleConfig {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
classesMap: ResponsiveClassMapping[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates an ESLint rule that replaces a single deprecated class with multiple new classes.
|
|
17
|
+
* Unlike `createClassUpdateRule`, mutations map [oldClass, newClasses[]] (one-to-many).
|
|
18
|
+
* No two-phase approach is needed since the old `-r` suffix classes never collide with new names.
|
|
19
|
+
*
|
|
20
|
+
* Dynamic binding behaviour:
|
|
21
|
+
* - `[class.old]` and object-literal `[ngClass]`/`[class]` are flagged without autofix
|
|
22
|
+
* - String-literal `[ngClass]`/`[class]` are auto-fixed inline
|
|
23
|
+
*/
|
|
24
|
+
export declare const createResponsiveClassUpdateRule: (config: ResponsiveRuleConfig) => {
|
|
25
|
+
rule: TSESLint.RuleModule<string, [], import("./create-rule").RuleDocs, TSESLint.RuleListener>;
|
|
26
|
+
data: ResponsiveClassUpdateData;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=create-responsive-class-update-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-responsive-class-update-rule.d.ts","sourceRoot":"","sources":["../../src/utils/create-responsive-class-update-rule.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;CAC/C;AAED,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,sBAAsB,EAAE,CAAC;CACtC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,GAAI,QAAQ,oBAAoB;;;CAoI3E,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createResponsiveClassUpdateRule = void 0;
|
|
4
|
+
const create_rule_1 = require("./create-rule");
|
|
5
|
+
const class_binding_helpers_1 = require("./class-binding-helpers");
|
|
6
|
+
const empty_attrs_remover_1 = require("./empty-attrs-remover");
|
|
7
|
+
/**
|
|
8
|
+
* Creates an ESLint rule that replaces a single deprecated class with multiple new classes.
|
|
9
|
+
* Unlike `createClassUpdateRule`, mutations map [oldClass, newClasses[]] (one-to-many).
|
|
10
|
+
* No two-phase approach is needed since the old `-r` suffix classes never collide with new names.
|
|
11
|
+
*
|
|
12
|
+
* Dynamic binding behaviour:
|
|
13
|
+
* - `[class.old]` and object-literal `[ngClass]`/`[class]` are flagged without autofix
|
|
14
|
+
* - String-literal `[ngClass]`/`[class]` are auto-fixed inline
|
|
15
|
+
*/
|
|
16
|
+
const createResponsiveClassUpdateRule = (config) => {
|
|
17
|
+
const messages = {};
|
|
18
|
+
const mutations = {};
|
|
19
|
+
config.classesMap.forEach(mapping => {
|
|
20
|
+
const key = mapping.old;
|
|
21
|
+
const newClassesStr = mapping.new.join(' ');
|
|
22
|
+
messages[key] = mapping.needsReview
|
|
23
|
+
? `The "${mapping.old}" class is deprecated. Please replace it with "${newClassesStr}". ⚠️ This is not a 1:1 migration — review the output carefully.`
|
|
24
|
+
: `The "${mapping.old}" class is deprecated. Please replace it with "${newClassesStr}".`;
|
|
25
|
+
mutations[key] = [mapping.old, mapping.new];
|
|
26
|
+
});
|
|
27
|
+
const data = { mutations };
|
|
28
|
+
const handleDynamicBindings = ($node, node, attribs, context) => {
|
|
29
|
+
for (const [messageId, [oldClass, newClasses]] of Object.entries(mutations)) {
|
|
30
|
+
const newClassesStr = newClasses.join(' ');
|
|
31
|
+
for (const attrName of Object.keys(attribs)) {
|
|
32
|
+
const value = $node.attr(attrName);
|
|
33
|
+
const { isClassBinding, isNgClass, isClass } = (0, class_binding_helpers_1.getDynamicClassType)(attrName, value, oldClass);
|
|
34
|
+
if (!isClassBinding && !isNgClass && !isClass)
|
|
35
|
+
continue;
|
|
36
|
+
// `[class.old]` cannot expand to multiple bindings — flag without autofix
|
|
37
|
+
if (isClassBinding) {
|
|
38
|
+
context.report({ messageId, loc: node.loc });
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
// String-literal `[ngClass]`/`[class]` can be fixed inline
|
|
42
|
+
if ((isNgClass || isClass) && value && (0, class_binding_helpers_1.isStringLiteral)(value)) {
|
|
43
|
+
context.report({
|
|
44
|
+
messageId,
|
|
45
|
+
loc: node.loc,
|
|
46
|
+
fix(fixer) {
|
|
47
|
+
const newValue = (0, class_binding_helpers_1.updateStringLiteral)(value, oldClass, newClassesStr);
|
|
48
|
+
const targetAttr = attrName;
|
|
49
|
+
if (newValue === '')
|
|
50
|
+
$node.removeAttr(targetAttr);
|
|
51
|
+
else
|
|
52
|
+
$node.attr(targetAttr, newValue);
|
|
53
|
+
if (isNgClass && attrName !== targetAttr)
|
|
54
|
+
$node.removeAttr(attrName);
|
|
55
|
+
const fixedHtml = (0, empty_attrs_remover_1.removeEmptyAttrs)($node.toString(), context, node);
|
|
56
|
+
return fixer.replaceTextRange(node.range, fixedHtml);
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
// Object-literal `[ngClass]`/`[class]` cannot expand one key to many — flag without autofix
|
|
62
|
+
context.report({ messageId, loc: node.loc });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const rule = (0, create_rule_1.createRule)({
|
|
67
|
+
name: config.name,
|
|
68
|
+
meta: {
|
|
69
|
+
docs: {
|
|
70
|
+
dir: 'html',
|
|
71
|
+
description: config.description,
|
|
72
|
+
},
|
|
73
|
+
messages,
|
|
74
|
+
type: 'problem',
|
|
75
|
+
fixable: 'code',
|
|
76
|
+
schema: [],
|
|
77
|
+
},
|
|
78
|
+
defaultOptions: [],
|
|
79
|
+
create(context) {
|
|
80
|
+
return {
|
|
81
|
+
tag(node) {
|
|
82
|
+
const $node = node.toCheerio();
|
|
83
|
+
// Collect all matching deprecated classes first, then emit a single report
|
|
84
|
+
// with one combined fix to avoid ESLint discarding overlapping fixes
|
|
85
|
+
const matches = [];
|
|
86
|
+
Object.entries(mutations).forEach(([messageId, [oldClass, newClasses]]) => {
|
|
87
|
+
if ($node.hasClass(oldClass)) {
|
|
88
|
+
matches.push({ messageId, oldClass, newClasses });
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
if (matches.length > 0) {
|
|
92
|
+
context.report({
|
|
93
|
+
messageId: matches[0].messageId,
|
|
94
|
+
loc: node.loc,
|
|
95
|
+
fix(fixer) {
|
|
96
|
+
const fixedNode = $node.clone();
|
|
97
|
+
matches.forEach(({ oldClass, newClasses }) => {
|
|
98
|
+
fixedNode.removeClass(oldClass);
|
|
99
|
+
newClasses.forEach(cls => fixedNode.addClass(cls));
|
|
100
|
+
});
|
|
101
|
+
// Remove empty class attribute
|
|
102
|
+
if (!fixedNode.attr('class')?.trim())
|
|
103
|
+
fixedNode.removeAttr('class');
|
|
104
|
+
const fixedHtml = (0, empty_attrs_remover_1.removeEmptyAttrs)(fixedNode.toString(), context, node);
|
|
105
|
+
return fixer.replaceTextRange(node.range, fixedHtml);
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
// Plain `class` attribute handled above — skip dynamic-binding pass
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const root = $node[0];
|
|
112
|
+
if (!root || root.type !== 'tag')
|
|
113
|
+
return;
|
|
114
|
+
const attribs = root.attribs;
|
|
115
|
+
handleDynamicBindings($node, node, attribs, context);
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
return { rule, data };
|
|
121
|
+
};
|
|
122
|
+
exports.createResponsiveClassUpdateRule = createResponsiveClassUpdateRule;
|
|
123
|
+
//# sourceMappingURL=create-responsive-class-update-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-responsive-class-update-rule.js","sourceRoot":"","sources":["../../src/utils/create-responsive-class-update-rule.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,mEAAoG;AAGpG,+DAAyD;AAmBzD;;;;;;;;GAQG;AACI,MAAM,+BAA+B,GAAG,CAAC,MAA4B,EAAE,EAAE;IAC9E,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,MAAM,SAAS,GAAuC,EAAE,CAAC;IAEzD,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAClC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACxB,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5C,QAAQ,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW;YACjC,CAAC,CAAC,QAAQ,OAAO,CAAC,GAAG,kDAAkD,aAAa,kEAAkE;YACtJ,CAAC,CAAC,QAAQ,OAAO,CAAC,GAAG,kDAAkD,aAAa,IAAI,CAAC;QAE3F,S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AED,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;oBACtB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK;wBAAE,OAAO;oBAEzC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAiC,CAAC;oBACvD,qBAAqB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;gBACvD,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC,CAAC;AApIW,QAAA,+BAA+B,mCAoI1C"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HtmlNode } from '../parsers/html/html-node';
|
|
2
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
3
|
+
export declare function removeEmptyAttrs(serialized: string, context: TSESLint.RuleContext<string, []>, node: HtmlNode): string;
|
|
4
|
+
//# sourceMappingURL=empty-attrs-remover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-attrs-remover.d.ts","sourceRoot":"","sources":["../../src/utils/empty-attrs-remover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,EACzC,IAAI,EAAE,QAAQ,GACb,MAAM,CAWR"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeEmptyAttrs = removeEmptyAttrs;
|
|
4
|
+
function removeEmptyAttrs(serialized, context, node) {
|
|
5
|
+
const originalNodeText = context.sourceCode.getText().slice(node.range[0], node.range[1]);
|
|
6
|
+
// Find all attrs that already had ="" in the original code
|
|
7
|
+
const originallyEmpty = new Set([...originalNodeText.matchAll(/\b([\w:[\].-]+)=""/g)].map(m => m[1]));
|
|
8
|
+
return serialized.replaceAll(/\b([\w:[\].-]+)=""/g, (match, attr) => originallyEmpty.has(attr) ? match : attr);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=empty-attrs-remover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-attrs-remover.js","sourceRoot":"","sources":["../../src/utils/empty-attrs-remover.ts"],"names":[],"mappings":";;AAGA,4CAeC;AAfD,SAAgB,gBAAgB,CAC9B,UAAkB,EAClB,OAAyC,EACzC,IAAc;IAEd,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1F,2DAA2D;IAC3D,MAAM,eAAe,GAAG,IAAI,GAAG,CAC7B,CAAC,GAAG,gBAAgB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACrE,CAAC;IAEF,OAAO,UAAU,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAClE,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CACzC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swisspost/design-system-eslint",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "10.0.0-next.
|
|
4
|
+
"version": "10.0.0-next.68",
|
|
5
5
|
"description": "A set of custom ESLint rules to help keeping projects using the Swiss Post Design System up-to-date.",
|
|
6
6
|
"author": "Swiss Post <design-system@post.ch>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -29,18 +29,19 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@typescript-eslint/utils": "8.49.0",
|
|
31
31
|
"cheerio": "1.0.0",
|
|
32
|
+
"eslint-plugin-unicorn": "^56.0.0",
|
|
32
33
|
"eslint-scope": "8.2.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@eslint/js": "9.19.0",
|
|
36
37
|
"@types/eslint-scope": "3.7.7",
|
|
37
|
-
"@types/jest": "
|
|
38
|
+
"@types/jest": "^30.0.0",
|
|
38
39
|
"@typescript-eslint/rule-tester": "8.49.0",
|
|
39
40
|
"concurrently": "9.2.1",
|
|
40
41
|
"domhandler": "5.0.3",
|
|
41
42
|
"eslint": "9.26.0",
|
|
42
43
|
"globals": "17.3.0",
|
|
43
|
-
"jest": "
|
|
44
|
+
"jest": "30.3.0",
|
|
44
45
|
"parse5": "7.2.1",
|
|
45
46
|
"rimraf": "6.0.1",
|
|
46
47
|
"ts-jest": "29.4.6",
|