@xunlei-open/create-miniapp 0.1.1-beta.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.
Files changed (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +106 -0
  3. package/dist/index.mjs +416 -0
  4. package/dist/index.mjs.map +1 -0
  5. package/package.json +59 -0
  6. package/templates/react/.prettierignore +3 -0
  7. package/templates/react/.prettierrc.ejs +7 -0
  8. package/templates/react/_gitignore +24 -0
  9. package/templates/react/biome.json +41 -0
  10. package/templates/react/eslint.config.js.ejs +43 -0
  11. package/templates/react/index.html.ejs +12 -0
  12. package/templates/react/jsconfig.json +9 -0
  13. package/templates/react/manifest.json +16 -0
  14. package/templates/react/miniapp.config.js.ejs +16 -0
  15. package/templates/react/package.json.ejs +42 -0
  16. package/templates/react/src/App.jsx.ejs +53 -0
  17. package/templates/react/src/index.css +105 -0
  18. package/templates/react/src/main.jsx +10 -0
  19. package/templates/react/tests/App.spec.jsx.ejs +12 -0
  20. package/templates/react/vitest.config.js +11 -0
  21. package/templates/react-ts/.prettierignore +3 -0
  22. package/templates/react-ts/.prettierrc.ejs +7 -0
  23. package/templates/react-ts/_gitignore +25 -0
  24. package/templates/react-ts/biome.json +41 -0
  25. package/templates/react-ts/eslint.config.js.ejs +33 -0
  26. package/templates/react-ts/index.html.ejs +12 -0
  27. package/templates/react-ts/manifest.json +16 -0
  28. package/templates/react-ts/miniapp.config.ts.ejs +16 -0
  29. package/templates/react-ts/package.json.ejs +48 -0
  30. package/templates/react-ts/src/App.tsx.ejs +53 -0
  31. package/templates/react-ts/src/index.css +105 -0
  32. package/templates/react-ts/src/main.tsx +10 -0
  33. package/templates/react-ts/src/vite-env.d.ts +2 -0
  34. package/templates/react-ts/tests/App.spec.tsx.ejs +12 -0
  35. package/templates/react-ts/tsconfig.app.json +28 -0
  36. package/templates/react-ts/tsconfig.json +7 -0
  37. package/templates/react-ts/tsconfig.node.json +24 -0
  38. package/templates/react-ts/vitest.config.js +11 -0
  39. package/templates/vanilla/.prettierignore +3 -0
  40. package/templates/vanilla/.prettierrc.ejs +7 -0
  41. package/templates/vanilla/_gitignore +23 -0
  42. package/templates/vanilla/biome.json +40 -0
  43. package/templates/vanilla/eslint.config.js.ejs +25 -0
  44. package/templates/vanilla/index.html.ejs +12 -0
  45. package/templates/vanilla/jsconfig.json +8 -0
  46. package/templates/vanilla/manifest.json +16 -0
  47. package/templates/vanilla/miniapp.config.js.ejs +15 -0
  48. package/templates/vanilla/package.json.ejs +33 -0
  49. package/templates/vanilla/src/main.js.ejs +54 -0
  50. package/templates/vanilla/src/style.css +101 -0
  51. package/templates/vanilla/tests/example.spec.js +7 -0
  52. package/templates/vanilla-ts/.prettierignore +3 -0
  53. package/templates/vanilla-ts/.prettierrc.ejs +7 -0
  54. package/templates/vanilla-ts/_gitignore +23 -0
  55. package/templates/vanilla-ts/biome.json +40 -0
  56. package/templates/vanilla-ts/eslint.config.js.ejs +36 -0
  57. package/templates/vanilla-ts/index.html.ejs +12 -0
  58. package/templates/vanilla-ts/manifest.json +16 -0
  59. package/templates/vanilla-ts/miniapp.config.ts.ejs +15 -0
  60. package/templates/vanilla-ts/package.json.ejs +38 -0
  61. package/templates/vanilla-ts/src/main.ts.ejs +54 -0
  62. package/templates/vanilla-ts/src/style.css +101 -0
  63. package/templates/vanilla-ts/src/vite-env.d.ts +2 -0
  64. package/templates/vanilla-ts/tests/example.spec.ts +7 -0
  65. package/templates/vanilla-ts/tsconfig.json +26 -0
  66. package/templates/vue/.prettierignore +3 -0
  67. package/templates/vue/.prettierrc.ejs +7 -0
  68. package/templates/vue/_gitignore +25 -0
  69. package/templates/vue/biome.json +46 -0
  70. package/templates/vue/eslint.config.js.ejs +26 -0
  71. package/templates/vue/index.html.ejs +12 -0
  72. package/templates/vue/jsconfig.json +8 -0
  73. package/templates/vue/manifest.json +16 -0
  74. package/templates/vue/miniapp.config.js.ejs +16 -0
  75. package/templates/vue/package.json.ejs +39 -0
  76. package/templates/vue/src/App.vue.ejs +51 -0
  77. package/templates/vue/src/assets/main.css +105 -0
  78. package/templates/vue/src/main.js +5 -0
  79. package/templates/vue/tests/App.spec.js.ejs +12 -0
  80. package/templates/vue/vitest.config.js +11 -0
  81. package/templates/vue-ts/.prettierignore +3 -0
  82. package/templates/vue-ts/.prettierrc.ejs +7 -0
  83. package/templates/vue-ts/_gitignore +25 -0
  84. package/templates/vue-ts/biome.json +46 -0
  85. package/templates/vue-ts/eslint.config.js.ejs +32 -0
  86. package/templates/vue-ts/index.html.ejs +12 -0
  87. package/templates/vue-ts/manifest.json +16 -0
  88. package/templates/vue-ts/miniapp.config.ts.ejs +16 -0
  89. package/templates/vue-ts/package.json.ejs +46 -0
  90. package/templates/vue-ts/src/App.vue.ejs +51 -0
  91. package/templates/vue-ts/src/assets/main.css +105 -0
  92. package/templates/vue-ts/src/main.ts +5 -0
  93. package/templates/vue-ts/src/vite-env.d.ts +2 -0
  94. package/templates/vue-ts/tests/App.spec.ts.ejs +12 -0
  95. package/templates/vue-ts/tsconfig.app.json +17 -0
  96. package/templates/vue-ts/tsconfig.json +7 -0
  97. package/templates/vue-ts/tsconfig.node.json +24 -0
  98. package/templates/vue-ts/vitest.config.js +11 -0
@@ -0,0 +1,105 @@
1
+ :root {
2
+ font-family: Inter, ui-sans-serif, system-ui, sans-serif;
3
+ color: #172033;
4
+ background: #eef3ff;
5
+ font-synthesis: none;
6
+ }
7
+
8
+ * {
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ body {
13
+ min-width: 320px;
14
+ min-height: 100vh;
15
+ margin: 0;
16
+ }
17
+
18
+ .app {
19
+ min-height: 100vh;
20
+ display: grid;
21
+ place-items: center;
22
+ }
23
+
24
+ main {
25
+ width: min(680px, calc(100vw - 48px));
26
+ padding: 40px;
27
+ border: 1px solid #d5def2;
28
+ border-radius: 20px;
29
+ background: #fff;
30
+ box-shadow: 0 20px 60px rgb(36 65 120 / 12%);
31
+ }
32
+
33
+ .eyebrow {
34
+ margin: 0;
35
+ color: #176bff;
36
+ font-size: 12px;
37
+ font-weight: 700;
38
+ letter-spacing: 0.12em;
39
+ text-transform: uppercase;
40
+ }
41
+
42
+ h1 {
43
+ margin: 8px 0;
44
+ }
45
+
46
+ .intro {
47
+ margin: 0 0 28px;
48
+ color: #596780;
49
+ }
50
+
51
+ label {
52
+ display: block;
53
+ margin-bottom: 8px;
54
+ font-size: 14px;
55
+ font-weight: 600;
56
+ }
57
+
58
+ .row {
59
+ display: flex;
60
+ gap: 10px;
61
+ }
62
+
63
+ input,
64
+ button {
65
+ min-height: 44px;
66
+ border-radius: 10px;
67
+ font: inherit;
68
+ }
69
+
70
+ input {
71
+ flex: 1;
72
+ min-width: 0;
73
+ padding: 0 12px;
74
+ border: 1px solid #b9c6df;
75
+ }
76
+
77
+ button {
78
+ padding: 0 18px;
79
+ border: 0;
80
+ color: #fff;
81
+ background: #176bff;
82
+ cursor: pointer;
83
+ }
84
+
85
+ button:disabled {
86
+ cursor: wait;
87
+ opacity: 0.65;
88
+ }
89
+
90
+ output {
91
+ display: block;
92
+ margin-top: 18px;
93
+ color: #596780;
94
+ font-size: 14px;
95
+ }
96
+
97
+ @media (max-width: 560px) {
98
+ main {
99
+ padding: 28px;
100
+ }
101
+
102
+ .row {
103
+ flex-direction: column;
104
+ }
105
+ }
@@ -0,0 +1,10 @@
1
+ import { StrictMode } from 'react'
2
+ import { createRoot } from 'react-dom/client'
3
+ import App from './App.tsx'
4
+ import './index.css'
5
+
6
+ createRoot(document.getElementById('root')!).render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>,
10
+ )
@@ -0,0 +1,2 @@
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="@xunlei-open/miniapp-types" />
@@ -0,0 +1,12 @@
1
+ // @vitest-environment jsdom
2
+
3
+ import { render } from '@testing-library/react'
4
+ import { describe, expect, it } from 'vitest'
5
+ import App from '../src/App'
6
+
7
+ describe('App', () => {
8
+ it('renders project title', () => {
9
+ const { container } = render(<App />)
10
+ expect(container.textContent).toContain('<%= projectName %>')
11
+ })
12
+ })
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
+ "target": "es2023",
5
+ "lib": ["ES2023", "DOM"],
6
+ "module": "esnext",
7
+ "types": ["vite/client"],
8
+ "paths": {
9
+ "@/*": ["./src/*"]
10
+ },
11
+ "skipLibCheck": true,
12
+
13
+ /* Bundler mode */
14
+ "moduleResolution": "bundler",
15
+ "allowImportingTsExtensions": true,
16
+ "verbatimModuleSyntax": true,
17
+ "moduleDetection": "force",
18
+ "noEmit": true,
19
+ "jsx": "react-jsx",
20
+
21
+ /* Linting */
22
+ "noUnusedLocals": true,
23
+ "noUnusedParameters": true,
24
+ "erasableSyntaxOnly": true,
25
+ "noFallthroughCasesInSwitch": true
26
+ },
27
+ "include": ["src", "tests"]
28
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ]
7
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "es2023",
5
+ "lib": ["ES2023"],
6
+ "module": "esnext",
7
+ "types": ["node"],
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+
17
+ /* Linting */
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": true,
20
+ "erasableSyntaxOnly": true,
21
+ "noFallthroughCasesInSwitch": true
22
+ },
23
+ "include": ["miniapp.config.ts"]
24
+ }
@@ -0,0 +1,11 @@
1
+ import { fileURLToPath } from 'node:url'
2
+ import { defineConfig } from 'vitest/config'
3
+ import { loadMiniappConfig } from '@xunlei-open/miniapp'
4
+
5
+ export default defineConfig(async () => {
6
+ const config = await loadMiniappConfig(fileURLToPath(new URL('.', import.meta.url)), {
7
+ command: 'serve',
8
+ mode: 'test',
9
+ })
10
+ return config.vite
11
+ })
@@ -0,0 +1,3 @@
1
+ dist
2
+ node_modules
3
+ pnpm-lock.yaml
@@ -0,0 +1,7 @@
1
+ {
2
+ "semi": false,
3
+ "singleQuote": true,
4
+ "trailingComma": "all",
5
+ "printWidth": 120,
6
+ "endOfLine": "auto"
7
+ }
@@ -0,0 +1,23 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ release
14
+ *.local
15
+
16
+ # Editor directories and files
17
+ .idea
18
+ .DS_Store
19
+ *.suo
20
+ *.ntvs*
21
+ *.njsproj
22
+ *.sln
23
+ *.sw?
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
3
+ "vcs": {
4
+ "enabled": false
5
+ },
6
+ "files": {
7
+ "ignoreUnknown": false
8
+ },
9
+ "formatter": {
10
+ "enabled": true,
11
+ "indentStyle": "tab",
12
+ "indentWidth": 2,
13
+ "lineWidth": 120,
14
+ "lineEnding": "auto"
15
+ },
16
+ "linter": {
17
+ "enabled": true,
18
+ "rules": {
19
+ "recommended": true,
20
+ "correctness": {
21
+ "noUndeclaredVariables": "error"
22
+ }
23
+ }
24
+ },
25
+ "javascript": {
26
+ "formatter": {
27
+ "semicolons": "asNeeded",
28
+ "quoteStyle": "single",
29
+ "trailingCommas": "all"
30
+ }
31
+ },
32
+ "assist": {
33
+ "enabled": true,
34
+ "actions": {
35
+ "source": {
36
+ "organizeImports": "on"
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,25 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import eslintConfigPrettier from 'eslint-config-prettier'
4
+ import eslintPluginPrettier from 'eslint-plugin-prettier'
5
+
6
+ export default [
7
+ { ignores: ['dist', 'node_modules'] },
8
+ js.configs.recommended,
9
+ eslintConfigPrettier,
10
+ {
11
+ files: ['**/*.{js,mjs,cjs}'],
12
+ plugins: { prettier: eslintPluginPrettier },
13
+ rules: { 'prettier/prettier': 'error' },
14
+ languageOptions: {
15
+ ecmaVersion: 'latest',
16
+ sourceType: 'module',
17
+ globals: {
18
+ ...globals.browser,
19
+ ...globals.node,
20
+ xunlei: 'readonly',
21
+ MessageError: 'readonly',
22
+ },
23
+ },
24
+ },
25
+ ]
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title><%= projectName %></title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.js"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,8 @@
1
+ {
2
+ "compilerOptions": {
3
+ "paths": {
4
+ "@/*": ["./src/*"]
5
+ }
6
+ },
7
+ "exclude": ["node_modules", "dist"]
8
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "manifest_version": 1,
3
+ "name": "示例插件",
4
+ "title": "示例插件",
5
+ "description": "一个迅雷微应用示例",
6
+ "version": "1.0.0",
7
+ "entry": {
8
+ "type": "miniapp",
9
+ "url": "index.html"
10
+ },
11
+ "window": {
12
+ "width": 900,
13
+ "height": 700
14
+ },
15
+ "permissions": ["tasks.create"]
16
+ }
@@ -0,0 +1,15 @@
1
+ import { fileURLToPath, URL } from 'node:url'
2
+ import { defineConfig } from '@xunlei-open/miniapp'
3
+
4
+ export default defineConfig({
5
+ vite: {
6
+ resolve: {
7
+ alias: {
8
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
9
+ },
10
+ },
11
+ build: {
12
+ target: 'es2015',
13
+ },
14
+ },
15
+ })
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "<%= packageName %>",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "engines": {
6
+ "node": ">=20.19.0"
7
+ },
8
+ "type": "module",
9
+ "scripts": {
10
+ "dev": "xunlei-miniapp",
11
+ "build": "xunlei-miniapp build",
12
+ "package": "xunlei-miniapp package"<% if (features.includes('vitest')) { %>,
13
+ "test": "vitest run",
14
+ "test:watch": "vitest"<% } %><% if (features.includes('lint')) { %>,
15
+ "lint": "eslint .",
16
+ "format": "prettier --write ."<% } %><% if (features.includes('biome')) { %>,
17
+ "lint": "biome check .",
18
+ "format": "biome format --write ."<% } %>
19
+ },
20
+ "devDependencies": {
21
+ "@xunlei-open/miniapp": "^<%= devkitVersion %>",
22
+ "vite": "^8.0.12"<% if (features.includes('vitest')) { %>,
23
+ "jsdom": "^29.0.0",
24
+ "vitest": "^4.1.0"<% } %><% if (features.includes('lint')) { %>,
25
+ "@eslint/js": "^9.22.0",
26
+ "eslint": "^9.22.0",
27
+ "eslint-config-prettier": "^10.1.1",
28
+ "eslint-plugin-prettier": "^5.4.0",
29
+ "globals": "^16.0.0",
30
+ "prettier": "^3.5.3"<% } %><% if (features.includes('biome')) { %>,
31
+ "@biomejs/biome": "2.4.16"<% } %>
32
+ }
33
+ }
@@ -0,0 +1,54 @@
1
+ import './style.css'
2
+
3
+ document.querySelector('#app').innerHTML = `
4
+ <main>
5
+ <p class="eyebrow">Xunlei Miniapp</p>
6
+ <h1><%= projectName %></h1>
7
+ <p class="intro">输入下载地址,通过迅雷微应用 API 创建下载任务。</p>
8
+
9
+ <form id="task-form">
10
+ <label for="task-url">下载地址</label>
11
+ <div class="row">
12
+ <input id="task-url" type="url" value="https://example.com/file.zip" required />
13
+ <button type="submit">创建任务</button>
14
+ </div>
15
+ </form>
16
+
17
+ <output id="result">等待创建任务</output>
18
+ </main>
19
+ `
20
+
21
+ const form = requireElement('#task-form')
22
+ const input = requireElement('#task-url')
23
+ const result = requireElement('#result')
24
+ const button = requireElement('button[type="submit"]')
25
+
26
+ form.addEventListener('submit', async (event) => {
27
+ event.preventDefault()
28
+
29
+ if (typeof xunlei === 'undefined') {
30
+ result.textContent = '当前是普通浏览器预览,请在迅雷微应用宿主中创建任务。'
31
+ return
32
+ }
33
+
34
+ button.disabled = true
35
+ result.textContent = '正在创建任务…'
36
+
37
+ try {
38
+ const task = await xunlei.tasks.create({
39
+ req: { url: input.value },
40
+ opts: { name: '<%= projectName %>' },
41
+ })
42
+ result.textContent = `任务已创建:${task.id}`
43
+ } catch (error) {
44
+ result.textContent = error instanceof Error ? error.message : String(error)
45
+ } finally {
46
+ button.disabled = false
47
+ }
48
+ })
49
+
50
+ function requireElement(selector) {
51
+ const element = document.querySelector(selector)
52
+ if (!element) throw new Error(`Missing element: ${selector}`)
53
+ return element
54
+ }
@@ -0,0 +1,101 @@
1
+ :root {
2
+ font-family: Inter, ui-sans-serif, system-ui, sans-serif;
3
+ color: #172033;
4
+ background: #eef3ff;
5
+ font-synthesis: none;
6
+ }
7
+
8
+ * {
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ body {
13
+ min-width: 320px;
14
+ min-height: 100vh;
15
+ margin: 0;
16
+ display: grid;
17
+ place-items: center;
18
+ }
19
+
20
+ main {
21
+ width: min(680px, calc(100vw - 48px));
22
+ padding: 40px;
23
+ border: 1px solid #d5def2;
24
+ border-radius: 20px;
25
+ background: #fff;
26
+ box-shadow: 0 20px 60px rgb(36 65 120 / 12%);
27
+ }
28
+
29
+ .eyebrow {
30
+ margin: 0;
31
+ color: #176bff;
32
+ font-size: 12px;
33
+ font-weight: 700;
34
+ letter-spacing: 0.12em;
35
+ text-transform: uppercase;
36
+ }
37
+
38
+ h1 {
39
+ margin: 8px 0;
40
+ }
41
+
42
+ .intro {
43
+ margin: 0 0 28px;
44
+ color: #596780;
45
+ }
46
+
47
+ label {
48
+ display: block;
49
+ margin-bottom: 8px;
50
+ font-size: 14px;
51
+ font-weight: 600;
52
+ }
53
+
54
+ .row {
55
+ display: flex;
56
+ gap: 10px;
57
+ }
58
+
59
+ input,
60
+ button {
61
+ min-height: 44px;
62
+ border-radius: 10px;
63
+ font: inherit;
64
+ }
65
+
66
+ input {
67
+ flex: 1;
68
+ min-width: 0;
69
+ padding: 0 12px;
70
+ border: 1px solid #b9c6df;
71
+ }
72
+
73
+ button {
74
+ padding: 0 18px;
75
+ border: 0;
76
+ color: #fff;
77
+ background: #176bff;
78
+ cursor: pointer;
79
+ }
80
+
81
+ button:disabled {
82
+ cursor: wait;
83
+ opacity: 0.65;
84
+ }
85
+
86
+ output {
87
+ display: block;
88
+ margin-top: 18px;
89
+ color: #596780;
90
+ font-size: 14px;
91
+ }
92
+
93
+ @media (max-width: 560px) {
94
+ main {
95
+ padding: 28px;
96
+ }
97
+
98
+ .row {
99
+ flex-direction: column;
100
+ }
101
+ }
@@ -0,0 +1,7 @@
1
+ import { describe, expect, it } from 'vitest'
2
+
3
+ describe('example', () => {
4
+ it('adds numbers', () => {
5
+ expect(1 + 1).toBe(2)
6
+ })
7
+ })
@@ -0,0 +1,3 @@
1
+ dist
2
+ node_modules
3
+ pnpm-lock.yaml
@@ -0,0 +1,7 @@
1
+ {
2
+ "semi": false,
3
+ "singleQuote": true,
4
+ "trailingComma": "all",
5
+ "printWidth": 120,
6
+ "endOfLine": "auto"
7
+ }
@@ -0,0 +1,23 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ release
14
+ *.local
15
+
16
+ # Editor directories and files
17
+ .idea
18
+ .DS_Store
19
+ *.suo
20
+ *.ntvs*
21
+ *.njsproj
22
+ *.sln
23
+ *.sw?
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
3
+ "vcs": {
4
+ "enabled": false
5
+ },
6
+ "files": {
7
+ "ignoreUnknown": false
8
+ },
9
+ "formatter": {
10
+ "enabled": true,
11
+ "indentStyle": "tab",
12
+ "indentWidth": 2,
13
+ "lineWidth": 120,
14
+ "lineEnding": "auto"
15
+ },
16
+ "linter": {
17
+ "enabled": true,
18
+ "rules": {
19
+ "recommended": true,
20
+ "correctness": {
21
+ "noUndeclaredVariables": "error"
22
+ }
23
+ }
24
+ },
25
+ "javascript": {
26
+ "formatter": {
27
+ "semicolons": "asNeeded",
28
+ "quoteStyle": "single",
29
+ "trailingCommas": "all"
30
+ }
31
+ },
32
+ "assist": {
33
+ "enabled": true,
34
+ "actions": {
35
+ "source": {
36
+ "organizeImports": "on"
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,36 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import tseslint from 'typescript-eslint'
4
+ import eslintConfigPrettier from 'eslint-config-prettier'
5
+ import eslintPluginPrettier from 'eslint-plugin-prettier'
6
+
7
+ export default tseslint.config(
8
+ { ignores: ['dist', 'node_modules'] },
9
+ js.configs.recommended,
10
+ ...tseslint.configs.recommended,
11
+ eslintConfigPrettier,
12
+ {
13
+ files: ['**/*.ts'],
14
+ plugins: { prettier: eslintPluginPrettier },
15
+ rules: {
16
+ 'prettier/prettier': 'error',
17
+ '@typescript-eslint/no-unused-vars': 'off',
18
+ 'no-fallthrough': 'off',
19
+ },
20
+ languageOptions: {
21
+ ecmaVersion: 'latest',
22
+ sourceType: 'module',
23
+ globals: globals.browser,
24
+ },
25
+ },
26
+ {
27
+ files: ['**/*.{js,mjs,cjs}'],
28
+ plugins: { prettier: eslintPluginPrettier },
29
+ rules: { 'prettier/prettier': 'error' },
30
+ languageOptions: {
31
+ ecmaVersion: 'latest',
32
+ sourceType: 'module',
33
+ globals: globals.node,
34
+ },
35
+ },
36
+ )