From a21d5085b7bed554614c0cfad48836af3888db4d Mon Sep 17 00:00:00 2001 From: JC Franco Date: Mon, 7 Apr 2025 14:04:26 -0700 Subject: [PATCH 1/2] chore(linting): fix lint-staged not finding markdownlint-cli2 config --- lint-staged.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lint-staged.config.mjs b/lint-staged.config.mjs index 38f5803c579..5acfcc272ba 100644 --- a/lint-staged.config.mjs +++ b/lint-staged.config.mjs @@ -1,5 +1,5 @@ export default { "*.{json,html,yml}": ["prettier --write"], "*.{s,}css": ["prettier --write"], - "*.md": ["prettier --write", "markdownlint-cli2 --fix"], + "*.md": ["prettier --write", "markdownlint-cli2 --fix --config ../../.markdownlint-cli2.jsonc"], }; From c563d3e8e6dd55ec11b661b7cdf8dc471ba8c492 Mon Sep 17 00:00:00 2001 From: JC Franco Date: Mon, 7 Apr 2025 19:31:41 -0700 Subject: [PATCH 2/2] fix additional issues * resolve markdownlint-cli2 config path properly * ensure mjs files are included in eslint (tsconfig) * avoid markdownlint-cli2 from processing node_modules from packages by moving dev deps to root --- .github/scripts/lint-staged.config.mjs | 4 ++++ lint-staged.config.mjs | 18 +++++++++++++++++- package-lock.json | 19 ++----------------- package.json | 1 + .../calcite-components/lint-staged.config.mjs | 4 ++++ .../lint-staged.config.mjs | 4 ++++ packages/calcite-design-tokens/package.json | 3 --- .../tsconfig-eslint.json | 3 +++ 8 files changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/scripts/lint-staged.config.mjs b/.github/scripts/lint-staged.config.mjs index 03d95215055..e41556a0ff1 100644 --- a/.github/scripts/lint-staged.config.mjs +++ b/.github/scripts/lint-staged.config.mjs @@ -1,5 +1,9 @@ import baseConfig from "../../lint-staged.config.mjs"; +/** + * @filename: lint-staged.config.mjs + * @type {import('lint-staged').Configuration} + */ export default { ...baseConfig, "*.{m,c,}js": ["eslint --fix", "prettier --write"], diff --git a/lint-staged.config.mjs b/lint-staged.config.mjs index 5acfcc272ba..690d884c05a 100644 --- a/lint-staged.config.mjs +++ b/lint-staged.config.mjs @@ -1,5 +1,21 @@ +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +export const __filename = fileURLToPath(import.meta.url); +export const __dirname = dirname(__filename); + +/** + * @filename: lint-staged.config.mjs + * @type {import('lint-staged').Configuration} + */ export default { "*.{json,html,yml}": ["prettier --write"], "*.{s,}css": ["prettier --write"], - "*.md": ["prettier --write", "markdownlint-cli2 --fix --config ../../.markdownlint-cli2.jsonc"], + "*.md": (absolutePaths) => { + const files = absolutePaths.join(" "); + return [ + `prettier --write ${files}`, + `markdownlint-cli2 --fix --config ${resolve(__dirname, "./.markdownlint-cli2.jsonc")} ${files}` + ]; + } }; diff --git a/package-lock.json b/package-lock.json index 931d2d6b2d5..fc1893d26f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -101,6 +101,7 @@ "typescript-eslint": "8.29.0", "typescript-strict-plugin": "2.4.4", "vite": "5.4.16", + "vite-plugin-dts": "4.5.3", "vitest": "2.1.9" }, "optionalDependencies": { @@ -36599,23 +36600,7 @@ "packages/calcite-design-tokens": { "name": "@esri/calcite-design-tokens", "version": "3.0.2-next.2", - "license": "SEE LICENSE.md", - "devDependencies": { - "type-fest": "4.37.0" - } - }, - "packages/calcite-design-tokens/node_modules/type-fest": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.37.0.tgz", - "integrity": "sha512-S/5/0kFftkq27FPNye0XM1e2NsnoD/3FS+pBmbjmmtLT6I+i344KoOf7pvXreaFsDamWeaJX55nczA1m5PsBDg==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "license": "SEE LICENSE.md" }, "packages/calcite-ui-icons": { "name": "@esri/calcite-ui-icons", diff --git a/package.json b/package.json index 514172b25c3..5b146ddc4a8 100644 --- a/package.json +++ b/package.json @@ -120,6 +120,7 @@ "typescript-eslint": "8.29.0", "typescript-strict-plugin": "2.4.4", "vite": "5.4.16", + "vite-plugin-dts": "4.5.3", "vitest": "2.1.9" }, "license": "SEE LICENSE.md", diff --git a/packages/calcite-components/lint-staged.config.mjs b/packages/calcite-components/lint-staged.config.mjs index 3b9ae593fe8..5f38685bd52 100644 --- a/packages/calcite-components/lint-staged.config.mjs +++ b/packages/calcite-components/lint-staged.config.mjs @@ -1,5 +1,9 @@ import baseConfig from "../../lint-staged.config.mjs"; +/** + * @filename: lint-staged.config.mjs + * @type {import('lint-staged').Configuration} + */ export default { ...baseConfig, "*.{s,}css": ["stylelint --fix", "prettier --write"], diff --git a/packages/calcite-design-tokens/lint-staged.config.mjs b/packages/calcite-design-tokens/lint-staged.config.mjs index e47ae18d93f..bf3737923c0 100644 --- a/packages/calcite-design-tokens/lint-staged.config.mjs +++ b/packages/calcite-design-tokens/lint-staged.config.mjs @@ -1,5 +1,9 @@ import baseConfig from "../../lint-staged.config.mjs"; +/** + * @filename: lint-staged.config.mjs + * @type {import('lint-staged').Configuration} + */ export default { ...baseConfig, "*.{ts,tsx,mjs,cjs}": ["eslint --fix", "prettier --write"], diff --git a/packages/calcite-design-tokens/package.json b/packages/calcite-design-tokens/package.json index be3cd2964cd..2a6cac855f4 100644 --- a/packages/calcite-design-tokens/package.json +++ b/packages/calcite-design-tokens/package.json @@ -41,8 +41,5 @@ }, "volta": { "extends": "../../package.json" - }, - "devDependencies": { - "type-fest": "4.37.0" } } diff --git a/packages/calcite-design-tokens/tsconfig-eslint.json b/packages/calcite-design-tokens/tsconfig-eslint.json index c0420783718..d4d8cd591d5 100644 --- a/packages/calcite-design-tokens/tsconfig-eslint.json +++ b/packages/calcite-design-tokens/tsconfig-eslint.json @@ -1,4 +1,7 @@ { + "compilerOptions": { + "allowJs": true + }, "extends": "./tsconfig-base.json", "include": ["**/*", "*.config.mjs"] }