Skip to content

Commit bcbcf09

Browse files
committed
feat: initial coding
0 parents  commit bcbcf09

23 files changed

+7494
-0
lines changed

.eslintrc.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
const path = require('path')
2+
3+
module.exports = {
4+
root: true,
5+
parserOptions: {
6+
ecmaVersion: 9,
7+
sourceType: 'module',
8+
},
9+
parser: '@typescript-eslint/parser',
10+
plugins: ['@typescript-eslint', 'import', 'promise', 'prettier'],
11+
overrides: [
12+
{
13+
files: ['*.ts'],
14+
extends: [
15+
'plugin:@typescript-eslint/recommended',
16+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
17+
'eslint-config-prettier',
18+
],
19+
parserOptions: {
20+
project: path.join(__dirname, 'tsconfig.json'),
21+
},
22+
rules: {
23+
'@typescript-eslint/no-explicit-any': 'off',
24+
'@typescript-eslint/explicit-module-boundary-types': 'off',
25+
'@typescript-eslint/no-non-null-assertion': 'off',
26+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
27+
'@typescript-eslint/space-before-function-paren': [
28+
'error',
29+
{ anonymous: 'always', named: 'never', asyncArrow: 'always' },
30+
],
31+
'@typescript-eslint/no-redeclare': ['error'],
32+
'@typescript-eslint/no-unsafe-argument': 'off',
33+
'@typescript-eslint/no-this-alias': 'off',
34+
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
35+
},
36+
},
37+
],
38+
extends: [
39+
'eslint:recommended',
40+
'airbnb-base',
41+
'plugin:promise/recommended',
42+
'eslint-config-prettier',
43+
],
44+
env: {
45+
es6: true,
46+
jest: true,
47+
},
48+
rules: {
49+
'comma-dangle': ['error', 'always-multiline'],
50+
'handle-callback-err': ['error', '^(err|error)$'],
51+
'no-catch-shadow': 'error',
52+
'no-underscore-dangle': 'off',
53+
'object-curly-spacing': ['error', 'always'],
54+
'max-classes-per-file': 'off',
55+
'no-unused-vars': 'off',
56+
'no-multi-assign': 'off',
57+
'lines-between-class-members': 'off',
58+
'import/prefer-default-export': 'off',
59+
'import/no-unresolved': 'off',
60+
'import/extensions': 'off',
61+
'no-shadow': 'off',
62+
'prefer-destructuring': 'off',
63+
'no-continue': 'off',
64+
'no-use-before-define': 'off',
65+
'no-dupe-class-members': 'off',
66+
'func-names': 'off',
67+
'space-before-function-paren': 'off',
68+
'no-lonely-if': 'off',
69+
'no-param-reassign': ['error', { props: false }],
70+
'no-redeclare': 'off',
71+
'no-restricted-syntax': 'off',
72+
'no-await-in-loop': 'off',
73+
'prettier/prettier': 'warn',
74+
'import/no-extraneous-dependencies': 'off',
75+
'@typescript-eslint/consistent-type-imports': [
76+
'warn',
77+
{
78+
prefer: 'type-imports',
79+
fixStyle: 'inline-type-imports',
80+
},
81+
],
82+
},
83+
}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
/out
5+
/.vscode-test
6+
/*.vsix

.prettierrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
printWidth: 100,
3+
tabWidth: 2,
4+
useTabs: false,
5+
semi: false,
6+
singleQuote: true,
7+
quoteProps: 'as-needed',
8+
trailingComma: 'all',
9+
bracketSpacing: true,
10+
arrowParens: 'always',
11+
requirePragma: false,
12+
insertPragma: false,
13+
proseWrap: 'preserve',
14+
endOfLine: 'lf',
15+
embeddedLanguageFormatting: 'auto',
16+
}

.vscode-test.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import path from 'path'
2+
import { fileURLToPath } from 'url'
3+
import { defineConfig } from '@vscode/test-cli'
4+
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = path.dirname(__filename)
7+
8+
export default defineConfig({
9+
files: 'out/test/**/*.test.js',
10+
extensionDevelopmentPath: __dirname,
11+
workspaceFolder: `${__dirname}/test-fixture`,
12+
mocha: {
13+
timeout: 20000,
14+
},
15+
})

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher", "ms-vscode.extension-test-runner"]
5+
}

