Skip to content

Commit

Permalink
fix(js): update ts version and ts declaration issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zoomchan-cxj committed Feb 9, 2022
1 parent e0bc3f5 commit 2df21c5
Show file tree
Hide file tree
Showing 98 changed files with 50,448 additions and 52,823 deletions.
34 changes: 9 additions & 25 deletions .eslintrc.js
Expand Up @@ -28,15 +28,11 @@ module.exports = {
rules: {
// Allow interface export
'no-undef': 'off',

// Disable props checking
'react/prop-types': 'off',

// Force use 2 space for indent
'@typescript-eslint/indent': ['error', 2],

// Note you must disable the base rule as it can report incorrect errors
'no-unused-vars': 'off',
// '@typescript-eslint/explicit-member-accessibility': ['error'],
},
},
],
Expand All @@ -47,11 +43,14 @@ module.exports = {
},
globals: {
__PLATFORM__: 'readonly',
__GLOBAL__: 'readonly',
Hippy: 'readonly',
WebSocket: 'readonly',
__GLOBAL__: 'writable',
Hippy: 'writable',
WebSocket: 'writable',
requestIdleCallback: 'writable',
cancelIdleCallback: 'writable',
},
rules: {
'no-restricted-globals': 'off',
semi: ['error', 'always'],
// Allow more than one component per file
'vue/one-component-per-file': 'off',
Expand Down Expand Up @@ -79,29 +78,12 @@ module.exports = {
// Disable deprecated
'react/no-deprecated': 'off',

// Turn of extensions checking temporary
'import/extensions': 'off',

// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules/namespace.md#allowcomputed
'import/namespace': [
'error',
{
allowComputed: true,
},
],
// Allow import from devDependencies
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'scripts/*.js',
// FIXME: seems not working
'packages/**/types/*.d.ts',
'packages/**/__tests__/*.test.js',
'examples/**/scripts/*.js',
],
},
],
// Allow tsx as the jsx file
'react/jsx-filename-extension': [
'error',
Expand All @@ -116,6 +98,8 @@ module.exports = {
'warn',
{
allow: [
'__PLATFORM__',
'__HIPPYCURDIR__',
'__ISHIPPY__',
'__GLOBAL__',
'__HIPPYNATIVEGLOBAL__',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/commit.yml
Expand Up @@ -14,6 +14,6 @@ jobs:
with:
node-version: 14.x
- name: Install
run: npm install commitlint-plugin-function-rules@1.4.0 @commitlint/cli@15.0.0 @commitlint/config-conventional@15.0.0 @commitlint/lint@15.0.0 @commitlint/prompt-cli@15.0.0 --save
run: npm install commitlint-plugin-function-rules@1.6.0 @commitlint/cli@16.0.0 @commitlint/config-conventional@16.0.0 @commitlint/lint@16.0.0 @commitlint/prompt-cli@16.0.0 --save
- name: commitlint
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
3 changes: 0 additions & 3 deletions ava.config.js
Expand Up @@ -15,9 +15,6 @@ export default {
files: [
'packages/**/__tests__/*.test.js',
],
sources: [
'packages/**/*.js',
],
require: [
'esm', // Use ES modules in NodeJS.
'module-alias/register', // Use _moduleDirectories defined package.json
Expand Down
2 changes: 0 additions & 2 deletions core/js/global/android/global.js
Expand Up @@ -4,9 +4,7 @@ __GLOBAL__.nodeTreeCache = {};
__GLOBAL__.nodeParamCache = {}; // Not necessary for Android, but need for clean.
__GLOBAL__.moduleCallId = 0;
__GLOBAL__.moduleCallList = {};
__GLOBAL__.DimensionsStore = {}; // TODO: Able to delete
__GLOBAL__.canRequestAnimationFrame = true;
__GLOBAL__.requestAnimationFrameId = 0;
__GLOBAL__.requestAnimationFrameQueue = {};
__GLOBAL__.const = {}; // TODO: Able to delete
__GLOBAL__.destroyInstanceList = {};
2 changes: 0 additions & 2 deletions core/js/global/ios/global.js
Expand Up @@ -8,11 +8,9 @@ __GLOBAL__.IosNodeTree = {};
__GLOBAL__.nodeParamCache = {};
__GLOBAL__.moduleCallId = 0;
__GLOBAL__.moduleCallList = {};
__GLOBAL__.DimensionsStore = {}; // TODO: Able to delete
__GLOBAL__.canRequestAnimationFrame = true;
__GLOBAL__.requestAnimationFrameId = 0;
__GLOBAL__.requestAnimationFrameQueue = {};
__GLOBAL__.const = {}; // TODO: Able to delete
__GLOBAL__.destroyInstanceList = {};
__GLOBAL__._callID = 0;
__GLOBAL__._callbackID = 0;
Expand Down
12 changes: 6 additions & 6 deletions core/src/napi/jsc/native_source_code_ios.cc

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions core/src/napi/v8/native_source_code_android.cc

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/android/integration.md
Expand Up @@ -35,7 +35,7 @@

3. Maven 集成(可选)

- 查询 [Maven Central Hippy 版本](https://search.maven.org/search?q=com.tencent.hippy),其中 `hippy-common` 为 `release` 版本,`hippy-debug` 为 `debug` 版本(不携带 `inspector`)
- 查询 [Maven Central Hippy 版本](https://search.maven.org/search?q=com.tencent.hippy),其中 `hippy-common` 为 `release` 版本(不携带 `inspector`),`hippy-debug` 为 `debug` 版本

- 配置 build.gradle

Expand Down
12 changes: 6 additions & 6 deletions docs/hippy-react/components.md
Expand Up @@ -444,12 +444,12 @@ import icon from './qb_icon_new.png';

| 参数 | 描述 | 类型 | 支持平台 |
| ------------------------ | ------------------------------------------------------------ | -------------------------------------------- | -------- |
| initialPage | 指定一个数字,用于决定初始化后默认显示的页面index,默认不指定的时候是0 | `number` | `ALL` |
| scrollEnabled | 指定ViewPager是否可以滑动,默认为true | `boolean` | `ALL` |
| onPageSelected | 指定一个函数,当page被选中时进行回调,回调参数是一个对象event,包括position值 回调参数: `position`: number -被选中即将滑到的目标page的index | `(obj: {position: number}) => void` | `ALL` |
| onPageScroll | 指定一个函数,当page被滑动时进行回调,回调参数是一个对象event,包括position值与offset值 回调参数 `position`: number -即将滑到的目标page的index `offset`: number -当前被选中的page的相对位移,取值范围-1到1 | `(obj: {position: number, offset: number}) => void` | `ALL` |
| onPageScrollStateChanged | 指定一个函数,当page的滑动状态改变时进行回调 回调参数: `pageScrollState`: string -改变后的状态,idle表示停止,dragging表示用户用手拖拽,settling表示page正在滑动 | `(pageScrollState: string) => void` | `ALL` |
| direction | 设置viewPager滚动方向,不设置默认横向滚动,设置 `vertical` 为竖向滚动 | `string` | `Android` |
| initialPage | 指定一个数字,用于决定初始化后默认显示的页面 index,默认不指定的时候是0 | `number` | `ALL` |
| scrollEnabled | 指定 ViewPager 是否可以滑动,默认为 `true` | `boolean` | `ALL` |
| onPageSelected | 指定一个函数,当 page 被选中时进行回调。回调参数是一个 event 对象,回调参数: `position: number` - 表示即将滑到的目标 page 的索引 | `(obj: {position: number}) => void` | `ALL` |
| onPageScroll | 指定一个函数,当 page 被滑动时进行回调。回调参数是一个 event 对象,回调参数 `position: number` - 表示即将滑到的目标 page 的索引,`offset: number` - 当前被选中的 page 的相对位移,取值范围 -1 到 1 | `(obj: {position: number, offset: number}) => void` | `ALL` |
| onPageScrollStateChanged | 指定一个函数,当 page 的滑动状态改变时进行回调。回调参数: `pageScrollState: string` - 改变后的状态,`idle` 表示停止,`dragging` 表示用户用手拖拽,`settling` 表示 page 正在滑动 | `(pageScrollState: string) => void` | `ALL` |
| direction | 设置 viewPager 滚动方向,不设置默认横向滚动,设置 `vertical` 为竖向滚动 | `string` | `Android` |

## 方法

Expand Down
2 changes: 1 addition & 1 deletion examples/android-demo/res/index.android.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions examples/android-demo/res/vendor.android.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/hippy-react-demo/src/externals/Slider/Slider.jsx
Expand Up @@ -133,7 +133,7 @@ export default class Slider extends React.Component {
}

doSwitchPage(index) {
this.scrollview.scrollTo(this.imgWidth * index, 0, true);
this.scrollview.scrollTo({ x: this.imgWidth * index, y: 0, animated: true });
}

doCreateTimer() {
Expand Down
2 changes: 1 addition & 1 deletion examples/ios-demo/res/index.ios.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions examples/ios-demo/res/vendor.ios.js

Large diffs are not rendered by default.

0 comments on commit 2df21c5

Please sign in to comment.