Adrien Denat commited on
Commit
fa72efa
1 Parent(s): e532ada

migrate to eslint-plugin-svelte from deprecated plugin (#182)

Browse files

* migrate to eslint-plugin-svelte from deprecated plugin

* fix missing change in eslintrc

* add rule for Eslint vscode extension to parse svelte files

* update the code after migrating to latest eslint-svelte plugin

.eslintrc.cjs CHANGED
@@ -1,21 +1,39 @@
1
  module.exports = {
2
  root: true,
3
  parser: "@typescript-eslint/parser",
4
- extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
5
- plugins: ["svelte3", "@typescript-eslint"],
 
 
 
 
 
6
  ignorePatterns: ["*.cjs"],
7
- overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
8
- settings: {
9
- "svelte3/typescript": () => require("typescript"),
10
- },
 
 
 
 
 
11
  parserOptions: {
12
  sourceType: "module",
13
  ecmaVersion: 2020,
 
14
  },
15
  rules: {
16
  "no-shadow": ["error"],
17
  "@typescript-eslint/no-explicit-any": "error",
18
  "@typescript-eslint/no-non-null-assertion": "error",
 
 
 
 
 
 
 
19
  },
20
  env: {
21
  browser: true,
 
1
  module.exports = {
2
  root: true,
3
  parser: "@typescript-eslint/parser",
4
+ extends: [
5
+ "eslint:recommended",
6
+ "plugin:@typescript-eslint/recommended",
7
+ "plugin:svelte/recommended",
8
+ "prettier",
9
+ ],
10
+ plugins: ["@typescript-eslint"],
11
  ignorePatterns: ["*.cjs"],
12
+ overrides: [
13
+ {
14
+ files: ["*.svelte"],
15
+ parser: "svelte-eslint-parser",
16
+ parserOptions: {
17
+ parser: "@typescript-eslint/parser",
18
+ },
19
+ },
20
+ ],
21
  parserOptions: {
22
  sourceType: "module",
23
  ecmaVersion: 2020,
24
+ extraFileExtensions: [".svelte"],
25
  },
26
  rules: {
27
  "no-shadow": ["error"],
28
  "@typescript-eslint/no-explicit-any": "error",
29
  "@typescript-eslint/no-non-null-assertion": "error",
30
+ "@typescript-eslint/no-unused-vars": [
31
+ // prevent variables with a _ prefix from being marked as unused
32
+ "warn",
33
+ {
34
+ argsIgnorePattern: "^_",
35
+ },
36
+ ],
37
  },
38
  env: {
39
  browser: true,
.vscode/settings.json CHANGED
@@ -3,5 +3,6 @@
3
  "editor.defaultFormatter": "esbenp.prettier-vscode",
4
  "editor.codeActionsOnSave": {
5
  "source.fixAll": true
6
- }
 
7
  }
 
3
  "editor.defaultFormatter": "esbenp.prettier-vscode",
4
  "editor.codeActionsOnSave": {
5
  "source.fixAll": true
6
+ },
7
+ "eslint.validate": ["javascript", "svelte"]
8
  }
package-lock.json CHANGED
@@ -34,7 +34,7 @@
34
  "@typescript-eslint/parser": "^5.45.0",
35
  "eslint": "^8.28.0",
36
  "eslint-config-prettier": "^8.5.0",
37
- "eslint-plugin-svelte3": "^4.0.0",
38
  "prettier": "^2.8.0",
39
  "prettier-plugin-svelte": "^2.8.1",
40
  "prettier-plugin-tailwindcss": "^0.2.7",
@@ -1806,14 +1806,36 @@
1806
  "eslint": ">=7.0.0"
1807
  }
1808
  },
1809
- "node_modules/eslint-plugin-svelte3": {
1810
- "version": "4.0.0",
1811
- "resolved": "https://registry.npmjs.org/eslint-plugin-svelte3/-/eslint-plugin-svelte3-4.0.0.tgz",
1812
- "integrity": "sha512-OIx9lgaNzD02+MDFNLw0GEUbuovNcglg+wnd/UY0fbZmlQSz7GlQiQ1f+yX0XvC07XPcDOnFcichqI3xCwp71g==",
1813
  "dev": true,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1814
  "peerDependencies": {
1815
- "eslint": ">=8.0.0",
1816
- "svelte": "^3.2.0"
 
 
 
 
 
1817
  }
1818
  },
1819
  "node_modules/eslint-scope": {
@@ -2506,6 +2528,12 @@
2506
  "node": ">=6"
2507
  }
2508
  },
 
 
 
 
 
 
2509
  "node_modules/kolorist": {
2510
  "version": "1.7.0",
2511
  "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.7.0.tgz",
@@ -3071,9 +3099,9 @@
3071
  }
3072
  },
