@drivenets/eslint-plugin-design-system 0.0.4 → 0.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @drivenets/eslint-plugin-design-system
2
2
 
3
+ ## 0.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 1881953: - Add deprecation rule for `DsChip`
8
+ - Add deprecation rule for `DsChipGroup`
9
+
10
+ ## 0.0.5
11
+
12
+ ### Patch Changes
13
+
14
+ - 3a2973f: Add readme
15
+
3
16
  ## 0.0.4
4
17
 
5
18
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # DriveNets Design System ESLint Plugin
2
+
3
+ This ESLint plugin provides custom linting rules and configurations for projects using the DriveNets Design System.
4
+
5
+ It helps enforce best practices and migrating from deprecated components and props.
6
+
7
+ ## Installation
8
+
9
+ First, install the package via your preferred package manager:
10
+
11
+ ```bash
12
+ npm install @drivenets/eslint-plugin
13
+ # or
14
+ pnpm install @drivenets/eslint-plugin
15
+ # or
16
+ yarn add @drivenets/eslint-plugin
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ > [!NOTE]
22
+ > This plugin supports only the new ESLint Flat Config format and requires ESLint 9.0.0 or higher.
23
+
24
+ To use the plugin, add it to your ESLint configuration file (e.g. `eslint.config.ts`).
25
+
26
+ You can either use the recommended config:
27
+
28
+ ```TS
29
+ import { defineConfig } from 'eslint/config';
30
+ import designSystem from '@drivenets/eslint-plugin-design-system';
31
+
32
+ export default defineConfig(
33
+ // ... your config
34
+ designSystem.configs.recommended,
35
+ );
36
+ ```
37
+
38
+ Or you can customize the rules as needed:
39
+
40
+ ```TS
41
+ import { defineConfig } from 'eslint/config';
42
+ import designSystem from '@drivenets/eslint-plugin-design-system';
43
+
44
+ export default defineConfig(
45
+ // ... your config
46
+ {
47
+ plugins: {
48
+ '@drivenets/design-system': designSystem,
49
+ },
50
+ rules: {
51
+ '@drivenets/design-system/no-native-button': 'off',
52
+ '@drivenets/design-system/no-native-text-input': 'error',
53
+ },
54
+ }
55
+ );
56
+ ```
package/dist/index.cjs CHANGED
@@ -22,6 +22,14 @@ const eslintPlugin = require_create_plugin.createPlugin("@drivenets/design-syste
22
22
  name: "no-deprecated-ds-radio-group-legacy",
23
23
  selector: require_selectors.JSXElement("DsRadioGroupLegacy"),
24
24
  message: `DsRadioGroupLegacy is deprecated. Use DsRadioGroup instead.`
25
+ }, {
26
+ name: "no-deprecated-ds-chip",
27
+ selector: require_selectors.JSXElement("DsChip"),
28
+ message: `DsChip is deprecated. Use DsTag instead.`
29
+ }, {
30
+ name: "no-deprecated-ds-chip-group",
31
+ selector: require_selectors.JSXElement("DsChipGroup"),
32
+ message: `DsChipGroup is deprecated. Use DsTagFilter instead.`
25
33
  }, {
26
34
  name: "no-native-button",
27
35
  selector: [
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from "./create-plugin.cjs";
2
2
 
3
3
  //#region src/index.d.ts
4
- declare const eslintPlugin: Plugin<"no-deprecated-ds-button-legacy-design" | "no-deprecated-ds-dialog" | "no-deprecated-ds-system-status" | "no-deprecated-ds-dropdown-menu-legacy" | "no-deprecated-ds-radio-group-legacy" | "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">;
4
+ declare const eslintPlugin: Plugin<"no-deprecated-ds-button-legacy-design" | "no-deprecated-ds-dialog" | "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
5
  export = eslintPlugin;
6
6
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;cAGM,cA2GL"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;cAGM,cAuHL"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Plugin } from "./create-plugin.js";
2
2
 
3
3
  //#region src/index.d.ts
4
- declare const eslintPlugin: Plugin<"no-deprecated-ds-button-legacy-design" | "no-deprecated-ds-dialog" | "no-deprecated-ds-system-status" | "no-deprecated-ds-dropdown-menu-legacy" | "no-deprecated-ds-radio-group-legacy" | "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">;
4
+ declare const eslintPlugin: Plugin<"no-deprecated-ds-button-legacy-design" | "no-deprecated-ds-dialog" | "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
5
  //#endregion
6
6
  export { eslintPlugin as default };
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;cAGM,cA2GL"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;cAGM,cAuHL"}
package/dist/index.js CHANGED
@@ -22,6 +22,14 @@ const eslintPlugin = createPlugin("@drivenets/design-system", {
22
22
  name: "no-deprecated-ds-radio-group-legacy",
23
23
  selector: JSXElement("DsRadioGroupLegacy"),
24
24
  message: `DsRadioGroupLegacy is deprecated. Use DsRadioGroup instead.`
25
+ }, {
26
+ name: "no-deprecated-ds-chip",
27
+ selector: JSXElement("DsChip"),
28
+ message: `DsChip is deprecated. Use DsTag instead.`
29
+ }, {
30
+ name: "no-deprecated-ds-chip-group",
31
+ selector: JSXElement("DsChipGroup"),
32
+ message: `DsChipGroup is deprecated. Use DsTagFilter instead.`
25
33
  }, {
26
34
  name: "no-native-button",
27
35
  selector: [
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-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-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,uBAAuB;CAC5C,SAAS;CACT,EAED;CACC,MAAM;CACN,UAAU,WAAW,qBAAqB;CAC1C,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/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-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,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drivenets/eslint-plugin-design-system",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.cts",
package/src/index.ts CHANGED
@@ -36,6 +36,18 @@ const eslintPlugin = createPlugin(
36
36
  message: `DsRadioGroupLegacy is deprecated. Use DsRadioGroup instead.`,
37
37
  },
38
38
 
39
+ {
40
+ name: 'no-deprecated-ds-chip',
41
+ selector: JSXElement('DsChip'),
42
+ message: `DsChip is deprecated. Use DsTag instead.`,
43
+ },
44
+
45
+ {
46
+ name: 'no-deprecated-ds-chip-group',
47
+ selector: JSXElement('DsChipGroup'),
48
+ message: `DsChipGroup is deprecated. Use DsTagFilter instead.`,
49
+ },
50
+
39
51
  {
40
52
  name: 'no-native-button',
41
53
  selector: [