eslint-plugin-mgw-eslint-rules 2.2.52 → 2.2.54
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 +11 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11868,7 +11868,8 @@ var rule = createRule({
|
|
|
11868
11868
|
meta: {
|
|
11869
11869
|
type: "suggestion",
|
|
11870
11870
|
docs: {
|
|
11871
|
-
description: "Interdit les template literals sans interpolation (backticks sans ${...})."
|
|
11871
|
+
description: "Interdit les template literals sans interpolation (backticks sans ${...}).",
|
|
11872
|
+
recommended: true
|
|
11872
11873
|
},
|
|
11873
11874
|
messages: {
|
|
11874
11875
|
avoidBacktickWithoutInterpolation: "Utilisez des guillemets simples ou doubles si aucune interpolation n'est n\xE9cessaire."
|
|
@@ -11882,12 +11883,16 @@ var rule = createRule({
|
|
|
11882
11883
|
return {
|
|
11883
11884
|
TemplateLiteral(node) {
|
|
11884
11885
|
if (node.expressions.length === 0) {
|
|
11886
|
+
const text = context.sourceCode.getText(node);
|
|
11887
|
+
if (text.includes("'") && text.includes('"')) {
|
|
11888
|
+
return;
|
|
11889
|
+
}
|
|
11885
11890
|
context.report({
|
|
11886
11891
|
node,
|
|
11887
11892
|
messageId: "avoidBacktickWithoutInterpolation",
|
|
11888
11893
|
fix(fixer) {
|
|
11889
|
-
const
|
|
11890
|
-
const replacement = `'${
|
|
11894
|
+
const content = text.slice(1, -1);
|
|
11895
|
+
const replacement = content.includes("'") ? `"${content}"` : `'${content}'`;
|
|
11891
11896
|
return fixer.replaceText(node, replacement);
|
|
11892
11897
|
}
|
|
11893
11898
|
});
|
|
@@ -12001,7 +12006,8 @@ var rule4 = createRule4({
|
|
|
12001
12006
|
meta: {
|
|
12002
12007
|
type: "suggestion",
|
|
12003
12008
|
docs: {
|
|
12004
|
-
description: "Disallow explicit type declarations for readonly properties initialized to a number, string, or boolean"
|
|
12009
|
+
description: "Disallow explicit type declarations for readonly properties initialized to a number, string, or boolean",
|
|
12010
|
+
recommended: true
|
|
12005
12011
|
},
|
|
12006
12012
|
fixable: "code",
|
|
12007
12013
|
messages: {
|
|
@@ -12049,7 +12055,7 @@ var rule4 = createRule4({
|
|
|
12049
12055
|
if (isPrimitiveLiteral) {
|
|
12050
12056
|
const typeAnnotation = node.typeAnnotation;
|
|
12051
12057
|
context.report({
|
|
12052
|
-
node: node.
|
|
12058
|
+
node: node.key,
|
|
12053
12059
|
messageId: "noInferrableTypesReadonlyProperties",
|
|
12054
12060
|
data: {
|
|
12055
12061
|
type: getTypeString(typeAnnotation)
|