@dpa-id-components/dpa-shared-components 14.1.1 → 15.0.0

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/README.md CHANGED
@@ -4,8 +4,7 @@ Collection of vue 3 components for usage across dpa projects.
4
4
 
5
5
  ## Pre-requirements
6
6
 
7
- This project requires a node version of 16.x or higher. For Node environments such as nuxt.js Node v20 or higher is
8
- required to prevent errors from the missing `crypto` library, which is needed for uuid.
7
+ This project requires a node version of 20.x or higher.
9
8
 
10
9
  You need to add and integrate the Inter font that can be found in `src/assets/fonts` to your project manually.
11
10
  An example how the CSS could look can be found in `src/tailwind/fonts.css`
@@ -56,35 +55,60 @@ The tailwind config is located at `./src/tailwind/tailwind.config.ts`.
56
55
  Please be aware that used plugins must be listed in the dependencies or the projects using the components have to
57
56
  install it.
58
57
 
59
- ### ESLint
58
+ ### Code quality linting with ESLint
60
59
 
61
- As of version `11.x.x`, this project is setup to use ESLint 9+ which no longer supports the `.eslintrc` configuration format. The [ESLint flat configuration file](https://eslint.org/docs/latest/use/configure/configuration-files) for this project is located at `./eslint.config.mjs`. The base ESLint configuration `./eslint.base.config.mjs` is exported in the published npm package as a [shareable config file](https://eslint.org/docs/latest/extend/shareable-configs) and can be used as the base configuration for host projects. Plugins and third party configs used in `./eslint.base.config.mjs` should be added to `dependencies` in `package.json`.
60
+ A shared ESLint configuration is provided at `@dpa-id-components/dpa-shared-components/eslintConfig`. Use it as a base configuration for code quality linting via ESLint.
62
61
 
63
- Please note the following when configuring the `eslint.config.mjs` file in a host project:
64
- - Project specific third-party plugins and config (updated accordingly for flat config support) should be added as `devDependencies`
65
- - Files to be included or ignored by ESLint should be configured here
66
- - Adjust the `lint` script in `package.json` to `"lint": "eslint . --fix"`
62
+ **Example ESLint configuration**:
67
63
 
68
- To use the shared ESLint config in a host project's `eslint.config.mjs`:
69
-
70
- ```JavaScript
71
- import sharedConfig from "@dpa-id-components/dpa-shared-components/eslint.config";
72
- // Other project specific plugins
73
- import pluginCypress from "eslint-plugin-cypress/flat";
64
+ ```js
65
+ import sharedConfig from "@dpa-id-components/dpa-shared-components/eslintConfig";
66
+ import { globalIgnores } from "eslint/config";
74
67
 
75
68
  export default [
76
- // Files to include or ignore under linting
77
69
  {
78
- files: ["**/*.js", "**/*.mjs", "**/*.ts", "**/*.mts", "**/*.vue"],
70
+ files: ["**/*.ts", "**/*.mts", "**/*.vue"],
79
71
  },
72
+
73
+ globalIgnores(["**/dist/", "**/coverage/"]),
74
+
75
+ ...sharedConfig,
76
+
80
77
  {
81
- ignores: ["_infrastructure/*", "**/dist/**", "**/coverage/**"],
78
+ files: ["**/*.vue"],
79
+ rules: {
80
+ "vue/no-undef-components": [
81
+ "error",
82
+ {
83
+ // Add globally-registered components here:
84
+ ignorePatterns: ["i18n-t", "RouterLink", "RouterView"],
85
+ },
86
+ ],
87
+ },
82
88
  },
83
- ...sharedConfig,
84
- pluginCypress.configs.recommended,
85
89
  ];
86
90
  ```
87
91
 
92
+ ### Code formatting with Prettier
93
+
94
+ A shared Prettier configuration is provided at `@dpa-id-components/dpa-shared-components/prettierConfig`. Use it as a base configuration for code formatting via Prettier.
95
+
96
+ **Example Prettier configuration**:
97
+
98
+ ```js
99
+ import config from "@dpa-id-components/dpa-shared-components/prettierConfig";
100
+
101
+ /**
102
+ * @see https://prettier.io/docs/configuration
103
+ * @type {import("prettier").Config}
104
+ */
105
+ export default {
106
+ ...config,
107
+ };
108
+ ```
109
+
110
+ You might also want to add a Prettier ignore file (e.g. for ignoring Markdown files) and set up Prettier in your code editor to automatically format on save.
111
+
88
112
  ## Add a component
89
113
 
90
114
  To add a new component please add at least the following files:
@@ -166,9 +190,9 @@ Custom optimizations right now are:
166
190
 
167
191
  ## Releasing
168
192
 
169
- To publish a new release just go to the Actions tab and click "Publish new version".
193
+ To publish a new release just go to the Actions tab and click "Publish new version".
170
194
  You are prompted with the option to choose which version to bump. Behind the scenes it just does one of those commands below.
171
- They will still work on their own but the #shared-components Slack channel won't be notified.
195
+ They will still work on their own but the #shared-components Slack channel won't be notified.
172
196
 
173
197
  ```shell
174
198
  npm run release:patch
@@ -1,10 +1,10 @@
1
+ import skipFormattingConfig from "@vue/eslint-config-prettier/skip-formatting";
1
2
  import pluginVue from "eslint-plugin-vue";
2
3
  import js from "@eslint/js";
3
4
  import {
4
5
  defineConfigWithVueTs,
5
6
  vueTsConfigs,
6
7
  } from "@vue/eslint-config-typescript";
7
- import prettierConfig from "@vue/eslint-config-prettier";
8
8
  import tailwind from "eslint-plugin-tailwindcss";
9
9
  import globals from "globals";
10
10
 
@@ -12,8 +12,8 @@ export default defineConfigWithVueTs(
12
12
  ...pluginVue.configs["flat/recommended"],
13
13
  js.configs.recommended,
14
14
  vueTsConfigs.recommended,
15
- prettierConfig,
16
15
  ...tailwind.configs["flat/recommended"],
16
+
17
17
  {
18
18
  settings: {
19
19
  tailwindcss: {
@@ -25,20 +25,11 @@ export default defineConfigWithVueTs(
25
25
  rules: {
26
26
  "@typescript-eslint/no-explicit-any": "off",
27
27
  "@typescript-eslint/ban-ts-comment": "off",
28
- "@typescript-eslint/no-non-null-assertion": "warn",
29
- "@typescript-eslint/triple-slash-reference": "off",
30
28
  "tailwindcss/no-custom-classname": "off",
29
+ "vue/define-emits-declaration": ["error", "type-literal"],
31
30
  "vue/multi-word-component-names": "off",
32
31
  "vue/no-v-html": "off",
33
32
  "no-console": "error",
34
- "vue/no-multiple-template-root": "off",
35
- "vue/no-v-for-template-key": "off",
36
- "vue/no-reserved-props": [
37
- "error",
38
- {
39
- vueVersion: 3,
40
- },
41
- ],
42
33
  },
43
34
  languageOptions: {
44
35
  globals: {
@@ -47,4 +38,7 @@ export default defineConfigWithVueTs(
47
38
  },
48
39
  },
49
40
  },
41
+
42
+ // Turns off formatting-related ESLint rules so that formatting can be delegated to the Prettier CLI. See https://github.com/vuejs/eslint-config-prettier?tab=readme-ov-file#use-separate-commands-for-linting-and-formatting
43
+ skipFormattingConfig,
50
44
  );
package/dist/fonts.css CHANGED
@@ -1,23 +1,26 @@
1
1
  @font-face {
2
- font-family: "Inter";
3
- font-style: normal;
4
- font-weight: 400;
5
- src: url("@/assets/fonts/Inter-Regular.woff2") format("woff2"),
2
+ font-family: "Inter";
3
+ font-style: normal;
4
+ font-weight: 400;
5
+ src:
6
+ url("@/assets/fonts/Inter-Regular.woff2") format("woff2"),
6
7
  url("@/assets/fonts/Inter-Regular.woff") format("woff");
7
8
  }
8
9
 
9
10
  @font-face {
10
- font-family: "Inter";
11
- font-style: normal;
12
- font-weight: 500;
13
- src: url("@/assets/fonts/Inter-Medium.woff2") format("woff2"),
11
+ font-family: "Inter";
12
+ font-style: normal;
13
+ font-weight: 500;
14
+ src:
15
+ url("@/assets/fonts/Inter-Medium.woff2") format("woff2"),
14
16
  url("@/assets/fonts/Inter-Medium.woff") format("woff");
15
17
  }
16
18
 
17
19
  @font-face {
18
- font-family: "Inter";
19
- font-style: normal;
20
- font-weight: 700;
21
- src: url("@/assets/fonts/Inter-Bold.woff2") format("woff2"),
20
+ font-family: "Inter";
21
+ font-style: normal;
22
+ font-weight: 700;
23
+ src:
24
+ url("@/assets/fonts/Inter-Bold.woff2") format("woff2"),
22
25
  url("@/assets/fonts/Inter-Bold.woff") format("woff");
23
- }
26
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @see https://prettier.io/docs/configuration
3
+ * @type {import("prettier").Config}
4
+ */
5
+ export default {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpa-id-components/dpa-shared-components",
3
- "version": "14.1.1",
3
+ "version": "15.0.0",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -8,6 +8,7 @@
8
8
  "files": [
9
9
  "dist"
10
10
  ],
11
+ "type": "commonjs",
11
12
  "main": "./dist/dpa-shared-components.umd.cjs",
12
13
  "module": "./dist/dpa-shared-components.mjs",
13
14
  "style": "./dist/style.css",
@@ -26,20 +27,21 @@
26
27
  "require": "./dist/tailwind.config.cjs",
27
28
  "import": "./dist/tailwind.config.cjs"
28
29
  },
29
- "./eslint.config": {
30
- "import": "./dist/eslint.base.config.mjs"
31
- },
32
- "./.prettierrc": {
33
- "require": "./dist/.prettierrc"
34
- }
30
+ "./eslintConfig": "./dist/eslint.base.config.mjs",
31
+ "./prettierConfig": "./dist/prettier.config.mjs"
35
32
  },
36
33
  "scripts": {
37
34
  "build": "vite build",
38
35
  "storybook": "storybook dev -p 6006",
39
36
  "build-storybook": "storybook build",
40
37
  "test": "vitest --environment jsdom --root src/",
41
- "type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
42
- "lint": "eslint . --fix",
38
+ "lint": "run-s lint:*",
39
+ "lint:format": "prettier --check .",
40
+ "lint:js": "eslint",
41
+ "lint:types": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
42
+ "fix": "run-s fix:*",
43
+ "fix:format": "prettier --write .",
44
+ "fix:js": "eslint --fix",
43
45
  "release:patch": "vite build && commit-and-tag-version --release-as patch && git push --follow-tags origin main && npm publish",
44
46
  "release:minor": "vite build && commit-and-tag-version --release-as minor && git push --follow-tags origin main && npm publish",
45
47
  "release:major": "vite build && commit-and-tag-version --release-as major && git push --follow-tags origin main && npm publish"
@@ -68,9 +70,10 @@
68
70
  "eslint": "^9.18.0",
69
71
  "eslint-plugin-storybook": "^0.12.0",
70
72
  "jsdom": "^26.0.0",
73
+ "npm-run-all2": "^8.0.4",
71
74
  "postcss": "^8.4.27",
72
75
  "postcss-focus-visible": "^10.0.0",
73
- "prettier": "^3.0.1",
76
+ "prettier": "^3.5.3",
74
77
  "rollup-plugin-copy": "^3.4.0",
75
78
  "storybook": "^8.0.0",
76
79
  "tailwindcss": "^3.4.1",
package/dist/.prettierrc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "tabWidth": 2,
3
- "vueIndentScriptAndStyle": false
4
- }