@dnncommunity/dnn-elements 0.24.4-beta.6 → 0.24.4-beta.7
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/eslint-plugin/index.d.ts +17 -0
- package/eslint-plugin/index.js +20 -0
- package/eslint-plugin/index.js.map +1 -0
- package/eslint-plugin/rules/no-label-slot-in-checkbox.d.ts +2 -0
- package/{src/eslint-plugin/src/rules/no-label-slot-in-checkbox.ts → eslint-plugin/rules/no-label-slot-in-checkbox.js} +48 -48
- package/eslint-plugin/rules/no-label-slot-in-checkbox.js.map +1 -0
- package/package.json +2 -2
- package/src/eslint-plugin/__tests__/no-label-slot-in-checkbox.tests.ts +0 -27
- package/src/eslint-plugin/src/index.ts +0 -19
- package/src/eslint-plugin/tsconfig.json +0 -16
|
@@ -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;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rules = void 0;
|
|
4
|
+
const no_label_slot_in_checkbox_1 = require("./rules/no-label-slot-in-checkbox");
|
|
5
|
+
exports.rules = {
|
|
6
|
+
"no-label-slot-in-checkbox": no_label_slot_in_checkbox_1.noLabelSlotInCheckbox
|
|
7
|
+
};
|
|
8
|
+
const plugin = {
|
|
9
|
+
rules: exports.rules,
|
|
10
|
+
configs: {
|
|
11
|
+
recommended: {
|
|
12
|
+
plugins: ["@dnn-community/eslint-plugin"],
|
|
13
|
+
rules: {
|
|
14
|
+
"@dnn-community/no-label-slot-in-checkbox": "error"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.default = plugin;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/eslint-plugin/src/index.ts"],"names":[],"mappings":";;;AAAA,iFAA0E;AAE7D,QAAA,KAAK,GAAG;IACjB,2BAA2B,EAAE,iDAAqB;CACrD,CAAC;AAEF,MAAM,MAAM,GAAG;IACX,KAAK,EAAL,aAAK;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,kBAAe,MAAM,CAAC"}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
26
|
-
const innerContent = parentElement.children
|
|
27
|
-
.map((child
|
|
28
|
-
.join("")
|
|
29
|
-
.trim();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-label-slot-in-checkbox.js","sourceRoot":"","sources":["../../src/eslint-plugin/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"}
|
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.7",
|
|
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",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist/",
|
|
18
18
|
"loader/",
|
|
19
|
-
"
|
|
19
|
+
"eslint-plugin/"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "npm run build:eslint-plugin && npm run eslint && stencil build --docs",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from "eslint";
|
|
2
|
-
import { noLabelSlotInCheckbox } from "../src/rules/no-label-slot-in-checkbox";
|
|
3
|
-
const tsParser = require.resolve("@typescript-eslint/parser");
|
|
4
|
-
|
|
5
|
-
const ruleTester = new RuleTester({
|
|
6
|
-
parser: tsParser,
|
|
7
|
-
parserOptions: {
|
|
8
|
-
ecmaVersion: 2022,
|
|
9
|
-
ecmaFeatures: {
|
|
10
|
-
jsx: true,
|
|
11
|
-
},
|
|
12
|
-
sourceType: "module",
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
ruleTester.run("no-label-slot-in-checkbox", noLabelSlotInCheckbox, {
|
|
17
|
-
valid: [
|
|
18
|
-
{ code: "<dnn-checkbox></dnn-checkbox>" },
|
|
19
|
-
],
|
|
20
|
-
invalid: [
|
|
21
|
-
{
|
|
22
|
-
code: "<dnn-checkbox onClick={e => console.log(e)}>Something</dnn-checkbox>",
|
|
23
|
-
errors: [{ messageId: "noLabelSlotInCheckbox" }],
|
|
24
|
-
output: "<label>\n<dnn-checkbox onClick={e => console.log(e)}></dnn-checkbox>\nSomething\n</label>",
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
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,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2019",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"moduleResolution": "Node",
|
|
6
|
-
"outDir": "../../dist/eslint-plugin",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"types": ["jest", "node", "estree-jsx"],
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"sourceMap": true
|
|
14
|
-
},
|
|
15
|
-
"include": ["src/index.ts"]
|
|
16
|
-
}
|