@drivenets/eslint-plugin-design-system 0.0.8 → 0.0.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @drivenets/eslint-plugin-design-system
2
2
 
3
+ ## 0.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 9491d59: Fix common js build
8
+
3
9
  ## 0.0.8
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1,89 +1,141 @@
1
- const require_selectors = require('./selectors.cjs');
2
- const require_create_plugin = require('./create-plugin.cjs');
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
3
26
 
27
+ //#endregion
28
+ let eslint_no_restricted_syntax = require("eslint-no-restricted/syntax");
29
+ eslint_no_restricted_syntax = __toESM(eslint_no_restricted_syntax);
30
+
31
+ //#region src/selectors.ts
32
+ function JSXElement(name, attributes = {}) {
33
+ let selector = `JSXOpeningElement[name.name='${name}']`;
34
+ Object.entries(attributes).forEach(([attrName, attrValue]) => {
35
+ selector += `:has( > ${JSXAttribute(attrName, attrValue)} )`;
36
+ });
37
+ return selector;
38
+ }
39
+ function JSXAttribute(name, value) {
40
+ let selector = `JSXAttribute[name.name='${name}']`;
41
+ if (typeof value !== "undefined") selector += `:matches([value.expression.value='${value}'], [value.value='${value}'])`;
42
+ return selector;
43
+ }
44
+
45
+ //#endregion
46
+ //#region src/create-plugin.ts
47
+ /**
48
+ * Typed wrapper around `createNoRestrictedSyntax`.
49
+ *
50
+ * See: https://github.com/bradzacher/eslint-no-restricted/issues/13
51
+ */
52
+ function createPlugin(name, ...rules) {
53
+ return (0, eslint_no_restricted_syntax.default)(name, ...rules);
54
+ }
55
+
56
+ //#endregion
4
57
  //#region src/index.ts
