Skip to content

Commit 56fd235

Browse files
committed
Revert "fix: computed ref #70"
This reverts commit a022768.
1 parent 755aa2e commit 56fd235

File tree

13 files changed

+710
-786
lines changed

13 files changed

+710
-786
lines changed

.eslintignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ node_modules
22
types
33
demo
44
dist
5-
swc_build
6-
gulpfile.ts
5+
swc_build

.eslintrc.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,26 @@ module.exports = {
1414
},
1515
plugins: [
1616
'@typescript-eslint',
17+
'prettier'
1718
],
1819
extends: [
1920
'eslint:recommended',
21+
'plugin:@typescript-eslint/eslint-recommended',
2022
'plugin:@typescript-eslint/recommended',
23+
'prettier/@typescript-eslint'
2124
],
2225
globals: {
2326
wx: true,
2427
App: true,
2528
Page: true,
26-
Component: true,
27-
Behavior: true,
29+
Component: true
2830
},
2931
rules: {
30-
'no-console': 0,
32+
'prettier/prettier': 'error',
3133
'@typescript-eslint/ban-ts-ignore': 'off',
3234
'@typescript-eslint/no-empty-function': 'off',
3335
'@typescript-eslint/explicit-function-return-type': 'off',
3436
'@typescript-eslint/no-explicit-any': 'off',
35-
'@typescript-eslint/no-non-null-assertion': 'off',
36-
"indent": ["error", 2, { "SwitchCase": 1 }],
37-
"comma-spacing": "error",
38-
"semi": ["error", "never"],
39-
"quotes": ["error", "single"],
40-
"object-curly-spacing": ["error", "always"],
41-
"@typescript-eslint/ban-ts-comment": "off",
37+
'@typescript-eslint/no-non-null-assertion': 'off'
4238
},
43-
}
44-
39+
}

demo/computed/behavior.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.ts

Lines changed: 55 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import gulp from "gulp";
2-
import clean from "gulp-clean";
3-
import tsc from "gulp-typescript";
4-
import path from "path";
5-
import swc from "gulp-swc";
6-
import esbuild from "gulp-esbuild";
7-
import watch from "gulp-watch";
1+
import gulp from 'gulp'
2+
import clean from 'gulp-clean'
3+
import tsc from 'gulp-typescript'
4+
import path from 'path'
5+
import swc from 'gulp-swc'
6+
import esbuild from 'gulp-esbuild'
7+
import watch from 'gulp-watch'
88

9-
import config from "./config";
9+
import config from './config'
1010

