eslint-plugin-mgw-eslint-rules 2.3.12 → 2.3.13
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/index.js +97 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3261,8 +3261,8 @@ var require_RuleCreator = __commonJS({
|
|
|
3261
3261
|
exports2.RuleCreator = RuleCreator;
|
|
3262
3262
|
var applyDefault_1 = require_applyDefault();
|
|
3263
3263
|
function RuleCreator(urlCreator) {
|
|
3264
|
-
return function createNamedRule({ meta, name, ...
|
|
3265
|
-
const ruleWithDocs =
|
|
3264
|
+
return function createNamedRule({ meta, name, ...rule8 }) {
|
|
3265
|
+
const ruleWithDocs = createRule8({
|
|
3266
3266
|
meta: {
|
|
3267
3267
|
...meta,
|
|
3268
3268
|
docs: {
|
|
@@ -3271,12 +3271,12 @@ var require_RuleCreator = __commonJS({
|
|
|
3271
3271
|
}
|
|
3272
3272
|
},
|
|
3273
3273
|
name,
|
|
3274
|
-
...
|
|
3274
|
+
...rule8
|
|
3275
3275
|
});
|
|
3276
3276
|
return ruleWithDocs;
|
|
3277
3277
|
};
|
|
3278
3278
|
}
|
|
3279
|
-
function
|
|
3279
|
+
function createRule8({
|
|
3280
3280
|
create,
|
|
3281
3281
|
// Keep accepting deprecated defaultOptions for backward compatibility.
|
|
3282
3282
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
@@ -3296,7 +3296,7 @@ var require_RuleCreator = __commonJS({
|
|
|
3296
3296
|
};
|
|
3297
3297
|
}
|
|
3298
3298
|
RuleCreator.withoutDocs = function withoutDocs(args) {
|
|
3299
|
-
return
|
|
3299
|
+
return createRule8(args);
|
|
3300
3300
|
};
|
|
3301
3301
|
}
|
|
3302
3302
|
});
|
|
@@ -20621,13 +20621,13 @@ ${ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment()}`;
|
|
|
20621
20621
|
}
|
|
20622
20622
|
_scopeKeyframesRelatedCss(cssText, scopeSelector) {
|
|
20623
20623
|
const unscopedKeyframesSet = /* @__PURE__ */ new Set();
|
|
20624
|
-
const scopedKeyframesCssText = processRules(cssText, (
|
|
20625
|
-
return processRules(scopedKeyframesCssText, (
|
|
20624
|
+
const scopedKeyframesCssText = processRules(cssText, (rule8) => this._scopeLocalKeyframeDeclarations(rule8, scopeSelector, unscopedKeyframesSet));
|
|
20625
|
+
return processRules(scopedKeyframesCssText, (rule8) => this._scopeAnimationRule(rule8, scopeSelector, unscopedKeyframesSet));
|
|
20626
20626
|
}
|
|
20627
|
-
_scopeLocalKeyframeDeclarations(
|
|
20627
|
+
_scopeLocalKeyframeDeclarations(rule8, scopeSelector, unscopedKeyframesSet) {
|
|
20628
20628
|
return {
|
|
20629
|
-
...
|
|
20630
|
-
selector:
|
|
20629
|
+
...rule8,
|
|
20630
|
+
selector: rule8.selector.replace(/(^@(?:-webkit-)?keyframes(?:\s+))(['"]?)(.+)\2(\s*)$/, (_, start, quote, keyframeName, endSpaces) => {
|
|
20631
20631
|
unscopedKeyframesSet.add(unescapeQuotes(keyframeName, quote));
|
|
20632
20632
|
return `${start}${quote}${scopeSelector}_${keyframeName}${quote}${endSpaces}`;
|
|
20633
20633
|
})
|
|
@@ -20640,8 +20640,8 @@ ${ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment()}`;
|
|
|
20640
20640
|
});
|
|
20641
20641
|
}
|
|
20642
20642
|
_animationDeclarationKeyframesRe = /(^|\s+|,)(?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))(?=[,\s]|$)/g;
|
|
20643
|
-
_scopeAnimationRule(
|
|
20644
|
-
let content =
|
|
20643
|
+
_scopeAnimationRule(rule8, scopeSelector, unscopedKeyframesSet) {
|
|
20644
|
+
let content = rule8.content.replace(/((?:^|\s+|;)(?:-webkit-)?animation\s*:\s*),*([^;]+)/g, (_, start, animationDeclarations) => start + animationDeclarations.replace(this._animationDeclarationKeyframesRe, (original, leadingSpaces, quote = "", quotedName, nonQuotedName) => {
|
|
20645
20645
|
if (quotedName) {
|
|
20646
20646
|
return `${leadingSpaces}${this._scopeAnimationKeyframe(`${quote}${quotedName}${quote}`, scopeSelector, unscopedKeyframesSet)}`;
|
|
20647
20647
|
} else {
|
|
@@ -20650,7 +20650,7 @@ ${ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment()}`;
|
|
|
20650
20650
|
}));
|
|
20651
20651
|
content = content.replace(/((?:^|\s+|;)(?:-webkit-)?animation-name(?:\s*):(?:\s*))([^;]+)/g, (_match, start, commaSeparatedKeyframes) => `${start}${commaSeparatedKeyframes.split(",").map((keyframe) => this._scopeAnimationKeyframe(keyframe, scopeSelector, unscopedKeyframesSet)).join(",")}`);
|
|
20652
20652
|
return {
|
|
20653
|
-
...
|
|
20653
|
+
...rule8,
|
|
20654
20654
|
content
|
|
20655
20655
|
};
|
|
20656
20656
|
}
|
|
@@ -20661,8 +20661,8 @@ ${ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment()}`;
|
|
|
20661
20661
|
}
|
|
20662
20662
|
_insertPolyfillRulesInCssText(cssText) {
|
|
20663
20663
|
return cssText.replace(_cssContentRuleRe, (...m) => {
|
|
20664
|
-
const
|
|
20665
|
-
return m[4] +
|
|
20664
|
+
const rule8 = m[0].replace(m[1], "").replace(m[2], "");
|
|
20665
|
+
return m[4] + rule8;
|
|
20666
20666
|
});
|
|
20667
20667
|
}
|
|
20668
20668
|
_scopeCssText(cssText, scopeSelector, hostSelector) {
|
|
@@ -20683,8 +20683,8 @@ ${ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment()}`;
|
|
|
20683
20683
|
let m;
|
|
20684
20684
|
_cssContentUnscopedRuleRe.lastIndex = 0;
|
|
20685
20685
|
while ((m = _cssContentUnscopedRuleRe.exec(cssText)) !== null) {
|
|
20686
|
-
const
|
|
20687
|
-
r +=
|
|
20686
|
+
const rule8 = m[0].replace(m[2], "").replace(m[1], m[4]);
|
|
20687
|
+
r += rule8 + "\n\n";
|
|
20688
20688
|
}
|
|
20689
20689
|
return r;
|
|
20690
20690
|
}
|
|
@@ -20769,28 +20769,28 @@ ${ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment()}`;
|
|
|
20769
20769
|
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, " "), cssText);
|
|
20770
20770
|
}
|
|
20771
20771
|
_scopeSelectors(cssText, scopeSelector, hostSelector) {
|
|
20772
|
-
return processRules(cssText, (
|
|
20773
|
-
let selector =
|
|
20774
|
-
let content =
|
|
20775
|
-
if (
|
|
20772
|
+
return processRules(cssText, (rule8) => {
|
|
20773
|
+
let selector = rule8.selector;
|
|
20774
|
+
let content = rule8.content;
|
|
20775
|
+
if (rule8.selector[0] !== "@") {
|
|
20776
20776
|
selector = this._scopeSelector({
|
|
20777
20777
|
selector,
|
|
20778
20778
|
scopeSelector,
|
|
20779
20779
|
hostSelector,
|
|
20780
20780
|
isParentSelector: true
|
|
20781
20781
|
});
|
|
20782
|
-
} else if (scopedAtRuleIdentifiers.some((atRule) =>
|
|
20783
|
-
content = this._scopeSelectors(
|
|
20784
|
-
} else if (
|
|
20785
|
-
content = this._stripScopingSelectors(
|
|
20782
|
+
} else if (scopedAtRuleIdentifiers.some((atRule) => rule8.selector.startsWith(atRule))) {
|
|
20783
|
+
content = this._scopeSelectors(rule8.content, scopeSelector, hostSelector);
|
|
20784
|
+
} else if (rule8.selector.startsWith("@font-face") || rule8.selector.startsWith("@page")) {
|
|
20785
|
+
content = this._stripScopingSelectors(rule8.content);
|
|
20786
20786
|
}
|
|
20787
20787
|
return new CssRule(selector, content);
|
|
20788
20788
|
});
|
|
20789
20789
|
}
|
|
20790
20790
|
_stripScopingSelectors(cssText) {
|
|
20791
|
-
return processRules(cssText, (
|
|
20792
|
-
const selector =
|
|
20793
|
-
return new CssRule(selector,
|
|
20791
|
+
return processRules(cssText, (rule8) => {
|
|
20792
|
+
const selector = rule8.selector.replace(_shadowDeepSelectors, " ").replace(_polyfillHostNoCombinatorRe, " ");
|
|
20793
|
+
return new CssRule(selector, rule8.content);
|
|
20794
20794
|
});
|
|
20795
20795
|
}
|
|
20796
20796
|
_safeSelector;
|
|
@@ -21051,8 +21051,8 @@ ${ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment()}`;
|
|
|
21051
21051
|
suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
|
|
21052
21052
|
contentPrefix = "{";
|
|
21053
21053
|
}
|
|
21054
|
-
const
|
|
21055
|
-
return `${m[1]}${
|
|
21054
|
+
const rule8 = ruleCallback(new CssRule(selector, content));
|
|
21055
|
+
return `${m[1]}${rule8.selector}${m[3]}${contentPrefix}${rule8.content}${suffix}`;
|
|
21056
21056
|
});
|
|
21057
21057
|
return unescapeInStrings(escapedResult);
|
|
21058
21058
|
}
|
|
@@ -44194,13 +44194,75 @@ var rule5 = createRule5({
|
|
|
44194
44194
|
}
|
|
44195
44195
|
});
|
|
44196
44196
|
|
|
44197
|
-
// src/rules/
|
|
44197
|
+
// src/rules/service-class-suffix.ts
|
|
44198
44198
|
var import_utils6 = __toESM(require_dist6());
|
|
44199
44199
|
var import_utils7 = __toESM(require_dist4());
|
|
44200
|
-
var RULE_NAME6 = "
|
|
44201
|
-
var
|
|
44200
|
+
var RULE_NAME6 = "service-class-suffix";
|
|
44201
|
+
var SUFFIXES_DEFAULT = ["Service"];
|
|
44202
|
+
var DOCS_RULES2 = "https://github.com/developpement-megao/mgw-eslint-rules/blob/main/docs/rules";
|
|
44203
|
+
var createRule6 = import_utils7.ESLintUtils.RuleCreator((name) => `${DOCS_RULES2}/${name}.md`);
|
|
44202
44204
|
var rule6 = createRule6({
|
|
44203
44205
|
name: RULE_NAME6,
|
|
44206
|
+
meta: {
|
|
44207
|
+
type: "suggestion",
|
|
44208
|
+
docs: {
|
|
44209
|
+
description: 'Enforce that service classes end with "Service"',
|
|
44210
|
+
recommended: "recommended"
|
|
44211
|
+
},
|
|
44212
|
+
messages: {
|
|
44213
|
+
serviceSuffix: "Service class should end with one of these suffixes: {{ suffixes }}"
|
|
44214
|
+
},
|
|
44215
|
+
schema: [
|
|
44216
|
+
{
|
|
44217
|
+
type: "object",
|
|
44218
|
+
properties: {
|
|
44219
|
+
suffixes: {
|
|
44220
|
+
type: "array",
|
|
44221
|
+
items: {
|
|
44222
|
+
type: "string"
|
|
44223
|
+
}
|
|
44224
|
+
}
|
|
44225
|
+
},
|
|
44226
|
+
additionalProperties: false
|
|
44227
|
+
}
|
|
44228
|
+
]
|
|
44229
|
+
},
|
|
44230
|
+
defaultOptions: [
|
|
44231
|
+
{
|
|
44232
|
+
suffixes: SUFFIXES_DEFAULT
|
|
44233
|
+
}
|
|
44234
|
+
],
|
|
44235
|
+
create(context, [{ suffixes }]) {
|
|
44236
|
+
return {
|
|
44237
|
+
[import_utils6.Selectors.INJECTABLE_CLASS_DECORATOR](node) {
|
|
44238
|
+
const classDeclaration = node.parent;
|
|
44239
|
+
if (!classDeclaration.id) {
|
|
44240
|
+
return;
|
|
44241
|
+
}
|
|
44242
|
+
const suffixesDef = suffixes || SUFFIXES_DEFAULT;
|
|
44243
|
+
const className = classDeclaration.id.name;
|
|
44244
|
+
const hasValidSuffix = suffixesDef.some((suffix) => className.endsWith(suffix));
|
|
44245
|
+
if (!hasValidSuffix) {
|
|
44246
|
+
context.report({
|
|
44247
|
+
node: classDeclaration.id,
|
|
44248
|
+
messageId: "serviceSuffix",
|
|
44249
|
+
data: {
|
|
44250
|
+
suffixes: suffixesDef.join(", ")
|
|
44251
|
+
}
|
|
44252
|
+
});
|
|
44253
|
+
}
|
|
44254
|
+
}
|
|
44255
|
+
};
|
|
44256
|
+
}
|
|
44257
|
+
});
|
|
44258
|
+
|
|
44259
|
+
// src/rules/template/prefer-class-style-binding.ts
|
|
44260
|
+
var import_utils8 = __toESM(require_dist6());
|
|
44261
|
+
var import_utils9 = __toESM(require_dist4());
|
|
44262
|
+
var RULE_NAME7 = "template/prefer-class-style-binding";
|
|
44263
|
+
var createRule7 = import_utils9.ESLintUtils.RuleCreator((name) => `https://github.com/developpement-megao/mgw-eslint-rules/docs/rules/${name}.md`);
|
|
44264
|
+
var rule7 = createRule7({
|
|
44265
|
+
name: RULE_NAME7,
|
|
44204
44266
|
meta: {
|
|
44205
44267
|
type: "suggestion",
|
|
44206
44268
|
docs: {
|
|
@@ -44215,7 +44277,7 @@ var rule6 = createRule6({
|
|
|
44215
44277
|
},
|
|
44216
44278
|
defaultOptions: [],
|
|
44217
44279
|
create(context) {
|
|
44218
|
-
const parserServices = (0,
|
|
44280
|
+
const parserServices = (0, import_utils8.getTemplateParserServices)(context);
|
|
44219
44281
|
return {
|
|
44220
44282
|
// Détecte les attributs ngClass et ngStyle et inputs [ngClass] et [ngStyle] dans les templates
|
|
44221
44283
|
Element(node) {
|
|
@@ -44241,6 +44303,7 @@ var rules = {
|
|
|
44241
44303
|
[RULE_NAME2]: rule2,
|
|
44242
44304
|
[RULE_NAME3]: rule3,
|
|
44243
44305
|
[RULE_NAME]: rule,
|
|
44306
|
+
[RULE_NAME7]: rule7,
|
|
44244
44307
|
[RULE_NAME6]: rule6
|
|
44245
44308
|
};
|
|
44246
44309
|
// Annotate the CommonJS export names for ESM import in node:
|