@bastidood/eslint-config-svelte 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Basti Ortiz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,37 @@
1
- # Temporary Holding Version
1
+ # `@bastidood/eslint-config-svelte`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Svelte entries for `@bastidood/eslint-config`.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ pnpm add --save-dev @bastidood/eslint-config @bastidood/eslint-config-svelte eslint svelte typescript
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ ```ts
14
+ // eslint.config.ts
15
+ import { compose } from '@bastidood/eslint-config';
16
+ import { SVELTE } from '@bastidood/eslint-config-svelte';
17
+ import { CORE } from '@bastidood/eslint-config/core';
18
+ import { defineConfig } from 'eslint/config';
19
+
20
+ export default defineConfig({ files: ['**/*.ts'] }, compose(CORE, SVELTE));
21
+ ```
22
+
23
+ List `SVELTE` after `CORE`.
24
+
25
+ ## Entry Points
26
+
27
+ | Entry point | Contents |
28
+ | ------------------------------------------------------- | --------------------------------------------------- |
29
+ | `@bastidood/eslint-config-svelte` | Svelte rules and type-aware parsing; bans `$effect` |
30
+ | `@bastidood/eslint-config-svelte/tanstack-svelte-query` | Bans `useQueryClient` |
31
+
32
+ ## Limitations
33
+
34
+ - Requires Svelte 5.
35
+ - Rules are not configurable.
36
+ - Covers `.svelte`, `.svelte.js`, and `.svelte.ts` files. List your other files yourself.
37
+ - SvelteKit's inferred route props are invisible to ESLint due to differences between `eslint-plugin-svelte` and `svelte-check`. Annotate them (e.g., `const { params }: PageProps = $props()` via `./$types`) or turn off the respective `@typescript-eslint/no-unsafe-*` rules for route files in your own configuration.
@@ -0,0 +1,18 @@
1
+ import { Linter } from "eslint";
2
+ export interface RestrictedGlobal {
3
+ readonly name: string;
4
+ readonly message: string;
5
+ }
6
+ export interface ScopedGlobals {
7
+ readonly files: string[];
8
+ readonly restrictions: {
9
+ readonly globals: RestrictedGlobal[];
10
+ };
11
+ }
12
+ export interface SvelteEntry {
13
+ readonly configs: (Linter.Config | Linter.Config[])[];
14
+ readonly extraFileExtensions: string[];
15
+ readonly scopedRestrictions: ScopedGlobals[];
16
+ }
17
+ /** `eslint-plugin-svelte` rules with type-aware parsing of `.svelte` components and rune modules. */
18
+ export declare const SVELTE: SvelteEntry;
package/dist/index.mjs ADDED
@@ -0,0 +1,33 @@
1
+ import sveltePlugin from "eslint-plugin-svelte";
2
+ import tseslint from "typescript-eslint";
3
+ // src/index.ts
4
+ /** Svelte components and rune modules, the files that `eslint-plugin-svelte` itself parses. */
5
+ const SVELTE_FILES = [
6
+ "**/*.svelte",
7
+ "**/*.svelte.js",
8
+ "**/*.svelte.ts"
9
+ ];
10
+ /** `eslint-plugin-svelte` rules with type-aware parsing of `.svelte` components and rune modules. */
11
+ const SVELTE = {
12
+ configs: [sveltePlugin.configs.recommended, {
13
+ name: "@bastidood/eslint-config-svelte/parser",
14
+ files: SVELTE_FILES,
15
+ languageOptions: { parserOptions: {
16
+ parser: tseslint.parser,
17
+ projectService: true
18
+ } },
19
+ rules: {
20
+ "prefer-const": "off",
21
+ "svelte/prefer-const": "error"
22
+ }
23
+ }],
24
+ extraFileExtensions: [".svelte"],
25
+ scopedRestrictions: [{
26
+ files: SVELTE_FILES,
27
+ restrictions: { globals: [{
28
+ name: "$effect",
29
+ message: "Perform side effects in the event handlers that cause them instead of synchronizing them with `$effect`, which leads to buggy reactivity."
30
+ }] }
31
+ }]
32
+ };
33
+ export { SVELTE };
@@ -0,0 +1,10 @@
1
+ /** Forbids capturing the TanStack Svelte Query client in closures. */
2
+ export declare const TANSTACK_SVELTE_QUERY: {
3
+ restrictions: {
4
+ importPaths: {
5
+ name: string;
6
+ importNames: string[];
7
+ message: string;
8
+ }[];
9
+ };
10
+ };
@@ -0,0 +1,8 @@
1
+ // src/tanstack-svelte-query.ts
2
+ /** Forbids capturing the TanStack Svelte Query client in closures. */
3
+ const TANSTACK_SVELTE_QUERY = { restrictions: { importPaths: [{
4
+ name: "@tanstack/svelte-query",
5
+ importNames: ["useQueryClient"],
6
+ message: "Obtain the `QueryClient` from the query or mutation callback context instead of capturing `useQueryClient` in a closure."
7
+ }] } };
8
+ export { TANSTACK_SVELTE_QUERY };
package/package.json CHANGED
@@ -1,6 +1,46 @@
1
1
  {
2
2
  "name": "@bastidood/eslint-config-svelte",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Svelte rules and type-aware parsing for ESLint, composed with @bastidood/eslint-config.",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/BastiDood/slopstopper",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/BastiDood/slopstopper.git",
10
+ "directory": "configs/eslint-svelte"
11
+ },
12
+ "type": "module",
13
+ "imports": {
14
+ "#*": "./src/*"
15
+ },
16
+ "exports": {
17
+ ".": "./dist/index.mjs",
18
+ "./tanstack-svelte-query": "./dist/tanstack-svelte-query.mjs"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "eslint-plugin-svelte": "^3.23.1",
28
+ "typescript-eslint": "^8.72.1"
29
+ },
30
+ "devDependencies": {
31
+ "@bastidood/tsconfig": "0.1.0",
32
+ "@typescript/native": "npm:typescript@^7.0.2",
33
+ "eslint": "^10.13.0",
34
+ "tsdown": "^0.23.2",
35
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
36
+ },
37
+ "peerDependencies": {
38
+ "@bastidood/eslint-config": "^0.1.0",
39
+ "eslint": "^10.0.0",
40
+ "svelte": "^5.0.0",
41
+ "typescript": ">=4.8.4 <6.1.0"
42
+ },
43
+ "scripts": {
44
+ "check": "tsc"
45
+ }
6
46
  }