1111
const {
1212
srcPath,
@@ -17,79 +17,75 @@ const {
1717
typesPath,
1818
tsConfigPath,
1919
swcBuildPath,
20-
entry,
20+
entry
2121
} = config;
2222

23-
const genTsc = () => {
24-
return tsc.createProject(tsConfigPath);
25-
};
2623

27-
gulp.task("clean-dev-bundle", () => {
28-
return gulp.src(bundleInDemoPath, { allowEmpty: true }).pipe(clean());
29-
});
24+
const gen_tsc = () => {
25+
return tsc.createProject(tsConfigPath)
26+
}
3027

31-
gulp.task("clean-demo-dev-bundle", () => {
32-
return gulp.src(bundleInDemoPath, { allowEmpty: true }).pipe(clean());
33-
});
3428

35-
gulp.task("clean-bundle", () => {
36-
return gulp.src(bundlePath, { allowEmpty: true }).pipe(clean());
37-
});
29+
gulp.task('clean-dev-bundle', () => {
30+
return gulp.src(bundleInDemoPath, { allowEmpty: true })
31+
.pipe(clean())
32+
})
3833

39-
gulp.task("clean-dts", () => {
40-
return gulp.src(typesPath, { allowEmpty: true }).pipe(clean());
41-
});
34+
gulp.task('clean-demo-dev-bundle', () => {
35+
return gulp.src(bundleInDemoPath, { allowEmpty: true })
36+
.pipe(clean())
37+
})
4238

43-
gulp.task("gen-dts", () => {
44-
const tsc = genTsc();
45-
return tsc.src().pipe(tsc()).pipe(gulp.dest(typesPath));
46-
});
39+
gulp.task('clean-bundle', () => {
40+
return gulp.src(bundlePath, { allowEmpty: true })
41+
.pipe(clean())
42+
})
4743

48-
gulp.task("swc-ts-2-js", () => {
44+
gulp.task('clean-dts', () => {
45+
return gulp.src(typesPath, { allowEmpty: true })
46+
.pipe(clean())
47+
})
48+
49+
gulp.task('gen-dts', () => {
50+
const tsc = gen_tsc();
51+
return tsc.src().pipe(tsc())
52+
.pipe(gulp.dest(typesPath))
53+
})
54+
55+
gulp.task('swc-ts-2-js', () => {
4956
return gulp
5057
.src(path.resolve(srcPath, "*.ts"))
5158
.pipe(swc(swcOptions))
5259
.pipe(gulp.dest(swcBuildPath));
53-
});
60+
})
5461

55-
gulp.task("esbuild-bundle", () => {
62+
gulp.task('esbuild-bundle', () => {
5663
return gulp
5764
.src(path.resolve(swcBuildPath, `${entry}.js`))
5865
.pipe(esbuild(esbuildOptions))
5966
.pipe(gulp.dest(bundlePath));
60-
});
67+
})
6168

62-
gulp.task("copy-2-demo", () => {
63-
return gulp
64-
.src(path.resolve(swcBuildPath, "*.js"))
65-
.pipe(gulp.dest(bundleInDemoPath));
66-
});
67-
68-
gulp.task("watch", () => {
69-
const tsFile = path.resolve(srcPath, "*.ts");
70-
const watcher = watch(tsFile, gulp.series("dev"));
71-
watcher.on("change", function (path, stats) {
69+
gulp.task('copy-2-demo', () => {
70+
return gulp.src(path.resolve(swcBuildPath, "*.js"))
71+
.pipe(gulp.dest(bundleInDemoPath))
72+
})
73+
74+
gulp.task('watch', () => {
75+
const ts_file = path.resolve(srcPath, "*.ts");
76+
const watcher = watch(ts_file, gulp.series('dev'))
77+
watcher.on('change', function (path, stats) {
7278
console.log(`File ${path} was changed`);
7379
});
74-
});
80+
})
7581

7682
// build for develop
77-
gulp.task(
78-
"dev",
79-
gulp.series(
80-
"clean-dev-bundle",
81-
"clean-demo-dev-bundle",
82-
"swc-ts-2-js",
83-
"copy-2-demo"
84-
)
85-
);
83+
gulp.task('dev', gulp.series('clean-dev-bundle', 'clean-demo-dev-bundle', 'swc-ts-2-js', 'copy-2-demo'))
8684

8785
// build for develop & watch
88-
gulp.task("dev-watch", gulp.series("dev", "watch"));
89-
// generate .d.ts
90-
gulp.task("dts", gulp.series("clean-dts", "gen-dts"));
86+
gulp.task('dev-watch', gulp.series('dev', 'watch'))
87+
// generate .d.ts
88+
gulp.task('dts', gulp.series('clean-dts', 'gen-dts'))
9189
// build for publish
92-
gulp.task(
93-
"default",
94-
gulp.series("clean-bundle", "swc-ts-2-js", "esbuild-bundle", "dts")
95-
);
90+
gulp.task('default', gulp.series('clean-bundle', 'swc-ts-2-js', 'esbuild-bundle', 'dts'))
91+

jest.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module.exports = {
2-
preset: 'ts-jest',
2+
preset: "ts-jest",
33
bail: 1,
44
verbose: true,
5-
testEnvironment: 'jsdom',
6-
testURL: 'https://jest.test',
7-
moduleFileExtensions: ['js', 'ts'],
8-
testMatch: ['<rootDir>/test/**/*.spec.ts'],
9-
collectCoverageFrom: ['<rootDir>/src/**/*.ts', '!**/__test__/**'],
10-
snapshotSerializers: ['miniprogram-simulate/jest-snapshot-plugin'],
11-
}
5+
testEnvironment: "jsdom",
6+
testURL: "https://jest.test",
7+
moduleFileExtensions: ["js", "ts"],
8+
testMatch: ["<rootDir>/test/**/*.spec.ts"],
9+
collectCoverageFrom: ["<rootDir>/src/**/*.ts", "!**/__test__/**"],
10+
snapshotSerializers: ["miniprogram-simulate/jest-snapshot-plugin"],
11+
};

0 commit comments

Comments
 (0)