Kaynağa Gözat

init: project settings

Thomas Zhang 3 ay önce
ebeveyn
işleme
59e6583c51
6 değiştirilmiş dosya ile 112 ekleme ve 58 silme
  1. 3 1
      .prettierrc
  2. 31 0
      AGENTS.md
  3. 1 31
      CLAUDE.md
  4. 65 8
      eslint.config.js
  5. 11 18
      package-lock.json
  6. 1 0
      package.json

+ 3 - 1
.prettierrc

@@ -1,8 +1,10 @@
 {
 	"useTabs": true,
 	"singleQuote": true,
-	"trailingComma": "none",
+	"trailingComma": "all",
+	"semi": true,
 	"printWidth": 100,
+	"bracketSameLine": false,
 	"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
 	"overrides": [
 		{

+ 31 - 0
AGENTS.md

@@ -0,0 +1,31 @@
+## Project Configuration
+
+- **Language**: TypeScript
+- **Package Manager**: npm
+- **Add-ons**: prettier, eslint, tailwindcss, vitest, playwright, mcp
+
+---
+
+You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
+
+## Available MCP Tools:
+
+### 1. list-sections
+
+Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
+When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
+
+### 2. get-documentation
+
+Retrieves full documentation content for specific sections. Accepts single or multiple sections.
+After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.
+
+### 3. svelte-autofixer
+
+Analyzes Svelte code and returns issues and suggestions.
+You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.
+
+### 4. playground-link
+
+Generates a Svelte Playground link with the provided code.
+After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.

+ 1 - 31
CLAUDE.md

@@ -1,31 +1 @@
-## Project Configuration
-
-- **Language**: TypeScript
-- **Package Manager**: npm
-- **Add-ons**: prettier, eslint, tailwindcss, vitest, playwright, mcp
-
----
-
-You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
-
-## Available MCP Tools:
-
-### 1. list-sections
-
-Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
-When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
-
-### 2. get-documentation
-
-Retrieves full documentation content for specific sections. Accepts single or multiple sections.
-After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.
-
-### 3. svelte-autofixer
-
-Analyzes Svelte code and returns issues and suggestions.
-You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.
-
-### 4. playground-link
-
-Generates a Svelte Playground link with the provided code.
-After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.
+@AGENTS.md

+ 65 - 8
eslint.config.js

@@ -1,17 +1,22 @@
-import prettier from 'eslint-config-prettier';
 import path from 'node:path';
+
 import { includeIgnoreFile } from '@eslint/compat';
 import js from '@eslint/js';
-import svelte from 'eslint-plugin-svelte';
 import { defineConfig } from 'eslint/config';
+import prettier from 'eslint-config-prettier';
+import simpleImportSort from 'eslint-plugin-simple-import-sort';
+import svelte from 'eslint-plugin-svelte';
 import globals from 'globals';
 import ts from 'typescript-eslint';
+
 import svelteConfig from './svelte.config.js';
 
 const gitignorePath = path.resolve(import.meta.dirname, '.gitignore');
+const prettierignorePath = path.resolve(import.meta.dirname, '.prettierignore');
 
 export default defineConfig(
 	includeIgnoreFile(gitignorePath),
+	includeIgnoreFile(prettierignorePath),
 	js.configs.recommended,
 	ts.configs.recommended,
 	svelte.configs.recommended,
@@ -19,11 +24,29 @@ export default defineConfig(
 	svelte.configs.prettier,
 	{
 		languageOptions: { globals: { ...globals.browser, ...globals.node } },
+		plugins: {
+			'simple-import-sort': simpleImportSort,
+		},
 		rules: {
 			// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
 			// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
-			'no-undef': 'off'
-		}
+			'no-undef': 'off',
+			'simple-import-sort/imports': [
+				'error',
+				{
+					groups: [
+						['^node:'],
+						['^@?\\w'],
+						['^\\$app/'],
+						['^\\$lib/'],
+						['^\\$'],
+						['^\\.\\./'],
+						['^\\./'],
+					],
+				},
+			],
+			'simple-import-sort/exports': 'error',
+		},
 	},
 	{
 		files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
@@ -32,8 +55,42 @@ export default defineConfig(
 				projectService: true,
 				extraFileExtensions: ['.svelte'],
 				parser: ts.parser,
-				svelteConfig
-			}
-		}
-	}
+				svelteConfig,
+			},
+		},
+		rules: {
+			'svelte/sort-attributes': [
+				'error',
+				{
+					order: [
+						'this',
+						'bind:this',
+						'id',
+						'name',
+						'slot',
+						{ match: '/^--/u', sort: 'alphabetical' },
+						['style', '/^style:/u'],
+						'class',
+						{ match: '/^class:/u', sort: 'alphabetical' },
+						{
+							match: [
+								'!/:/u',
+								'!/^(?:this|id|name|slot|style|class)$/u',
+								'!/^--/u',
+								'!/^on[a-z]/u',
+							],
+							sort: 'alphabetical',
+						},
+						['/^bind:/u', '!bind:this', '/^on:/u', '/^on[a-z]/u'],
+						{ match: '/^use:/u', sort: 'alphabetical' },
+						{ match: '/^transition:/u', sort: 'alphabetical' },
+						{ match: '/^in:/u', sort: 'alphabetical' },
+						{ match: '/^out:/u', sort: 'alphabetical' },
+						{ match: '/^animate:/u', sort: 'alphabetical' },
+						{ match: '/^let:/u', sort: 'alphabetical' },
+					],
+				},
+			],
+		},
+	},
 );