5
- const eslintPlugin = require_create_plugin.createPlugin("@drivenets/design-system", {
58
+ const eslintPlugin = createPlugin("@drivenets/design-system", {
6
59
  name: "no-deprecated-ds-button-legacy-design",
7
- selector: [require_selectors.JSXElement("DsButton", { design: "legacy" }), `${require_selectors.JSXElement("DsButton")}:not(:has( > ${require_selectors.JSXAttribute("design")} ))`],
60
+ selector: [JSXElement("DsButton", { design: "legacy" }), `${JSXElement("DsButton")}:not(:has( > ${JSXAttribute("design")} ))`],
8
61
  message: `Using the 'legacy' design for DsButton is deprecated. Use 'v1.2' instead.`
9
62
  }, {
10
63
  name: "no-deprecated-ds-dialog",
11
- selector: require_selectors.JSXElement("DsDialog"),
64
+ selector: JSXElement("DsDialog"),
12
65
  message: `DsDialog is deprecated. Use DsModal or DsConfirmation instead.`
13
66
  }, {
14
67
  name: "no-deprecated-ds-confirmation",
15
- selector: require_selectors.JSXElement("DsConfirmation"),
68
+ selector: JSXElement("DsConfirmation"),
16
69
  message: `DsConfirmation is deprecated. Use DsModal instead.`
17
70
  }, {
18
71
  name: "no-deprecated-ds-system-status",
19
- selector: require_selectors.JSXElement("DsSystemStatus"),
72
+ selector: JSXElement("DsSystemStatus"),
20
73
  message: `DsSystemStatus is deprecated. Use DsStatusBadge instead.`
21
74
  }, {
22
75
  name: "no-deprecated-ds-dropdown-menu-legacy",
23
- selector: require_selectors.JSXElement("DsDropdownMenuLegacy"),
76
+ selector: JSXElement("DsDropdownMenuLegacy"),
24
77
  message: `DsDropdownMenuLegacy is deprecated. Use DsDropdownMenu instead.`
25
78
  }, {
26
79
  name: "no-deprecated-ds-radio-group-legacy",
27
- selector: require_selectors.JSXElement("DsRadioGroupLegacy"),
80
+ selector: JSXElement("DsRadioGroupLegacy"),
28
81
  message: `DsRadioGroupLegacy is deprecated. Use DsRadioGroup instead.`
29
82
  }, {
30
83
  name: "no-deprecated-ds-chip",
31
- selector: require_selectors.JSXElement("DsChip"),
84
+ selector: JSXElement("DsChip"),
32
85
  message: `DsChip is deprecated. Use DsTag instead.`
33
86
  }, {
34
87
  name: "no-deprecated-ds-chip-group",
35
- selector: require_selectors.JSXElement("DsChipGroup"),
88
+ selector: JSXElement("DsChipGroup"),
36
89
  message: `DsChipGroup is deprecated. Use DsTagFilter instead.`
37
90
  }, {
38
91
  name: "no-native-button",
39
92
  selector: [
40
- require_selectors.JSXElement("button"),
41
- require_selectors.JSXElement("input", { type: "button" }),
42
- require_selectors.JSXElement("input", { type: "submit" })
93
+ JSXElement("button"),
94
+ JSXElement("input", { type: "button" }),
95
+ JSXElement("input", { type: "submit" })
43
96
  ],
44
97
  message: `Using a native button is not allowed. Use DsButton instead.`
45
98
  }, {
46
99
  name: "no-native-select",
47
- selector: require_selectors.JSXElement("select"),
100
+ selector: JSXElement("select"),
48
101
  message: `Using a native select is not allowed. Use DsSelect or DsFormControl.Select instead.`
49
102
  }, {
50
103
  name: "no-native-checkbox",
51
- selector: require_selectors.JSXElement("input", { type: "checkbox" }),
104
+ selector: JSXElement("input", { type: "checkbox" }),
52
105
  message: `Using a native checkbox is not allowed. Use DsCheckbox instead.`
53
106
  }, {
54
107
  name: "no-native-radio",
55
- selector: require_selectors.JSXElement("input", { type: "radio" }),
108
+ selector: JSXElement("input", { type: "radio" }),
56
109
  message: `Using a native radio input is not allowed. Use DsRadioGroup instead.`
57
110
  }, {
58
111
  name: "no-native-number-input",
59
- selector: require_selectors.JSXElement("input", { type: "number" }),
112
+ selector: JSXElement("input", { type: "number" }),
60
113
  message: `Using a native number input is not allowed. Use DsNumberInput or DsFormControl.NumberInput instead.`
61
114
  }, {
62
115
  name: "no-native-text-input",
63
- selector: [require_selectors.JSXElement("input", { type: "text" }), `${require_selectors.JSXElement("input")}:not(:has( > ${require_selectors.JSXAttribute("type")} ))`],
116
+ selector: [JSXElement("input", { type: "text" }), `${JSXElement("input")}:not(:has( > ${JSXAttribute("type")} ))`],
64
117
  message: `Using a native text input is not allowed. Use DsTextInput or DsFormControl.TextInput instead.`
65
118
  }, {
66
119
  name: "no-native-password-input",
67
- selector: require_selectors.JSXElement("input", { type: "password" }),
120
+ selector: JSXElement("input", { type: "password" }),
68
121
  message: `Using a native password input is not allowed. Use DsPasswordInput or DsFormControl.PasswordInput instead.`
69
122
  }, {
70
123
  name: "no-native-file-input",
71
- selector: require_selectors.JSXElement("input", { type: "file" }),
124
+ selector: JSXElement("input", { type: "file" }),
72
125
  message: `Using a native file input is not allowed. Use DsFileUpload instead.`
73
126
  }, {
74
127
  name: "no-native-textarea",
75
- selector: require_selectors.JSXElement("textarea"),
128
+ selector: JSXElement("textarea"),
76
129
  message: `Using a native textarea is not allowed. Use DsTextarea or DsFormControl.Textarea instead.`
77
130
  }, {
78
131
  name: "no-native-table",
79
- selector: require_selectors.JSXElement("table"),
132
+ selector: JSXElement("table"),
80
133
  message: `Using a native table is not allowed. Use DsTable instead.`
81
134
  }, {
82
135
  name: "no-mui",
83
136
  selector: "ImportDeclaration[source.value=/^@mui\\u002F/]",
84
137
  message: "Using MUI components is not allowed. Use DriveNets Design System components instead."
85
138
  });
86
- var src_default = eslintPlugin;
87
139
 
88
140
  //#endregion
89
- module.exports = src_default;
141
+ module.exports = eslintPlugin;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,12 @@
1
- import { Plugin } from "./create-plugin.cjs";
1
+ import { RuleDefinition } from "@eslint/core";
2
+ import create from "eslint-no-restricted/syntax";
2
3
 
4
+ //#region src/create-plugin.d.ts
5
+ type BasePlugin = ReturnType<typeof create>;
6
+ type Plugin<TRules extends string> = Omit<BasePlugin, 'rules'> & {
7
+ rules: Record<TRules, RuleDefinition>;
8
+ };
9
+ //#endregion
3
10
  //#region src/index.d.ts
4
11
  declare const eslintPlugin: Plugin<"no-deprecated-ds-button-legacy-design" | "no-deprecated-ds-dialog" | "no-deprecated-ds-confirmation" | "no-deprecated-ds-system-status" | "no-deprecated-ds-dropdown-menu-legacy" | "no-deprecated-ds-radio-group-legacy" | "no-deprecated-ds-chip" | "no-deprecated-ds-chip-group" | "no-native-button" | "no-native-select" | "no-native-checkbox" | "no-native-radio" | "no-native-number-input" | "no-native-text-input" | "no-native-password-input" | "no-native-file-input" | "no-native-textarea" | "no-native-table" | "no-mui">;
5
12
  export = eslintPlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;cAGM,cA6HL"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/create-plugin.ts","../src/index.ts"],"mappings":";;;;KAQK,UAAA,GAAa,UAAA,QAAkB,MAAA;AAAA,KAExB,MAAA,0BAAgC,IAAA,CAAK,UAAA;EAChD,KAAA,EAAO,MAAA,CAAO,MAAA,EAAQ,cAAA;AAAA;;;cCRjB,YAAA,EA6HL,MAAA;AAAA"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,12 @@
1
- import { Plugin } from "./create-plugin.js";
1
+ import createNoRestrictedSyntax from "eslint-no-restricted/syntax";
2
+ import { RuleDefinition } from "@eslint/core";
2
3
 
4
+ //#region src/create-plugin.d.ts
5
+ type BasePlugin = ReturnType<typeof createNoRestrictedSyntax>;
6
+ type Plugin<TRules extends string> = Omit<BasePlugin, 'rules'> & {
7
+ rules: Record<TRules, RuleDefinition>;
8
+ };
9
+ //#endregion
3
10
  //#region src/index.d.ts
4
11
  declare const eslintPlugin: Plugin<"no-deprecated-ds-button-legacy-design" | "no-deprecated-ds-dialog" | "no-deprecated-ds-confirmation" | "no-deprecated-ds-system-status" | "no-deprecated-ds-dropdown-menu-legacy" | "no-deprecated-ds-radio-group-legacy" | "no-deprecated-ds-chip" | "no-deprecated-ds-chip-group" | "no-native-button" | "no-native-select" | "no-native-checkbox" | "no-native-radio" | "no-native-number-input" | "no-native-text-input" | "no-native-password-input" | "no-native-file-input" | "no-native-textarea" | "no-native-table" | "no-mui">;
5
12
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;cAGM,cA6HL"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/create-plugin.ts","../src/index.ts"],"mappings":";;;;KAQK,UAAA,GAAa,UAAA,QAAkB,wBAAA;AAAA,KAExB,MAAA,0BAAgC,IAAA,CAAK,UAAA;EAChD,KAAA,EAAO,MAAA,CAAO,MAAA,EAAQ,cAAA;AAAA;;;cCRjB,YAAA,EA6HL,MAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,31 @@
1
- import { JSXAttribute, JSXElement } from "./selectors.js";
2
- import { createPlugin } from "./create-plugin.js";
1
+ import createNoRestrictedSyntax from "eslint-no-restricted/syntax";
3
2
 
