@dnncommunity/dnn-elements 0.24.4-beta.5 → 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/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/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.js.map +1 -0
- package/package.json +2 -2
- package/dist/collection/eslint-plugin/index.js +0 -5
- package/dist/collection/eslint-plugin/index.js.map +0 -1
- package/dist/types/eslint-plugin/index.d.ts +0 -3
- package/src/eslint-plugin/__tests__/no-label-slot-in-checkbox.tests.ts +0 -27
- 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.map +0 -1
- package/src/eslint-plugin/index.ts +0 -5
- package/src/eslint-plugin/src/rules/no-label-slot-in-checkbox.ts +0 -48
- package/src/eslint-plugin/tsconfig.json +0 -16
- /package/{dist/types/eslint-plugin/dist → eslint-plugin/rules}/no-label-slot-in-checkbox.d.ts +0 -0
- /package/{src/eslint-plugin/dist → eslint-plugin/rules}/no-label-slot-in-checkbox.js +0 -0
|
@@ -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;
|
|
@@ -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,EA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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 +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,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 +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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,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"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import type { JSXOpeningElement } from "estree-jsx";
|
|
3
|
-
|
|
4
|
-
export const noLabelSlotInCheckbox: Rule.RuleModule = {
|
|
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: Rule.RuleContext): Rule.RuleListener {
|
|
18
|
-
return {
|
|
19
|
-
JSXOpeningElement(node: Rule.Node) {
|
|
20
|
-
if (node.type === "JSXOpeningElement") {
|
|
21
|
-
const jsxNode = node as JSXOpeningElement;
|
|
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 as any; // Cast to access children
|
|
26
|
-
const innerContent = parentElement.children
|
|
27
|
-
.map((child: any) => context.sourceCode.getText(child))
|
|
28
|
-
.join("")
|
|
29
|
-
.trim();
|
|
30
|
-
|
|
31
|
-
if (innerContent) {
|
|
32
|
-
context.report({
|
|
33
|
-
node: node,
|
|
34
|
-
messageId: "noLabelSlotInCheckbox",
|
|
35
|
-
fix: (fixer) => {
|
|
36
|
-
const checkboxText = context.sourceCode.getText(node);
|
|
37
|
-
const fixedText = `<label>\n${checkboxText.replace(innerContent, "").trim()}</dnn-checkbox>\n${innerContent}\n</label>`;
|
|
38
|
-
return fixer.replaceText(parent, fixedText);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"moduleResolution": "Node",
|
|
6
|
-
"outDir": "./dist",
|
|
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", "jest.config.js"]
|
|
16
|
-
}
|
/package/{dist/types/eslint-plugin/dist → eslint-plugin/rules}/no-label-slot-in-checkbox.d.ts
RENAMED
|
File without changes
|
|
File without changes
|