3073
  "node_modules/postcss": {
3074
- "version": "8.4.21",
3075
- "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz",
3076
- "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==",
3077
  "funding": [
3078
  {
3079
  "type": "opencollective",
@@ -3082,10 +3110,14 @@
3082
  {
3083
  "type": "tidelift",
3084
  "url": "https://tidelift.com/funding/github/npm/postcss"
 
 
 
 
3085
  }
3086
  ],
3087
  "dependencies": {
3088
- "nanoid": "^3.3.4",
3089
  "picocolors": "^1.0.0",
3090
  "source-map-js": "^1.0.2"
3091
  },
@@ -3173,6 +3205,22 @@
3173
  "postcss": "^8.2.14"
3174
  }
3175
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3176
  "node_modules/postcss-selector-parser": {
3177
  "version": "6.0.11",
3178
  "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz",
@@ -3443,9 +3491,9 @@
3443
  }
3444
  },
3445
  "node_modules/rollup": {
3446
- "version": "3.20.2",
3447
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.20.2.tgz",
3448
- "integrity": "sha512-3zwkBQl7Ai7MFYQE0y1MeQ15+9jsi7XxfrqwTb/9EK8D9C9+//EBR4M+CuA1KODRaNbFez/lWxA5vhEGZp4MUg==",
3449
  "dev": true,
3450
  "bin": {
3451
  "rollup": "dist/bin/rollup"
@@ -3819,6 +3867,56 @@
3819
  "node": ">=12.20"
3820
  }
3821
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3822
  "node_modules/svelte-hmr": {
3823
  "version": "0.15.1",
3824
  "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.1.tgz",
@@ -4212,15 +4310,14 @@
4212
  "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow=="
4213
  },
4214
  "node_modules/vite": {
4215
- "version": "4.2.1",
4216
- "resolved": "https://registry.npmjs.org/vite/-/vite-4.2.1.tgz",
4217
- "integrity": "sha512-7MKhqdy0ISo4wnvwtqZkjke6XN4taqQ2TBaTccLIpOKv7Vp2h4Y+NpmWCnGDeSvvn45KxvWgGyb0MkHvY1vgbg==",
4218
  "dev": true,
4219
  "dependencies": {
4220
  "esbuild": "^0.17.5",
4221
- "postcss": "^8.4.21",
4222
- "resolve": "^1.22.1",
4223
- "rollup": "^3.18.0"
4224
  },
4225
  "bin": {
4226
  "vite": "bin/vite.js"
 
34
  "@typescript-eslint/parser": "^5.45.0",
35
  "eslint": "^8.28.0",
36
  "eslint-config-prettier": "^8.5.0",
37
+ "eslint-plugin-svelte": "^2.27.3",
38
  "prettier": "^2.8.0",
39
  "prettier-plugin-svelte": "^2.8.1",
40
  "prettier-plugin-tailwindcss": "^0.2.7",
 
1806
  "eslint": ">=7.0.0"
1807
  }
1808
  },
1809
+ "node_modules/eslint-plugin-svelte": {
1810
+ "version": "2.27.3",
1811
+ "resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-2.27.3.tgz",
1812
+ "integrity": "sha512-LPri23kkKeeh+TkYr9FndQEy2Q5BhOrIwatnLdXx6hUtTIolohzrTJhWMK3k8BwitVBnJGl5CDVWNkV80tmdkQ==",
1813
  "dev": true,
1814
+ "dependencies": {
1815
+ "@eslint-community/eslint-utils": "^4.2.0",
1816
+ "@jridgewell/sourcemap-codec": "^1.4.14",
1817
+ "debug": "^4.3.1",
1818
+ "esutils": "^2.0.3",
1819
+ "known-css-properties": "^0.27.0",
1820
+ "postcss": "^8.4.5",
1821
+ "postcss-load-config": "^3.1.4",
1822
+ "postcss-safe-parser": "^6.0.0",
1823
+ "svelte-eslint-parser": "^0.27.0"
1824
+ },
1825
+ "engines": {
1826
+ "node": "^14.17.0 || >=16.0.0"
1827
+ },
1828
+ "funding": {
1829
+ "url": "https://github.com/sponsors/ota-meshi"
1830
+ },
1831
  "peerDependencies": {
1832
+ "eslint": "^7.0.0 || ^8.0.0-0",
1833
+ "svelte": "^3.37.0"
1834
+ },
1835
+ "peerDependenciesMeta": {
1836
+ "svelte": {
1837
+ "optional": true
1838
+ }
1839
  }
1840
  },
1841
  "node_modules/eslint-scope": {
 
2528
  "node": ">=6"
2529
  }
2530
  },
