@dnncommunity/dnn-elements 0.24.4-beta.5 → 0.24.4-beta.6
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/collection/eslint-plugin/src/index.js +17 -0
- package/dist/collection/eslint-plugin/src/index.js.map +1 -0
- package/dist/types/eslint-plugin/src/index.d.ts +17 -0
- package/package.json +1 -1
- package/src/eslint-plugin/src/index.ts +19 -0
- package/src/eslint-plugin/tsconfig.json +5 -5
- package/dist/collection/eslint-plugin/index.js +0 -5
- package/dist/collection/eslint-plugin/index.js.map +0 -1
- package/dist/types/eslint-plugin/dist/no-label-slot-in-checkbox.d.ts +0 -2
- package/dist/types/eslint-plugin/index.d.ts +0 -3
- package/src/eslint-plugin/dist/no-label-slot-in-checkbox.d.ts +0 -2
- package/src/eslint-plugin/dist/no-label-slot-in-checkbox.js +0 -48
- package/src/eslint-plugin/dist/no-label-slot-in-checkbox.js.map +0 -1
- package/src/eslint-plugin/index.ts +0 -5
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { noLabelSlotInCheckbox } from "./rules/no-label-slot-in-checkbox";
|
|
2
|
+
export const rules = {
|
|
3
|
+
"no-label-slot-in-checkbox": noLabelSlotInCheckbox
|
|
4
|
+
};
|
|
5
|
+
const plugin = {
|
|
6
|
+
rules,
|
|
7
|
+
configs: {
|
|
8
|
+
recommended: {
|
|
9
|
+
plugins: ["@dnn-community/eslint-plugin"],
|
|
10
|
+
rules: {
|
|
11
|
+
"@dnn-community/no-label-slot-in-checkbox": "error"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export default plugin;
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/eslint-plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,MAAM,CAAC,MAAM,KAAK,GAAG;IACjB,2BAA2B,EAAE,qBAAqB;CACrD,CAAC;AAEF,MAAM,MAAM,GAAG;IACX,KAAK;IACL,OAAO,EAAE;QACL,WAAW,EAAE;YACT,OAAO,EAAE,CAAC,8BAA8B,CAAC;YACzC,KAAK,EAAE;gBACH,0CAA0C,EAAE,OAAO;aACtD;SACJ;KACJ;CACJ,CAAA;AAED,eAAe,MAAM,CAAC","sourcesContent":["import { noLabelSlotInCheckbox } from \"./rules/no-label-slot-in-checkbox\";\r\n\r\nexport const rules = {\r\n \"no-label-slot-in-checkbox\": noLabelSlotInCheckbox\r\n};\r\n\r\nconst plugin = {\r\n rules,\r\n configs: {\r\n recommended: {\r\n plugins: [\"@dnn-community/eslint-plugin\"],\r\n rules: {\r\n \"@dnn-community/no-label-slot-in-checkbox\": \"error\"\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default plugin;"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const rules: {
|
|
2
|
+
"no-label-slot-in-checkbox": import("eslint").Rule.RuleModule;
|
|
3
|
+
};
|
|
4
|
+
declare const plugin: {
|
|
5
|
+
rules: {
|
|
6
|
+
"no-label-slot-in-checkbox": import("eslint").Rule.RuleModule;
|
|
7
|
+
};
|
|
8
|
+
configs: {
|
|
9
|
+
recommended: {
|
|
10
|
+
plugins: string[];
|
|
11
|
+
rules: {
|
|
12
|
+
"@dnn-community/no-label-slot-in-checkbox": string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnncommunity/dnn-elements",
|
|
3
|
-
"version": "0.24.4-beta.
|
|
3
|
+
"version": "0.24.4-beta.6",
|
|
4
4
|
"description": "Dnn themed custom elements.",
|
|
5
5
|
"repository": "https://github.com/dnncommunity/dnn-elements",
|
|
6
6
|
"homepage": "https://dnncommunity.github.io/dnn-elements",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { noLabelSlotInCheckbox } from "./rules/no-label-slot-in-checkbox";
|
|
2
|
+
|
|
3
|
+
export const rules = {
|
|
4
|
+
"no-label-slot-in-checkbox": noLabelSlotInCheckbox
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const plugin = {
|
|
8
|
+
rules,
|
|
9
|
+
configs: {
|
|
10
|
+
recommended: {
|
|
11
|
+
plugins: ["@dnn-community/eslint-plugin"],
|
|
12
|
+
rules: {
|
|
13
|
+
"@dnn-community/no-label-slot-in-checkbox": "error"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default plugin;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"module": "
|
|
3
|
+
"target": "es2019",
|
|
4
|
+
"module": "commonjs",
|
|
5
5
|
"moduleResolution": "Node",
|
|
6
|
-
"outDir": "
|
|
6
|
+
"outDir": "../../dist/eslint-plugin",
|
|
7
7
|
"strict": true,
|
|
8
8
|
"esModuleInterop": true,
|
|
9
9
|
"declaration": true,
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
"forceConsistentCasingInFileNames": true,
|
|
13
13
|
"sourceMap": true
|
|
14
14
|
},
|
|
15
|
-
"include": ["src
|
|
16
|
-
|
|
15
|
+
"include": ["src/index.ts"]
|
|
16
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eslint-plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,MAAM,CAAC,MAAM,KAAK,GAAG;IACjB,2BAA2B,EAAE,qBAAqB;CACrD,CAAC","sourcesContent":["import { noLabelSlotInCheckbox } from \"./src/rules/no-label-slot-in-checkbox\";\r\n\r\nexport const rules = {\r\n \"no-label-slot-in-checkbox\": noLabelSlotInCheckbox\r\n};"]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noLabelSlotInCheckbox = void 0;
|
|
4
|
-
exports.noLabelSlotInCheckbox = {
|
|
5
|
-
meta: {
|
|
6
|
-
type: "problem",
|
|
7
|
-
docs: {
|
|
8
|
-
description: "Disallow label slot in checkbox",
|
|
9
|
-
recommended: true,
|
|
10
|
-
url: "https://github.com/DNNCommunity/dnn-elements/releases/tag/v0.24.0",
|
|
11
|
-
},
|
|
12
|
-
messages: {
|
|
13
|
-
noLabelSlotInCheckbox: "Label slot is not allowed in dnn-checkbox, wrap dnn-checkbox with a label instead."
|
|
14
|
-
},
|
|
15
|
-
fixable: "code",
|
|
16
|
-
},
|
|
17
|
-
create(context) {
|
|
18
|
-
return {
|
|
19
|
-
JSXOpeningElement(node) {
|
|
20
|
-
if (node.type === "JSXOpeningElement") {
|
|
21
|
-
const jsxNode = node;
|
|
22
|
-
if (jsxNode.name.type === "JSXIdentifier" && jsxNode.name.name === "dnn-checkbox") {
|
|
23
|
-
const parent = context.getAncestors().find(ancestor => ancestor.type === "JSXElement");
|
|
24
|
-
if (parent && parent.type === "JSXElement") {
|
|
25
|
-
const parentElement = parent; // Cast to access children
|
|
26
|
-
const innerContent = parentElement.children
|
|
27
|
-
.map((child) => context.sourceCode.getText(child))
|
|
28
|
-
.join("")
|
|
29
|
-
.trim();
|
|
30
|
-
if (innerContent) {
|
|
31
|
-
context.report({
|
|
32
|
-
node: node,
|
|
33
|
-
messageId: "noLabelSlotInCheckbox",
|
|
34
|
-
fix: (fixer) => {
|
|
35
|
-
const checkboxText = context.sourceCode.getText(node);
|
|
36
|
-
const fixedText = `<label>\n${checkboxText.replace(innerContent, "").trim()}</dnn-checkbox>\n${innerContent}\n</label>`;
|
|
37
|
-
return fixer.replaceText(parent, fixedText);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=no-label-slot-in-checkbox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-label-slot-in-checkbox.js","sourceRoot":"","sources":["../src/rules/no-label-slot-in-checkbox.ts"],"names":[],"mappings":";;;AAGa,QAAA,qBAAqB,GAAoB;IAClD,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,WAAW,EAAE,iCAAiC;YAC9C,WAAW,EAAE,IAAI;YACjB,GAAG,EAAE,mEAAmE;SAC3E;QACD,QAAQ,EAAE;YACN,qBAAqB,EAAE,oFAAoF;SAC9G;QACD,OAAO,EAAE,MAAM;KAClB;IACD,MAAM,CAAC,OAAyB;QAC5B,OAAO;YACH,iBAAiB,CAAC,IAAe;gBAC7B,IAAI,IAAI,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;oBACpC,MAAM,OAAO,GAAG,IAAyB,CAAC;oBAC1C,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;wBAChF,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;wBACvF,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;4BACzC,MAAM,aAAa,GAAG,MAAa,CAAC,CAAC,0BAA0B;4BAC/D,MAAM,YAAY,GAAG,aAAa,CAAC,QAAQ;iCACtC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;iCACtD,IAAI,CAAC,EAAE,CAAC;iCACR,IAAI,EAAE,CAAC;4BAEZ,IAAI,YAAY,EAAE,CAAC;gCACf,OAAO,CAAC,MAAM,CAAC;oCACX,IAAI,EAAE,IAAI;oCACV,SAAS,EAAE,uBAAuB;oCAClC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;wCACX,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;wCACtD,MAAM,SAAS,GAAG,YAAY,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,oBAAoB,YAAY,YAAY,CAAC;wCACxH,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;oCAChD,CAAC;iCACJ,CAAC,CAAC;4BACP,CAAC;wBACL,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
|