From 10e0ed594196386796b8c505ac15e7a189c8e24e Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 09:30:59 -0500 Subject: [PATCH 01/19] Add eslint config --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9f864f193e1..82c2660506c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,3 +62,11 @@ repos: - id: pyupgrade args: - --py310-plus + + +- repo: https://github.com/pre-commit/mirrors-eslint + rev: 'v8.4.0' + hooks: + - id: eslint + files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx + types: [file] From c398da3171f68be54213afe83a509ecfa4a78df4 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 11:05:52 -0500 Subject: [PATCH 02/19] Add typescript dependency --- .pre-commit-config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 82c2660506c..dfa5c2397c0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -70,3 +70,5 @@ repos: - id: eslint files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx types: [file] + additional_dependencies: + - 'typescript' From cfbcea1ff1a137885ce2a6dbb462388d3b70dd51 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 11:07:45 -0500 Subject: [PATCH 03/19] Add eslint dependency --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dfa5c2397c0..781f1cf977e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -71,4 +71,5 @@ repos: files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx types: [file] additional_dependencies: + - 'eslint' - 'typescript' From cec87e9785dc6dc9812eed1985ba344c0a47c235 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 11:08:46 -0500 Subject: [PATCH 04/19] Disable workflows for efficiency while debugging --- .github/workflows/build.yml | 8 ++++---- .github/workflows/lint.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d2fa2e3870..bf21eb87d1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,10 +7,10 @@ on: - pyscriptjs/** - .github/workflows/** # Test that workflows work when changed - pull_request: # Run on any PR that modifies files in pyscriptjs/ - paths: - - pyscriptjs/** - - .github/workflows/** +# pull_request: # Run on any PR that modifies files in pyscriptjs/ +# paths: +# - pyscriptjs/** +# - .github/workflows/** jobs: build: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a957268f199..7821604188a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,7 +5,7 @@ on: branches: - main - pull_request: # Run on any PR that modifies files in pyscriptjs/ +# pull_request: # Run on any PR that modifies files in pyscriptjs/ jobs: build: From 7d52d245e8e775715be2dd86ab8a174fd31c199f Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 11:11:39 -0500 Subject: [PATCH 05/19] Add eslint-plugin dependency --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 781f1cf977e..b06f32a9cc5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -73,3 +73,4 @@ repos: additional_dependencies: - 'eslint' - 'typescript' + - 'eslint-plugin' From 2589b80b2dc05df36d872a40f10a8298f6907739 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 11:12:30 -0500 Subject: [PATCH 06/19] Add pacakge namespace --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b06f32a9cc5..45ce72ff78f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -73,4 +73,4 @@ repos: additional_dependencies: - 'eslint' - 'typescript' - - 'eslint-plugin' + - '@typescript-eslint/eslint-plugin' From ac14a860c65f7007e9e184f89aa9e45f54c87f82 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 11:15:27 -0500 Subject: [PATCH 07/19] Add eslint-plugin-svelte3 dependency --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 45ce72ff78f..75b3716f686 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,3 +74,4 @@ repos: - 'eslint' - 'typescript' - '@typescript-eslint/eslint-plugin' + - 'eslint-plugin-svelte3' From 475f76bb1b3d7b93109dd6d370dcfb20962992b2 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 11:29:38 -0500 Subject: [PATCH 08/19] Add additional eslint dependencies --- .pre-commit-config.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 75b3716f686..0c5db47842a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,6 +72,9 @@ repos: types: [file] additional_dependencies: - 'eslint' + - 'eslint-plugin-svelte3' - 'typescript' - '@typescript-eslint/eslint-plugin' - - 'eslint-plugin-svelte3' + - '@typescript-eslint/parser' + + From be357782782d3615a155011857e6f57b89f6f023 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 11:30:00 -0500 Subject: [PATCH 09/19] TEMPORARY: comment out line that breaks eslint in pre-commit --- pyscriptjs/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyscriptjs/tsconfig.json b/pyscriptjs/tsconfig.json index 91d60a8d8c2..c89452f4f00 100644 --- a/pyscriptjs/tsconfig.json +++ b/pyscriptjs/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "@tsconfig/svelte/tsconfig.json", + // "extends": "@tsconfig/svelte/tsconfig.json", "include": ["src/**/*"], "exclude": ["node_modules/*", "__sapper__/*", "public/*"], From e54663bf749157429d0aca808859a7b2d9dafbe4 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 12:15:32 -0500 Subject: [PATCH 10/19] Try to add some local path changes --- .pre-commit-config.yaml | 1 + pyscriptjs/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0c5db47842a..40fd4b108d7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -70,6 +70,7 @@ repos: - id: eslint files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx types: [file] + args: [--resolve-plugins-relative-to, ./pyscriptjs] additional_dependencies: - 'eslint' - 'eslint-plugin-svelte3' diff --git a/pyscriptjs/tsconfig.json b/pyscriptjs/tsconfig.json index c89452f4f00..c9eaab45bed 100644 --- a/pyscriptjs/tsconfig.json +++ b/pyscriptjs/tsconfig.json @@ -1,7 +1,7 @@ { // "extends": "@tsconfig/svelte/tsconfig.json", - "include": ["src/**/*"], + "include": ["pyscriptjs/src/**/*"], "exclude": ["node_modules/*", "__sapper__/*", "public/*"], "compilerOptions": { "moduleResolution": "node", From 2061c98fdf1ab1ed7c23e77937a581a0e9293d64 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 12:17:02 -0500 Subject: [PATCH 11/19] Comment out path specs --- pyscriptjs/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyscriptjs/tsconfig.json b/pyscriptjs/tsconfig.json index c9eaab45bed..13b6b78793f 100644 --- a/pyscriptjs/tsconfig.json +++ b/pyscriptjs/tsconfig.json @@ -1,8 +1,8 @@ { // "extends": "@tsconfig/svelte/tsconfig.json", - "include": ["pyscriptjs/src/**/*"], - "exclude": ["node_modules/*", "__sapper__/*", "public/*"], + // "include": ["pyscriptjs/src/**/*"], + // "exclude": ["node_modules/*", "__sapper__/*", "public/*"], "compilerOptions": { "moduleResolution": "node", "target": "es2017", From 0affc8d7d9bbb763b72948766261615b3c78ecad Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 14:14:05 -0500 Subject: [PATCH 12/19] Restore tsconfig.json --- pyscriptjs/tsconfig.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyscriptjs/tsconfig.json b/pyscriptjs/tsconfig.json index 13b6b78793f..91d60a8d8c2 100644 --- a/pyscriptjs/tsconfig.json +++ b/pyscriptjs/tsconfig.json @@ -1,8 +1,8 @@ { - // "extends": "@tsconfig/svelte/tsconfig.json", + "extends": "@tsconfig/svelte/tsconfig.json", - // "include": ["pyscriptjs/src/**/*"], - // "exclude": ["node_modules/*", "__sapper__/*", "public/*"], + "include": ["src/**/*"], + "exclude": ["node_modules/*", "__sapper__/*", "public/*"], "compilerOptions": { "moduleResolution": "node", "target": "es2017", From 71aa341c6f3c20d91e1e8e05247f30804f7dde3e Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 22:15:02 -0500 Subject: [PATCH 13/19] Fix path of files so we don't lint the examples --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 40fd4b108d7..97b90a91ffa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -68,14 +68,14 @@ repos: rev: 'v8.4.0' hooks: - id: eslint - files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx + files: pyscriptjs/src/.*\.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx types: [file] - args: [--resolve-plugins-relative-to, ./pyscriptjs] additional_dependencies: - 'eslint' - 'eslint-plugin-svelte3' - 'typescript' - '@typescript-eslint/eslint-plugin' - '@typescript-eslint/parser' +# - '@tsconfig/svelte' From 780ad9e1891e7a0104c992c136757234307725f0 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 22:15:09 -0500 Subject: [PATCH 14/19] Replace extends with contents When running pre-commit, we cannot resolve the import --- pyscriptjs/tsconfig.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyscriptjs/tsconfig.json b/pyscriptjs/tsconfig.json index 91d60a8d8c2..13694d37564 100644 --- a/pyscriptjs/tsconfig.json +++ b/pyscriptjs/tsconfig.json @@ -1,5 +1,7 @@ { - "extends": "@tsconfig/svelte/tsconfig.json", + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Svelte", + "_version": "3.0.0", "include": ["src/**/*"], "exclude": ["node_modules/*", "__sapper__/*", "public/*"], @@ -21,6 +23,12 @@ /** Requests the runtime types from the svelte modules by default. Needed for TS files or else you get errors. */ "types": ["svelte"], + /** + TypeScript doesn't know about import usages in the template because it only sees the + script of a Svelte file. Therefore preserve all value imports. Requires TS 4.5 or higher. + */ + "preserveValueImports": true, + "strict": false, "esModuleInterop": true, "skipLibCheck": true, From 50fd83332970705fba26d566311d2fabe56293db Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 7 May 2022 03:17:25 +0000 Subject: [PATCH 15/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .pre-commit-config.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 97b90a91ffa..4d046b5e6a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,17 +65,15 @@ repos: - repo: https://github.com/pre-commit/mirrors-eslint - rev: 'v8.4.0' + rev: v8.4.0 hooks: - id: eslint files: pyscriptjs/src/.*\.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx types: [file] additional_dependencies: - - 'eslint' - - 'eslint-plugin-svelte3' - - 'typescript' - - '@typescript-eslint/eslint-plugin' - - '@typescript-eslint/parser' + - eslint + - eslint-plugin-svelte3 + - typescript + - '@typescript-eslint/eslint-plugin' + - '@typescript-eslint/parser' # - '@tsconfig/svelte' - - From e60b4864a72e7963c1abae3e24347ffe550df356 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 22:21:34 -0500 Subject: [PATCH 16/19] Revert "Disable workflows for efficiency while debugging" This reverts commit cec87e9785dc6dc9812eed1985ba344c0a47c235. --- .github/workflows/build.yml | 8 ++++---- .github/workflows/lint.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf21eb87d1f..3d2fa2e3870 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,10 +7,10 @@ on: - pyscriptjs/** - .github/workflows/** # Test that workflows work when changed -# pull_request: # Run on any PR that modifies files in pyscriptjs/ -# paths: -# - pyscriptjs/** -# - .github/workflows/** + pull_request: # Run on any PR that modifies files in pyscriptjs/ + paths: + - pyscriptjs/** + - .github/workflows/** jobs: build: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7821604188a..a957268f199 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,7 +5,7 @@ on: branches: - main -# pull_request: # Run on any PR that modifies files in pyscriptjs/ + pull_request: # Run on any PR that modifies files in pyscriptjs/ jobs: build: From ee134f859b5e329cee42c38f5ee20084b566d933 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 22:22:55 -0500 Subject: [PATCH 17/19] Remove unneeded commented dependency --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4d046b5e6a7..a802f298a40 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -76,4 +76,3 @@ repos: - typescript - '@typescript-eslint/eslint-plugin' - '@typescript-eslint/parser' -# - '@tsconfig/svelte' From 5fc3cdc678464bc9e11d9bddfd08e2cb2624476d Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 22:23:43 -0500 Subject: [PATCH 18/19] Remove extra newline --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a802f298a40..3fc0c2532a9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -63,7 +63,6 @@ repos: args: - --py310-plus - - repo: https://github.com/pre-commit/mirrors-eslint rev: v8.4.0 hooks: From ec3a79d90f0b2f553e18e4b772a1c1c19cc117d3 Mon Sep 17 00:00:00 2001 From: Matt Kramer Date: Fri, 6 May 2022 22:26:57 -0500 Subject: [PATCH 19/19] Remove lines which were added but are likely not necessary --- pyscriptjs/tsconfig.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pyscriptjs/tsconfig.json b/pyscriptjs/tsconfig.json index 13694d37564..31509cef1a9 100644 --- a/pyscriptjs/tsconfig.json +++ b/pyscriptjs/tsconfig.json @@ -23,12 +23,6 @@ /** Requests the runtime types from the svelte modules by default. Needed for TS files or else you get errors. */ "types": ["svelte"], - /** - TypeScript doesn't know about import usages in the template because it only sees the - script of a Svelte file. Therefore preserve all value imports. Requires TS 4.5 or higher. - */ - "preserveValueImports": true, - "strict": false, "esModuleInterop": true, "skipLibCheck": true,