2531
+ "node_modules/known-css-properties": {
2532
+ "version": "0.27.0",
2533
+ "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.27.0.tgz",
2534
+ "integrity": "sha512-uMCj6+hZYDoffuvAJjFAPz56E9uoowFHmTkqRtRq5WyC5Q6Cu/fTZKNQpX/RbzChBYLLl3lo8CjFZBAZXq9qFg==",
2535
+ "dev": true
2536
+ },
2537
  "node_modules/kolorist": {
2538
  "version": "1.7.0",
2539
  "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.7.0.tgz",
 
3099
  }
3100
  },
3101
  "node_modules/postcss": {
3102
+ "version": "8.4.23",
3103
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz",
3104
+ "integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==",
3105
  "funding": [
3106
  {
3107
  "type": "opencollective",
 
3110
  {
3111
  "type": "tidelift",
3112
  "url": "https://tidelift.com/funding/github/npm/postcss"
3113
+ },
3114
+ {
3115
+ "type": "github",
3116
+ "url": "https://github.com/sponsors/ai"
3117
  }
3118
  ],
3119
  "dependencies": {
3120
+ "nanoid": "^3.3.6",
3121
  "picocolors": "^1.0.0",
3122
  "source-map-js": "^1.0.2"
3123
  },
 
3205
  "postcss": "^8.2.14"
3206
  }
3207
  },
3208
+ "node_modules/postcss-safe-parser": {
3209
+ "version": "6.0.0",
3210
+ "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-6.0.0.tgz",
3211
+ "integrity": "sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==",
3212
+ "dev": true,
3213
+ "engines": {
3214
+ "node": ">=12.0"
3215
+ },
3216
+ "funding": {
3217
+ "type": "opencollective",
3218
+ "url": "https://opencollective.com/postcss/"
3219
+ },
3220
+ "peerDependencies": {
3221
+ "postcss": "^8.3.3"
3222
+ }
3223
+ },
3224
  "node_modules/postcss-selector-parser": {
3225
  "version": "6.0.11",
3226
  "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz",
 
3491
  }
3492
  },
3493
  "node_modules/rollup": {
3494
+ "version": "3.21.5",
3495
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.5.tgz",
3496
+ "integrity": "sha512-a4NTKS4u9PusbUJcfF4IMxuqjFzjm6ifj76P54a7cKnvVzJaG12BLVR+hgU2YDGHzyMMQNxLAZWuALsn8q2oQg==",
3497
  "dev": true,
3498
  "bin": {
3499
  "rollup": "dist/bin/rollup"
 
3867
  "node": ">=12.20"
3868
  }
3869
  },
3870
+ "node_modules/svelte-eslint-parser": {
3871
+ "version": "0.27.0",
3872
+ "resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.27.0.tgz",
3873
+ "integrity": "sha512-x9cBbCZwLdCnNE3yPqGhvAqEl9FCILC6AaV2xRtwzaMCpvpqO7ceONXj9xka3fQFczSqLzkwOxP4Ln4cIQNqXg==",
3874
+ "dev": true,
3875
+ "dependencies": {
3876
+ "eslint-scope": "^7.0.0",
3877
+ "eslint-visitor-keys": "^3.0.0",
3878
+ "espree": "^9.0.0"
3879
+ },
3880
+ "engines": {
3881
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
3882
+ },
3883
+ "funding": {
3884
+ "url": "https://github.com/sponsors/ota-meshi"
3885
+ },
3886
+ "peerDependencies": {
3887
+ "svelte": "^3.37.0"
3888
+ },
3889
+ "peerDependenciesMeta": {
3890
+ "svelte": {
3891
+ "optional": true
3892
+ }
3893
+ }
3894
+ },
3895
+ "node_modules/svelte-eslint-parser/node_modules/eslint-scope": {
3896
+ "version": "7.2.0",
3897
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz",
3898
+ "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==",
3899
+ "dev": true,
3900
+ "dependencies": {
3901
+ "esrecurse": "^4.3.0",
3902
+ "estraverse": "^5.2.0"
3903
+ },
3904
+ "engines": {
3905
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
3906
+ },
3907
+ "funding": {
3908
+ "url": "https://opencollective.com/eslint"
3909
+ }
3910
+ },
3911
+ "node_modules/svelte-eslint-parser/node_modules/estraverse": {
3912
+ "version": "5.3.0",
3913
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
3914
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
3915
+ "dev": true,
3916
+ "engines": {
3917
+ "node": ">=4.0"
3918
+ }
3919
+ },
3920
  "node_modules/svelte-hmr": {
3921
  "version": "0.15.1",
3922
  "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.1.tgz",
 
4310
  "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow=="
4311
  },