.vscode/launch.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}",
14+
"${workspaceFolder}/test-fixture"
15+
],
16+
"outFiles": [
17+
"${workspaceFolder}/dist/**/*.js"
18+
],
19+
"preLaunchTask": "tasks: watch"
20+
},
21+
{
22+
"name": "Run Extension Tests",
23+
"type": "extensionHost",
24+
"request": "launch",
25+
"testConfiguration": "${workspaceFolder}/.vscode-test.mjs",
26+
"args": [
27+
"--extensionDevelopmentPath=${workspaceFolder}/vscode-extension",
28+
"${workspaceFolder}/test-fixture"
29+
],
30+
"outFiles": [
31+
"${workspaceFolder}/dist/**/*.js"
32+
],
33+
"preLaunchTask": "tasks: watch-tests"
34+
}
35+
]
36+
}

.vscode/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6+
},
7+
"search.exclude": {
8+
"out": true, // set this to false to include "out" folder in search results
9+
"dist": true // set this to false to include "dist" folder in search results
10+
},
11+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12+
"typescript.tsc.autoDetect": "off"
13+
}

.vscode/tasks.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "shell",
8+
"label": "cp-wasm",
9+
"command": "cp node_modules/float-pigment-css/float_pigment_css_bg.wasm dist/",
10+
"problemMatcher": "$ts-webpack-watch",
11+
"isBackground": true,
12+
"presentation": {
13+
"reveal": "never",
14+
"group": "watchers"
15+
},
16+
"group": {
17+
"kind": "build"
18+
},
19+
"options": {
20+
"cwd": "${workspaceFolder}"
21+
}
22+
},
23+
{
24+
"type": "npm",
25+
"script": "watch",
26+
"problemMatcher": "$ts-webpack-watch",
27+
"isBackground": true,
28+
"presentation": {
29+
"reveal": "never",
30+
"group": "watchers"
31+
},
32+
"group": {
33+
"kind": "build",
34+
"isDefault": true
35+
},
36+
"options": {
37+
"cwd": "${workspaceFolder}"
38+
}
39+
},
40+
{
41+
"type": "npm",
42+
"script": "watch-tests",
43+
"problemMatcher": "$tsc-watch",
44+
"isBackground": true,
45+
"presentation": {
46+
"reveal": "never",
47+
"group": "watchers"
48+
},
49+
"group": "build",
50+
"options": {
51+
"cwd": "${workspaceFolder}"
52+
}
53+
},
54+
{
55+
"label": "tasks: watch-tests",
56+
"dependsOn": [
57+
"npm: watch",
58+
"cp-wasm",
59+
"npm: watch-tests"
60+
],
61+
"problemMatcher": []
62+
},
63+
{
64+
"label": "tasks: watch",
65+
"dependsOn": [
66+
"npm: watch",
67+
"cp-wasm"
68+
],
69+
"problemMatcher": []
70+
}
71+
]
72+
}

.vscodeignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.vscode/**
2+
.vscode-test/**
3+
.vscode-test.mjs
4+
out/**
5+
node_modules/**
6+
src/**
7+
test-fixture/**
8+
test-snapshot/**
9+
.gitignore
10+
.yarnrc
11+
webpack.config.js
12+
**/tsconfig.json
13+
**/eslint.config.mjs
14+
**/.eslintrc.js
15+
**/*.map
16+
**/*.ts
17+
**/.vscode-test.*
18+
build/**

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2024 wechat-miniprogram
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)