eslint-plugin-mgw-eslint-rules 2.3.20 → 2.3.21
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 +29 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -44307,10 +44307,6 @@ var import_utils10 = __toESM(require_dist4());
|
|
|
44307
44307
|
var NAMING_CONVENTIONS = ["camelCase", "strictCamelCase", "PascalCase", "StrictPascalCase", "snake_case", "UPPER_CASE", "kebab-case"];
|
|
44308
44308
|
var ATTRIBUTE_CONVENTION_POSSIBLE_VALUES = [...NAMING_CONVENTIONS];
|
|
44309
44309
|
var RULE_NAME8 = "template/attributes-naming-convention";
|
|
44310
|
-
var ATTRIBUTE_DEFAULT_VALUES = {
|
|
44311
|
-
id: "kebab-case",
|
|
44312
|
-
class: "kebab-case"
|
|
44313
|
-
};
|
|
44314
44310
|
var conventionPatterns = {
|
|
44315
44311
|
camelCase: /^[a-z][a-zA-Z0-9]*$/,
|
|
44316
44312
|
strictCamelCase: /^(?!.*[A-Z]{2})[a-z][a-zA-Z0-9]*$/,
|
|
@@ -44354,12 +44350,26 @@ var rule8 = createRule8({
|
|
|
44354
44350
|
enum: ATTRIBUTE_CONVENTION_POSSIBLE_VALUES
|
|
44355
44351
|
},
|
|
44356
44352
|
minItems: 1
|
|
44353
|
+
},
|
|
44354
|
+
{
|
|
44355
|
+
type: "object",
|
|
44356
|
+
properties: {
|
|
44357
|
+
pattern: {
|
|
44358
|
+
type: "array",
|
|
44359
|
+
items: {
|
|
44360
|
+
type: "string"
|
|
44361
|
+
},
|
|
44362
|
+
minItems: 1,
|
|
44363
|
+
//default: [],
|
|
44364
|
+
description: "Patterns regex to test"
|
|
44365
|
+
}
|
|
44366
|
+
},
|
|
44367
|
+
required: ["pattern"]
|
|
44357
44368
|
}
|
|
44358
44369
|
]
|
|
44359
44370
|
}
|
|
44360
44371
|
}
|
|
44361
44372
|
},
|
|
44362
|
-
//required: ['conventions'],
|
|
44363
44373
|
additionalProperties: false
|
|
44364
44374
|
}
|
|
44365
44375
|
],
|
|
@@ -44367,23 +44377,31 @@ var rule8 = createRule8({
|
|
|
44367
44377
|
},
|
|
44368
44378
|
defaultOptions: [
|
|
44369
44379
|
{
|
|
44370
|
-
|
|
44380
|
+
id: "kebab-case",
|
|
44381
|
+
class: "kebab-case"
|
|
44371
44382
|
}
|
|
44372
44383
|
],
|
|
44373
44384
|
create(context, [options]) {
|
|
44374
44385
|
const parserServices = (0, import_utils9.getTemplateParserServices)(context);
|
|
44375
|
-
const attributesConfig = options.attributes || ATTRIBUTE_DEFAULT_VALUES;
|
|
44376
44386
|
const listeAttributes = new Map(
|
|
44377
|
-
Object.entries(
|
|
44387
|
+
Object.entries(options).map(([a, n]) => {
|
|
44378
44388
|
const listeNommage = typeof n === "string" ? [n] : n;
|
|
44379
|
-
|
|
44380
|
-
|
|
44389
|
+
if (Array.isArray(listeNommage)) {
|
|
44390
|
+
const nommageReg = listeNommage.map((c) => conventionPatterns[c]);
|
|
44391
|
+
return [a, { noms: listeNommage.join(", "), regs: nommageReg }];
|
|
44392
|
+
}
|
|
44393
|
+
return [
|
|
44394
|
+
a,
|
|
44395
|
+
{
|
|
44396
|
+
noms: listeNommage.pattern.join(", "),
|
|
44397
|
+
regs: listeNommage.pattern.map((p) => new RegExp(p))
|
|
44398
|
+
}
|
|
44399
|
+
];
|
|
44381
44400
|
})
|
|
44382
44401
|
);
|
|
44383
44402
|
return {
|
|
44384
44403
|
// Détecte les attributs dans les templates (parcours global élément (noeud) par élément)
|
|
44385
44404
|
"Element[attributes]"(node) {
|
|
44386
|
-
console.log(node);
|
|
44387
44405
|
const attributes = node.attributes;
|
|
44388
44406
|
for (const attr of attributes) {
|
|
44389
44407
|
if (attr.value) {
|