4312
  "node_modules/vite": {
4313
+ "version": "4.3.5",
4314
+ "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.5.tgz",
4315
+ "integrity": "sha512-0gEnL9wiRFxgz40o/i/eTBwm+NEbpUeTWhzKrZDSdKm6nplj+z4lKz8ANDgildxHm47Vg8EUia0aicKbawUVVA==",
4316
  "dev": true,
4317
  "dependencies": {
4318
  "esbuild": "^0.17.5",
4319
+ "postcss": "^8.4.23",
4320
+ "rollup": "^3.21.0"
 
4321
  },
4322
  "bin": {
4323
  "vite": "bin/vite.js"
package.json CHANGED
@@ -22,7 +22,7 @@
22
  "@typescript-eslint/parser": "^5.45.0",
23
  "eslint": "^8.28.0",
24
  "eslint-config-prettier": "^8.5.0",
25
- "eslint-plugin-svelte3": "^4.0.0",
26
  "prettier": "^2.8.0",
27
  "prettier-plugin-svelte": "^2.8.1",
28
  "prettier-plugin-tailwindcss": "^0.2.7",
 
22
  "@typescript-eslint/parser": "^5.45.0",
23
  "eslint": "^8.28.0",
24
  "eslint-config-prettier": "^8.5.0",
25
+ "eslint-plugin-svelte": "^2.27.3",
26
  "prettier": "^2.8.0",
27
  "prettier-plugin-svelte": "^2.8.1",
28
  "prettier-plugin-tailwindcss": "^0.2.7",
src/lib/components/CodeBlock.svelte CHANGED
@@ -17,9 +17,12 @@
17
 
18
  <div class="group relative my-4 rounded-lg">
19
  <pre
20
- class="scrollbar-custom overflow-auto px-5 scrollbar-thumb-gray-500 hover:scrollbar-thumb-gray-400 dark:scrollbar-thumb-white/10 dark:hover:scrollbar-thumb-white/20"><code
21
- class="language-{lang}">{@html highlightedCode || code.replaceAll("<", "&lt;")}</code
22
- ></pre>
 
 
 
23
  <CopyToClipBoardBtn
24
  classNames="absolute top-2 right-2 invisible opacity-0 group-hover:visible group-hover:opacity-100"
25
  value={code}
 
17
 
18
  <div class="group relative my-4 rounded-lg">
19
  <pre
20
+ class="scrollbar-custom overflow-auto px-5 scrollbar-thumb-gray-500 hover:scrollbar-thumb-gray-400 dark:scrollbar-thumb-white/10 dark:hover:scrollbar-thumb-white/20">
21
+ <code class="language-{lang}">
22
+ <!-- eslint-disable-next-line svelte/no-at-html-tags -->
23
+ {@html highlightedCode || code.replaceAll("<", "&lt;")}
24
+ </code>
25
+ </pre>
26
  <CopyToClipBoardBtn
27
  classNames="absolute top-2 right-2 invisible opacity-0 group-hover:visible group-hover:opacity-100"
28
  value={code}
src/lib/components/chat/ChatInput.svelte CHANGED
@@ -30,6 +30,7 @@
30
  aria-hidden="true"
31
  style="min-height: {minHeight}; max-height: {maxHeight}">{value + "\n"}</pre>
32
 
 
33
  <textarea
34
  enterkeyhint="send"
35
  tabindex="0"
 
30
  aria-hidden="true"
31
  style="min-height: {minHeight}; max-height: {maxHeight}">{value + "\n"}</pre>
32
 
33
+ <!-- svelte-ignore a11y-autofocus -->
34
  <textarea
35
  enterkeyhint="send"
36
  tabindex="0"
src/lib/components/chat/ChatMessage.svelte CHANGED
@@ -104,6 +104,7 @@
104
  {#if token.type === "code"}
105
  <CodeBlock lang={token.lang} code={unsanitizeMd(token.text)} />
106
  {:else}
 
107
  {@html marked(token.raw, options)}
108
  {/if}
109
  {/each}
 
104
  {#if token.type === "code"}
105
  <CodeBlock lang={token.lang} code={unsanitizeMd(token.text)} />
106
  {:else}
107
+ <!-- eslint-disable-next-line svelte/no-at-html-tags -->
108
  {@html marked(token.raw, options)}
109
  {/if}
110
  {/each}
src/routes/privacy/+page.svelte CHANGED
@@ -5,6 +5,7 @@
5
 
6
  <div class="overflow-auto p-6">
7
  <div class="prose mx-auto px-4 pb-24 pt-6 dark:prose-invert md:pt-12">
 
8
  {@html marked(privacy, { gfm: true })}
9
  </div>
10
  </div>
 
5
 
6
  <div class="overflow-auto p-6">
7
  <div class="prose mx-auto px-4 pb-24 pt-6 dark:prose-invert md:pt-12">
8
+ <!-- eslint-disable-next-line svelte/no-at-html-tags -->
9
  {@html marked(privacy, { gfm: true })}
10
  </div>
11
  </div>