3
+ //#region src/selectors.ts
4
+ function JSXElement(name, attributes = {}) {
5
+ let selector = `JSXOpeningElement[name.name='${name}']`;
6
+ Object.entries(attributes).forEach(([attrName, attrValue]) => {
7
+ selector += `:has( > ${JSXAttribute(attrName, attrValue)} )`;
8
+ });
9
+ return selector;
10
+ }
11
+ function JSXAttribute(name, value) {
12
+ let selector = `JSXAttribute[name.name='${name}']`;
13
+ if (typeof value !== "undefined") selector += `:matches([value.expression.value='${value}'], [value.value='${value}'])`;
14
+ return selector;
15
+ }
16
+
17
+ //#endregion
18
+ //#region src/create-plugin.ts
19
+ /**
20
+ * Typed wrapper around `createNoRestrictedSyntax`.
21
+ *
22
+ * See: https://github.com/bradzacher/eslint-no-restricted/issues/13
23
+ */
24
+ function createPlugin(name, ...rules) {
25
+ return createNoRestrictedSyntax(name, ...rules);
26
+ }
27
+
28
+ //#endregion
4
29
  //#region src/index.ts
5
30
  const eslintPlugin = createPlugin("@drivenets/design-system", {
6
31
  name: "no-deprecated-ds-button-legacy-design",
@@ -83,8 +108,7 @@ const eslintPlugin = createPlugin("@drivenets/design-system", {
83
108
  selector: "ImportDeclaration[source.value=/^@mui\\u002F/]",
84
109
  message: "Using MUI components is not allowed. Use DriveNets Design System components instead."
85
110
  });
86
- var src_default = eslintPlugin;
87
111
 
88
112
  //#endregion
89
- export { src_default as default };
113
+ export { eslintPlugin as default };
90
114
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { JSXAttribute, JSXElement } from './selectors';\nimport { createPlugin } from './create-plugin';\n\nconst eslintPlugin = createPlugin(\n\t'@drivenets/design-system',\n\t{\n\t\tname: 'no-deprecated-ds-button-legacy-design',\n\t\tselector: [\n\t\t\tJSXElement('DsButton', { design: 'legacy' }),\n\t\t\t`${JSXElement('DsButton')}:not(:has( > ${JSXAttribute('design')} ))`,\n\t\t],\n\t\tmessage: `Using the 'legacy' design for DsButton is deprecated. Use 'v1.2' instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-dialog',\n\t\tselector: JSXElement('DsDialog'),\n\t\tmessage: `DsDialog is deprecated. Use DsModal or DsConfirmation instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-confirmation',\n\t\tselector: JSXElement('DsConfirmation'),\n\t\tmessage: `DsConfirmation is deprecated. Use DsModal instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-system-status',\n\t\tselector: JSXElement('DsSystemStatus'),\n\t\tmessage: `DsSystemStatus is deprecated. Use DsStatusBadge instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-dropdown-menu-legacy',\n\t\tselector: JSXElement('DsDropdownMenuLegacy'),\n\t\tmessage: `DsDropdownMenuLegacy is deprecated. Use DsDropdownMenu instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-radio-group-legacy',\n\t\tselector: JSXElement('DsRadioGroupLegacy'),\n\t\tmessage: `DsRadioGroupLegacy is deprecated. Use DsRadioGroup instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-chip',\n\t\tselector: JSXElement('DsChip'),\n\t\tmessage: `DsChip is deprecated. Use DsTag instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-chip-group',\n\t\tselector: JSXElement('DsChipGroup'),\n\t\tmessage: `DsChipGroup is deprecated. Use DsTagFilter instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-button',\n\t\tselector: [\n\t\t\tJSXElement('button'),\n\t\t\tJSXElement('input', { type: 'button' }),\n\t\t\tJSXElement('input', { type: 'submit' }),\n\t\t],\n\t\tmessage: `Using a native button is not allowed. Use DsButton instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-select',\n\t\tselector: JSXElement('select'),\n\t\tmessage: `Using a native select is not allowed. Use DsSelect or DsFormControl.Select instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-checkbox',\n\t\tselector: JSXElement('input', { type: 'checkbox' }),\n\t\tmessage: `Using a native checkbox is not allowed. Use DsCheckbox instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-radio',\n\t\tselector: JSXElement('input', { type: 'radio' }),\n\t\tmessage: `Using a native radio input is not allowed. Use DsRadioGroup instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-number-input',\n\t\tselector: JSXElement('input', { type: 'number' }),\n\t\tmessage: `Using a native number input is not allowed. Use DsNumberInput or DsFormControl.NumberInput instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-text-input',\n\t\tselector: [\n\t\t\tJSXElement('input', { type: 'text' }),\n\t\t\t`${JSXElement('input')}:not(:has( > ${JSXAttribute('type')} ))`,\n\t\t],\n\t\tmessage: `Using a native text input is not allowed. Use DsTextInput or DsFormControl.TextInput instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-password-input',\n\t\tselector: JSXElement('input', { type: 'password' }),\n\t\tmessage: `Using a native password input is not allowed. Use DsPasswordInput or DsFormControl.PasswordInput instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-file-input',\n\t\tselector: JSXElement('input', { type: 'file' }),\n\t\tmessage: `Using a native file input is not allowed. Use DsFileUpload instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-textarea',\n\t\tselector: JSXElement('textarea'),\n\t\tmessage: `Using a native textarea is not allowed. Use DsTextarea or DsFormControl.Textarea instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-table',\n\t\tselector: JSXElement('table'),\n\t\tmessage: `Using a native table is not allowed. Use DsTable instead.`,\n\t},\n\n\t{\n\t\tname: 'no-mui',\n\t\tselector: 'ImportDeclaration[source.value=/^@mui\\\\u002F/]',\n\t\tmessage: 'Using MUI components is not allowed. Use DriveNets Design System components instead.',\n\t},\n);\n\nexport default eslintPlugin;\n"],"mappings":";;;;AAGA,MAAM,eAAe,aACpB,4BACA;CACC,MAAM;CACN,UAAU,CACT,WAAW,YAAY,EAAE,QAAQ,UAAU,CAAC,EAC5C,GAAG,WAAW,WAAW,CAAC,eAAe,aAAa,SAAS,CAAC,KAChE;CACD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,WAAW;CAChC,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,iBAAiB;CACtC,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,iBAAiB;CACtC,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,uBAAuB;CAC5C,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,qBAAqB;CAC1C,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS;CAC9B,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,cAAc;CACnC,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU;EACT,WAAW,SAAS;EACpB,WAAW,SAAS,EAAE,MAAM,UAAU,CAAC;EACvC,WAAW,SAAS,EAAE,MAAM,UAAU,CAAC;EACvC;CACD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS;CAC9B,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS,EAAE,MAAM,YAAY,CAAC;CACnD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS,EAAE,MAAM,SAAS,CAAC;CAChD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS,EAAE,MAAM,UAAU,CAAC;CACjD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,CACT,WAAW,SAAS,EAAE,MAAM,QAAQ,CAAC,EACrC,GAAG,WAAW,QAAQ,CAAC,eAAe,aAAa,OAAO,CAAC,KAC3D;CACD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS,EAAE,MAAM,YAAY,CAAC;CACnD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS,EAAE,MAAM,QAAQ,CAAC;CAC/C,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,WAAW;CAChC,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,QAAQ;CAC7B,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU;CACV,SAAS;CACT,CACD;AAED,kBAAe"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/selectors.ts","../src/create-plugin.ts","../src/index.ts"],"sourcesContent":["export function JSXElement(name: string, attributes: Record<string, string> = {}) {\n\tlet selector = `JSXOpeningElement[name.name='${name}']`;\n\n\tObject.entries(attributes).forEach(([attrName, attrValue]) => {\n\t\tselector += `:has( > ${JSXAttribute(attrName, attrValue)} )`;\n\t});\n\n\treturn selector;\n}\n\nexport function JSXAttribute(name: string, value?: string) {\n\tlet selector = `JSXAttribute[name.name='${name}']`;\n\n\tif (typeof value !== 'undefined') {\n\t\t// Match both expressions (prop={'value'}) and literal values (prop=\"value\").\n\t\tselector += `:matches([value.expression.value='${value}'], [value.value='${value}'])`;\n\t}\n\n\treturn selector;\n}\n","import type { RuleDefinition } from '@eslint/core';\nimport type create from 'eslint-no-restricted/syntax';\nimport createNoRestrictedSyntax from 'eslint-no-restricted/syntax';\n\ntype RuleConfig<TName extends string> = Omit<create.RuleConfig, 'name'> & {\n\tname: TName;\n};\n\ntype BasePlugin = ReturnType<typeof createNoRestrictedSyntax>;\n\nexport type Plugin<TRules extends string> = Omit<BasePlugin, 'rules'> & {\n\trules: Record<TRules, RuleDefinition>;\n};\n\n/**\n * Typed wrapper around `createNoRestrictedSyntax`.\n *\n * See: https://github.com/bradzacher/eslint-no-restricted/issues/13\n */\nexport function createPlugin<TRules extends string>(\n\tname: string,\n\t...rules: Array<RuleConfig<TRules>>\n): Plugin<TRules> {\n\treturn createNoRestrictedSyntax(name, ...rules) as Plugin<TRules>;\n}\n","import { JSXAttribute, JSXElement } from './selectors';\nimport { createPlugin } from './create-plugin';\n\nconst eslintPlugin = createPlugin(\n\t'@drivenets/design-system',\n\t{\n\t\tname: 'no-deprecated-ds-button-legacy-design',\n\t\tselector: [\n\t\t\tJSXElement('DsButton', { design: 'legacy' }),\n\t\t\t`${JSXElement('DsButton')}:not(:has( > ${JSXAttribute('design')} ))`,\n\t\t],\n\t\tmessage: `Using the 'legacy' design for DsButton is deprecated. Use 'v1.2' instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-dialog',\n\t\tselector: JSXElement('DsDialog'),\n\t\tmessage: `DsDialog is deprecated. Use DsModal or DsConfirmation instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-confirmation',\n\t\tselector: JSXElement('DsConfirmation'),\n\t\tmessage: `DsConfirmation is deprecated. Use DsModal instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-system-status',\n\t\tselector: JSXElement('DsSystemStatus'),\n\t\tmessage: `DsSystemStatus is deprecated. Use DsStatusBadge instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-dropdown-menu-legacy',\n\t\tselector: JSXElement('DsDropdownMenuLegacy'),\n\t\tmessage: `DsDropdownMenuLegacy is deprecated. Use DsDropdownMenu instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-radio-group-legacy',\n\t\tselector: JSXElement('DsRadioGroupLegacy'),\n\t\tmessage: `DsRadioGroupLegacy is deprecated. Use DsRadioGroup instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-chip',\n\t\tselector: JSXElement('DsChip'),\n\t\tmessage: `DsChip is deprecated. Use DsTag instead.`,\n\t},\n\n\t{\n\t\tname: 'no-deprecated-ds-chip-group',\n\t\tselector: JSXElement('DsChipGroup'),\n\t\tmessage: `DsChipGroup is deprecated. Use DsTagFilter instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-button',\n\t\tselector: [\n\t\t\tJSXElement('button'),\n\t\t\tJSXElement('input', { type: 'button' }),\n\t\t\tJSXElement('input', { type: 'submit' }),\n\t\t],\n\t\tmessage: `Using a native button is not allowed. Use DsButton instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-select',\n\t\tselector: JSXElement('select'),\n\t\tmessage: `Using a native select is not allowed. Use DsSelect or DsFormControl.Select instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-checkbox',\n\t\tselector: JSXElement('input', { type: 'checkbox' }),\n\t\tmessage: `Using a native checkbox is not allowed. Use DsCheckbox instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-radio',\n\t\tselector: JSXElement('input', { type: 'radio' }),\n\t\tmessage: `Using a native radio input is not allowed. Use DsRadioGroup instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-number-input',\n\t\tselector: JSXElement('input', { type: 'number' }),\n\t\tmessage: `Using a native number input is not allowed. Use DsNumberInput or DsFormControl.NumberInput instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-text-input',\n\t\tselector: [\n\t\t\tJSXElement('input', { type: 'text' }),\n\t\t\t`${JSXElement('input')}:not(:has( > ${JSXAttribute('type')} ))`,\n\t\t],\n\t\tmessage: `Using a native text input is not allowed. Use DsTextInput or DsFormControl.TextInput instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-password-input',\n\t\tselector: JSXElement('input', { type: 'password' }),\n\t\tmessage: `Using a native password input is not allowed. Use DsPasswordInput or DsFormControl.PasswordInput instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-file-input',\n\t\tselector: JSXElement('input', { type: 'file' }),\n\t\tmessage: `Using a native file input is not allowed. Use DsFileUpload instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-textarea',\n\t\tselector: JSXElement('textarea'),\n\t\tmessage: `Using a native textarea is not allowed. Use DsTextarea or DsFormControl.Textarea instead.`,\n\t},\n\n\t{\n\t\tname: 'no-native-table',\n\t\tselector: JSXElement('table'),\n\t\tmessage: `Using a native table is not allowed. Use DsTable instead.`,\n\t},\n\n\t{\n\t\tname: 'no-mui',\n\t\tselector: 'ImportDeclaration[source.value=/^@mui\\\\u002F/]',\n\t\tmessage: 'Using MUI components is not allowed. Use DriveNets Design System components instead.',\n\t},\n);\n\nexport default eslintPlugin;\n"],"mappings":";;;AAAA,SAAgB,WAAW,MAAc,aAAqC,EAAE,EAAE;CACjF,IAAI,WAAW,gCAAgC,KAAK;AAEpD,QAAO,QAAQ,WAAW,CAAC,SAAS,CAAC,UAAU,eAAe;AAC7D,cAAY,WAAW,aAAa,UAAU,UAAU,CAAC;GACxD;AAEF,QAAO;;AAGR,SAAgB,aAAa,MAAc,OAAgB;CAC1D,IAAI,WAAW,2BAA2B,KAAK;AAE/C,KAAI,OAAO,UAAU,YAEpB,aAAY,qCAAqC,MAAM,oBAAoB,MAAM;AAGlF,QAAO;;;;;;;;;;ACCR,SAAgB,aACf,MACA,GAAG,OACc;AACjB,QAAO,yBAAyB,MAAM,GAAG,MAAM;;;;;ACpBhD,MAAM,eAAe,aACpB,4BACA;CACC,MAAM;CACN,UAAU,CACT,WAAW,YAAY,EAAE,QAAQ,UAAU,CAAC,EAC5C,GAAG,WAAW,WAAW,CAAC,eAAe,aAAa,SAAS,CAAC,KAChE;CACD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,WAAW;CAChC,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,iBAAiB;CACtC,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,iBAAiB;CACtC,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,uBAAuB;CAC5C,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,qBAAqB;CAC1C,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS;CAC9B,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,cAAc;CACnC,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU;EACT,WAAW,SAAS;EACpB,WAAW,SAAS,EAAE,MAAM,UAAU,CAAC;EACvC,WAAW,SAAS,EAAE,MAAM,UAAU,CAAC;EACvC;CACD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS;CAC9B,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS,EAAE,MAAM,YAAY,CAAC;CACnD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS,EAAE,MAAM,SAAS,CAAC;CAChD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS,EAAE,MAAM,UAAU,CAAC;CACjD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,CACT,WAAW,SAAS,EAAE,MAAM,QAAQ,CAAC,EACrC,GAAG,WAAW,QAAQ,CAAC,eAAe,aAAa,OAAO,CAAC,KAC3D;CACD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS,EAAE,MAAM,YAAY,CAAC;CACnD,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,SAAS,EAAE,MAAM,QAAQ,CAAC;CAC/C,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,WAAW;CAChC,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,QAAQ;CAC7B,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU;CACV,SAAS;CACT,CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drivenets/eslint-plugin-design-system",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.cts",
@@ -38,7 +38,7 @@
38
38
  "@arethetypeswrong/cli": "^0.18.2",
39
39
  "eslint": "^9.39.2",
40
40
  "publint": "^0.3.17",
41
- "tsdown": "^0.18.4",
41
+ "tsdown": "^0.20.3",
42
42
  "typescript": "^5.9.3",
43
43
  "vitest": "^4.0.18"
44
44
  },
@@ -1,29 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
-
29
- exports.__toESM = __toESM;
@@ -1,16 +0,0 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- let eslint_no_restricted_syntax = require("eslint-no-restricted/syntax");
3
- eslint_no_restricted_syntax = require_rolldown_runtime.__toESM(eslint_no_restricted_syntax);
4
-
5
- //#region src/create-plugin.ts
6
- /**
7
- * Typed wrapper around `createNoRestrictedSyntax`.
8
- *
9
- * See: https://github.com/bradzacher/eslint-no-restricted/issues/13
10
- */
11
- function createPlugin(name, ...rules) {
12
- return (0, eslint_no_restricted_syntax.default)(name, ...rules);
13
- }
14
-
15
- //#endregion
16
- exports.createPlugin = createPlugin;
@@ -1,12 +0,0 @@
1
- import { RuleDefinition } from "@eslint/core";
2
- import create from "eslint-no-restricted/syntax";
3
-
4
- //#region src/create-plugin.d.ts
5
-
6
- type BasePlugin = ReturnType<typeof create>;
7
- type Plugin<TRules extends string> = Omit<BasePlugin, 'rules'> & {
8
- rules: Record<TRules, RuleDefinition>;
9
- };
10
- //#endregion
11
- export { Plugin };
12
- //# sourceMappingURL=create-plugin.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-plugin.d.cts","names":[],"sources":["../src/create-plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAQK,UAAA,GAAa,UAE+B,CAAA,OAFb,MAEa,CAAA;AAAL,KAAhC,MAAgC,CAAA,eAAA,MAAA,CAAA,GAAA,IAAA,CAAK,UAAL,EAAA,OAAA,CAAA,GAAA;EAC7B,KAAA,EAAP,MAAO,CAAA,MAAA,EAAQ,cAAR,CAAA;CAAQ"}
@@ -1,12 +0,0 @@
1
- import createNoRestrictedSyntax from "eslint-no-restricted/syntax";
2
- import { RuleDefinition } from "@eslint/core";
3
-
4
- //#region src/create-plugin.d.ts
5
-
6
- type BasePlugin = ReturnType<typeof createNoRestrictedSyntax>;
7
- type Plugin<TRules extends string> = Omit<BasePlugin, 'rules'> & {
8
- rules: Record<TRules, RuleDefinition>;
9
- };
10
- //#endregion
11
- export { Plugin };
12
- //# sourceMappingURL=create-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-plugin.d.ts","names":[],"sources":["../src/create-plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAQK,UAAA,GAAa,UAE+B,CAAA,OAFb,wBAEa,CAAA;AAAL,KAAhC,MAAgC,CAAA,eAAA,MAAA,CAAA,GAAA,IAAA,CAAK,UAAL,EAAA,OAAA,CAAA,GAAA;EAC7B,KAAA,EAAP,MAAO,CAAA,MAAA,EAAQ,cAAR,CAAA;CAAQ"}
@@ -1,15 +0,0 @@
1
- import createNoRestrictedSyntax from "eslint-no-restricted/syntax";
2
-
3
- //#region src/create-plugin.ts
4
- /**
5
- * Typed wrapper around `createNoRestrictedSyntax`.
6
- *
7
- * See: https://github.com/bradzacher/eslint-no-restricted/issues/13
8
- */
9
- function createPlugin(name, ...rules) {
10
- return createNoRestrictedSyntax(name, ...rules);
11
- }
12
-
13
- //#endregion
14
- export { createPlugin };
15
- //# sourceMappingURL=create-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-plugin.js","names":[],"sources":["../src/create-plugin.ts"],"sourcesContent":["import type { RuleDefinition } from '@eslint/core';\nimport type create from 'eslint-no-restricted/syntax';\nimport createNoRestrictedSyntax from 'eslint-no-restricted/syntax';\n\ntype RuleConfig<TName extends string> = Omit<create.RuleConfig, 'name'> & {\n\tname: TName;\n};\n\ntype BasePlugin = ReturnType<typeof createNoRestrictedSyntax>;\n\nexport type Plugin<TRules extends string> = Omit<BasePlugin, 'rules'> & {\n\trules: Record<TRules, RuleDefinition>;\n};\n\n/**\n * Typed wrapper around `createNoRestrictedSyntax`.\n *\n * See: https://github.com/bradzacher/eslint-no-restricted/issues/13\n */\nexport function createPlugin<TRules extends string>(\n\tname: string,\n\t...rules: Array<RuleConfig<TRules>>\n): Plugin<TRules> {\n\treturn createNoRestrictedSyntax(name, ...rules) as Plugin<TRules>;\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgB,aACf,MACA,GAAG,OACc;AACjB,QAAO,yBAAyB,MAAM,GAAG,MAAM"}
@@ -1,18 +0,0 @@
1
-
2
- //#region src/selectors.ts
3
- function JSXElement(name, attributes = {}) {
4
- let selector = `JSXOpeningElement[name.name='${name}']`;
5
- Object.entries(attributes).forEach(([attrName, attrValue]) => {
6
- selector += `:has( > ${JSXAttribute(attrName, attrValue)} )`;
7
- });
8
- return selector;
9
- }
10
- function JSXAttribute(name, value) {
11
- let selector = `JSXAttribute[name.name='${name}']`;
12
- if (typeof value !== "undefined") selector += `:matches([value.expression.value='${value}'], [value.value='${value}'])`;
13
- return selector;
14
- }
15
-
16
- //#endregion
17
- exports.JSXAttribute = JSXAttribute;
18
- exports.JSXElement = JSXElement;
package/dist/selectors.js DELETED
@@ -1,17 +0,0 @@
1
- //#region src/selectors.ts
2
- function JSXElement(name, attributes = {}) {
3
- let selector = `JSXOpeningElement[name.name='${name}']`;
4
- Object.entries(attributes).forEach(([attrName, attrValue]) => {
5
- selector += `:has( > ${JSXAttribute(attrName, attrValue)} )`;
6
- });
7
- return selector;
8
- }
9
- function JSXAttribute(name, value) {
10
- let selector = `JSXAttribute[name.name='${name}']`;
11
- if (typeof value !== "undefined") selector += `:matches([value.expression.value='${value}'], [value.value='${value}'])`;
12
- return selector;
13
- }
14
-
15
- //#endregion
16
- export { JSXAttribute, JSXElement };
17
- //# sourceMappingURL=selectors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"selectors.js","names":[],"sources":["../src/selectors.ts"],"sourcesContent":["export function JSXElement(name: string, attributes: Record<string, string> = {}) {\n\tlet selector = `JSXOpeningElement[name.name='${name}']`;\n\n\tObject.entries(attributes).forEach(([attrName, attrValue]) => {\n\t\tselector += `:has( > ${JSXAttribute(attrName, attrValue)} )`;\n\t});\n\n\treturn selector;\n}\n\nexport function JSXAttribute(name: string, value?: string) {\n\tlet selector = `JSXAttribute[name.name='${name}']`;\n\n\tif (typeof value !== 'undefined') {\n\t\t// Match both expressions (prop={'value'}) and literal values (prop=\"value\").\n\t\tselector += `:matches([value.expression.value='${value}'], [value.value='${value}'])`;\n\t}\n\n\treturn selector;\n}\n"],"mappings":";AAAA,SAAgB,WAAW,MAAc,aAAqC,EAAE,EAAE;CACjF,IAAI,WAAW,gCAAgC,KAAK;AAEpD,QAAO,QAAQ,WAAW,CAAC,SAAS,CAAC,UAAU,eAAe;AAC7D,cAAY,WAAW,aAAa,UAAU,UAAU,CAAC;GACxD;AAEF,QAAO;;AAGR,SAAgB,aAAa,MAAc,OAAgB;CAC1D,IAAI,WAAW,2BAA2B,KAAK;AAE/C,KAAI,OAAO,UAAU,YAEpB,aAAY,qCAAqC,MAAM,oBAAoB,MAAM;AAGlF,QAAO"}