+ 11 - 18
package-lock.json

@@ -21,6 +21,7 @@
 				"@vitest/browser-playwright": "^4.1.0",
 				"eslint": "^9.39.2",
 				"eslint-config-prettier": "^10.1.8",
+				"eslint-plugin-simple-import-sort": "^13.0.0",
 				"eslint-plugin-svelte": "^3.14.0",
 				"globals": "^17.3.0",
 				"playwright": "^1.58.2",
@@ -2532,6 +2533,16 @@
 				"eslint": ">=7.0.0"
 			}
 		},
+		"node_modules/eslint-plugin-simple-import-sort": {
+			"version": "13.0.0",
+			"resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-13.0.0.tgz",
+			"integrity": "sha512-McAc+/Nlvcg4byY/CABGH8kqnefWBj8s3JA2okEtz8ixbECQgU46p0HkTUKa4YS7wvgGceimlc34p1nXqbWqtA==",
+			"dev": true,
+			"license": "MIT",
+			"peerDependencies": {
+				"eslint": ">=5.0.0"
+			}
+		},
 		"node_modules/eslint-plugin-svelte": {
 			"version": "3.15.2",
 			"resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-3.15.2.tgz",
@@ -4579,24 +4590,6 @@
 				}
 			}
 		},
-		"node_modules/yaml": {
-			"version": "2.8.2",
-			"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz",
-			"integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==",
-			"dev": true,
-			"license": "ISC",
-			"optional": true,
-			"peer": true,
-			"bin": {
-				"yaml": "bin.mjs"
-			},
-			"engines": {
-				"node": ">= 14.6"
-			},
-			"funding": {
-				"url": "https://github.com/sponsors/eemeli"
-			}
-		},
 		"node_modules/yocto-queue": {
 			"version": "0.1.0",
 			"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",

+ 1 - 0
package.json

@@ -30,6 +30,7 @@
 		"@vitest/browser-playwright": "^4.1.0",
 		"eslint": "^9.39.2",
 		"eslint-config-prettier": "^10.1.8",
+		"eslint-plugin-simple-import-sort": "^13.0.0",
 		"eslint-plugin-svelte": "^3.14.0",
 		"globals": "^17.3.0",
 		"playwright": "^1.58.2",