From 5d5cf65a79e8f8081c51a03de81034a71bd3ea95 Mon Sep 17 00:00:00 2001 From: Ben Elan Date: Fri, 7 Jul 2023 14:20:57 -0700 Subject: [PATCH 1/3] ci: allow lint-staged to find typescript parser config file --- .lintstagedrc.cjs | 19 ---- .lintstagedrc.json | 6 ++ package-lock.json | 32 +++---- .../{.eslintrc.json => .eslintrc.cjs} | 96 ++++++++++--------- 4 files changed, 71 insertions(+), 82 deletions(-) delete mode 100644 .lintstagedrc.cjs create mode 100644 .lintstagedrc.json rename packages/calcite-components/{.eslintrc.json => .eslintrc.cjs} (56%) diff --git a/.lintstagedrc.cjs b/.lintstagedrc.cjs deleted file mode 100644 index 7e653c251e1..00000000000 --- a/.lintstagedrc.cjs +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - "*.{json,html,yml}": [ - "prettier --write" - ], - "*.scss": [ - "stylelint --fix", - "prettier --write" - ], - "packages/**/*.{ts,tsx}": [ - // prevents an error due to tsconfig.json not being in the root directory - // https://github.com/okonet/lint-staged/issues/825#issuecomment-620018284 - () => "eslint --ext .ts,.tsx --fix", - "prettier --write" - ], - "*.md": [ - "markdownlint --fix --disable MD024 MD013 MD041 MD033", - "prettier --write" - ] -}; diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 00000000000..2ce27aebc5b --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,6 @@ +{ + "*.{json,html,yml}": ["prettier --write"], + "*.scss": ["stylelint --fix", "prettier --write"], + "packages/**/*.{ts,tsx}": ["eslint --ext .ts,.tsx --fix", "prettier --write"], + "*.md": ["markdownlint --fix --disable MD024 MD013 MD041 MD033", "prettier --write"] +} diff --git a/package-lock.json b/package-lock.json index ed991ddbdc6..64f151d0f86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2652,9 +2652,9 @@ "integrity": "sha512-Bu+AMaXNjrpjh41znzHqaz3r2Nr8hHuHZT6V2LBKMhyMl0FgKA62PNYbqnfgmzOhoWZj70Zecisbo4H1rotP5g==" }, "node_modules/@floating-ui/dom": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.4.2.tgz", - "integrity": "sha512-VKmvHVatWnewmGGy+7Mdy4cTJX71Pli6v/Wjb5RQBuq5wjUYx+Ef+kRThi8qggZqDgD8CogCpqhRoVp3+yQk+g==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.4.3.tgz", + "integrity": "sha512-nB/68NyaQlcdY22L+Fgd1HERQ7UGv7XFN+tPxwrEfQL4nKtAP/jIZnZtpUlXbtV+VEGHh6W/63Gy2C5biWI3sA==", "dependencies": { "@floating-ui/core": "^1.3.1" } @@ -17814,9 +17814,9 @@ } }, "node_modules/dayjs": { - "version": "1.11.8", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.8.tgz", - "integrity": "sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ==" + "version": "1.11.9", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz", + "integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==" }, "node_modules/debug": { "version": "4.3.4", @@ -43853,12 +43853,12 @@ "version": "1.5.0-next.11", "license": "SEE LICENSE.md", "dependencies": { - "@floating-ui/dom": "1.4.2", + "@floating-ui/dom": "1.4.3", "@stencil/core": "2.22.3", "@types/color": "3.0.3", "color": "4.2.3", "composed-offset-position": "0.0.4", - "dayjs": "1.11.8", + "dayjs": "1.11.9", "focus-trap": "7.4.3", "form-request-submit-polyfill": "2.0.0", "lodash-es": "4.17.21", @@ -45702,7 +45702,7 @@ "@esri/calcite-design-tokens": "1.0.0", "@esri/calcite-ui-icons": "3.23.1", "@esri/eslint-plugin-calcite-components": "0.2.2", - "@floating-ui/dom": "1.4.2", + "@floating-ui/dom": "1.4.3", "@stencil-community/eslint-plugin": "0.5.0", "@stencil/core": "2.22.3", "@stencil/postcss": "2.1.0", @@ -45712,7 +45712,7 @@ "@types/color": "3.0.3", "color": "4.2.3", "composed-offset-position": "0.0.4", - "dayjs": "1.11.8", + "dayjs": "1.11.9", "focus-trap": "7.4.3", "form-request-submit-polyfill": "2.0.0", "lodash-es": "4.17.21", @@ -45749,9 +45749,9 @@ "integrity": "sha512-Bu+AMaXNjrpjh41znzHqaz3r2Nr8hHuHZT6V2LBKMhyMl0FgKA62PNYbqnfgmzOhoWZj70Zecisbo4H1rotP5g==" }, "@floating-ui/dom": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.4.2.tgz", - "integrity": "sha512-VKmvHVatWnewmGGy+7Mdy4cTJX71Pli6v/Wjb5RQBuq5wjUYx+Ef+kRThi8qggZqDgD8CogCpqhRoVp3+yQk+g==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.4.3.tgz", + "integrity": "sha512-nB/68NyaQlcdY22L+Fgd1HERQ7UGv7XFN+tPxwrEfQL4nKtAP/jIZnZtpUlXbtV+VEGHh6W/63Gy2C5biWI3sA==", "requires": { "@floating-ui/core": "^1.3.1" } @@ -57212,9 +57212,9 @@ "dev": true }, "dayjs": { - "version": "1.11.8", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.8.tgz", - "integrity": "sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ==" + "version": "1.11.9", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz", + "integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==" }, "debug": { "version": "4.3.4", diff --git a/packages/calcite-components/.eslintrc.json b/packages/calcite-components/.eslintrc.cjs similarity index 56% rename from packages/calcite-components/.eslintrc.json rename to packages/calcite-components/.eslintrc.cjs index 65056ad0151..2a3b318f24f 100644 --- a/packages/calcite-components/.eslintrc.json +++ b/packages/calcite-components/.eslintrc.cjs @@ -1,8 +1,9 @@ -{ - "env": { +module.exports = { + root: true, + env: { "jest/globals": true }, - "extends": [ + extends: [ "plugin:@esri/calcite-components/recommended", "plugin:@stencil-community/recommended", "plugin:@typescript-eslint/recommended", @@ -10,14 +11,15 @@ "plugin:jsdoc/recommended", "prettier" ], - "ignorePatterns": ["dist", "docs", "hydrate", "www"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "./tsconfig-eslint.json", - "ecmaVersion": 2018, - "sourceType": "module" + ignorePatterns: ["dist", "docs", "hydrate", "www"], + parser: "@typescript-eslint/parser", + parserOptions: { + tsconfigRootDir: __dirname, + project: ["tsconfig-eslint.json"], + ecmaVersion: 2021, + sourceType: "module" }, - "plugins": [ + plugins: [ "@esri/calcite-components", "@typescript-eslint", "eslint-plugin-react", @@ -27,16 +29,16 @@ "prettier", "unicorn" ], - "rules": { + rules: { "@esri/calcite-components/ban-events": [ "warn", { - "event": "keyup", - "message": "Use keydown instead for consistent interaction behavior (e.g., closing, moving focus, etc.)." + event: "keyup", + message: "Use keydown instead for consistent interaction behavior (e.g., closing, moving focus, etc.)." }, { - "event": "keypress", - "message": "Use keydown instead for consistent interaction behavior (e.g., closing, moving focus, etc.)." + event: "keypress", + message: "Use keydown instead for consistent interaction behavior (e.g., closing, moving focus, etc.)." } ], "@stencil-community/decorators-context": "off", @@ -51,8 +53,8 @@ "@typescript-eslint/explicit-module-boundary-types": [ "error", { - "allowArgumentsExplicitlyTypedAsAny": true, - "allowedNames": [ + allowArgumentsExplicitlyTypedAsAny: true, + allowedNames: [ "connectedCallback", "disconnectedCallback", "componentWillRender", @@ -67,20 +69,20 @@ ], "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unused-vars": "error", - "curly": "error", - "import/no-dynamic-require": ["error", { "esmodule": true }], + curly: "error", + "import/no-dynamic-require": ["error", { esmodule: true }], "jest/expect-expect": "off", "jest/no-export": "warn", "jsdoc/check-tag-names": "off", "jsdoc/require-jsdoc": "off", - "jsdoc/tag-lines": ["error", "any", { "startLines": 1 }], + "jsdoc/tag-lines": ["error", "any", { startLines: 1 }], "lines-between-class-members": ["error", "always"], "no-eval": "error", "no-implied-eval": "error", "no-multiple-empty-lines": [ "error", { - "max": 1 + max: 1 } ], "no-new-func": "error", @@ -88,14 +90,14 @@ "react/forbid-component-props": [ "warn", { - "forbid": [ + forbid: [ { - "propName": "onKeyPress", - "message": "Use onKeyDown instead for consistent interaction behavior (e.g., closing, moving focus, etc.)." + propName: "onKeyPress", + message: "Use onKeyDown instead for consistent interaction behavior (e.g., closing, moving focus, etc.)." }, { - "propName": "onKeyUp", - "message": "Use onKeyDown instead for consistent interaction behavior (e.g., closing, moving focus, etc.)." + propName: "onKeyUp", + message: "Use onKeyDown instead for consistent interaction behavior (e.g., closing, moving focus, etc.)." } ] } @@ -103,14 +105,14 @@ "react/forbid-dom-props": [ "warn", { - "forbid": [ + forbid: [ { - "propName": "onKeyPress", - "message": "Use onKeyDown instead for consistent interaction behavior (e.g., closing, moving focus, etc.)." + propName: "onKeyPress", + message: "Use onKeyDown instead for consistent interaction behavior (e.g., closing, moving focus, etc.)." }, { - "propName": "onKeyUp", - "message": "Use onKeyDown instead for consistent interaction behavior (e.g., closing, moving focus, etc)." + propName: "onKeyUp", + message: "Use onKeyDown instead for consistent interaction behavior (e.g., closing, moving focus, etc)." } ] } @@ -123,28 +125,28 @@ "unicorn/prevent-abbreviations": [ "error", { - "allowList": { - "e2ePage": true + allowList: { + e2ePage: true }, - "extendDefaultReplacements": false, - "replacements": { - "e": { - "error": true, - "event": true + extendDefaultReplacements: false, + replacements: { + e: { + error: true, + event: true } }, - "checkProperties": false, - "checkFilenames": false + checkProperties: false, + checkFilenames: false } ] }, - "settings": { - "react": { - "pragma": "h" + settings: { + react: { + pragma: "h" }, - "jsdoc": { - "ignoreInternal": true, - "ignorePrivate": true + jsdoc: { + ignoreInternal: true, + ignorePrivate: true } } -} +}; From 12a6ace2de72cd6ccf2bc5c10a7c350ab89d968f Mon Sep 17 00:00:00 2001 From: Ben Elan Date: Fri, 7 Jul 2023 18:51:25 -0700 Subject: [PATCH 2/3] chore: cleanup --- packages/calcite-components/src/tests/commonTests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/calcite-components/src/tests/commonTests.ts b/packages/calcite-components/src/tests/commonTests.ts index ebb08b08f86..4805efe4092 100644 --- a/packages/calcite-components/src/tests/commonTests.ts +++ b/packages/calcite-components/src/tests/commonTests.ts @@ -918,8 +918,8 @@ async function getTagAndPage(componentTestSetup: ComponentTestSetup): Promise Date: Fri, 7 Jul 2023 18:52:19 -0700 Subject: [PATCH 3/3] chore: cleanup --- packages/calcite-components/src/tests/commonTests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/calcite-components/src/tests/commonTests.ts b/packages/calcite-components/src/tests/commonTests.ts index 4805efe4092..c08e9afe039 100644 --- a/packages/calcite-components/src/tests/commonTests.ts +++ b/packages/calcite-components/src/tests/commonTests.ts @@ -919,7 +919,7 @@ async function getTagAndPage(componentTestSetup: ComponentTestSetup): Promise