Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
qican777 authored Apr 16, 2024
2 parents 59ae151 + 03546bc commit 542e357
Show file tree
Hide file tree
Showing 159 changed files with 735 additions and 615 deletions.
8 changes: 5 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ module.exports = {
'import',
'jest',
'react',
'simple-import-sort',
'prettier'
'simple-import-sort'
],
extends: [
'eslint:recommended',
'standard',
'plugin:@typescript-eslint/recommended',
'plugin:react/jsx-runtime',
'plugin:react/recommended',
'prettier'
],
rules: {
'@typescript-eslint/ban-ts-comment': 0,
Expand All @@ -31,6 +29,10 @@ module.exports = {
'@typescript-eslint/no-use-before-define': [1, { functions: false, classes: false }],
'@typescript-eslint/no-var-requires': 0,
camelcase: 0,
'eol-last': 0,
'comma-dangle': 0,
'no-mixed-operators': 1,
'no-multiple-empty-lines': 0,
'import/first': 2,
'import/newline-after-import': 2,
'import/no-duplicates': 2,
Expand Down
12 changes: 0 additions & 12 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
}
],
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/mini-program-example/src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default defineAppConfig({
'pages/api/alipay/index',
'pages/api/analysis/index',
'pages/api/basics/basics/index',
'pages/api/basics/debug/index',
'pages/api/basics/nativeDebug/index',
'pages/api/basics/encryption/index',
'pages/api/basics/miniProgram/index',
'pages/api/basics/performance/index',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
navigationBarTitleText: '基础-调试',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "@/styles/variables.scss";

.test-style {
color: #f5f5f5;
background-color: $color-success;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import React from 'react'
import Taro from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import ButtonList from '@/components/buttonList'
import './index.scss'
import { TestConsole } from '@/util/util'

/**
* 基础-调试
* @returns
*/
let realtimeLogManager
let logManager
export default class Index extends React.Component {
state = {
list: [
{
id: 'setEnableDebug',
func: () => {
TestConsole.consoleTest('setEnableDebug')
Taro.setEnableDebug({
enableDebug: true,
success(res) {
TestConsole.consoleSuccess(res)
},
fail(res) {
TestConsole.consoleFail(res)
},
complete(res) {
TestConsole.consoleComplete(res)
},
}).then((res) => {
TestConsole.consoleResult(res)
})
},
},
{
id: 'getRealtimeLogManager',
func: () => {
realtimeLogManager = Taro.getRealtimeLogManager()
TestConsole.consoleNormal('setEnableDebug', realtimeLogManager)
},
},
{
id: 'RealtimeLogManager-addFilterMsg',
func: () => {
TestConsole.consoleNormal('RealtimeLogManager-addFilterMsg')
realtimeLogManager.addFilterMsg('test')
},
},
{
id: 'RealtimeLogManager-in',
func: () => {
TestConsole.consoleNormal('RealtimeLogManager-in')
realtimeLogManager.in(Taro.getCurrentPages())
},
},
{
id: 'RealtimeLogManager-error',
func: () => {
TestConsole.consoleNormal('RealtimeLogManager-error')
realtimeLogManager.error('test', ['test'])
},
},
{
id: 'RealtimeLogManager-info',
func: () => {
TestConsole.consoleNormal('RealtimeLogManager-info')
realtimeLogManager.info(['test'])
},
},
{
id: 'RealtimeLogManager-setFilterMsg',
func: () => {
TestConsole.consoleNormal('RealtimeLogManager-setFilterMsg')
realtimeLogManager.setFilterMsg('test')
},
},
{
id: 'RealtimeLogManager-warn',
func: () => {
TestConsole.consoleNormal('RealtimeLogManager-warn')
realtimeLogManager.warn('test', ['test'])
},
},
{
id: 'RealtimeLogManager-tag',
func: () => {
let realtimeTagLogManage = realtimeLogManager.tag('test')
TestConsole.consoleNormal('RealtimeLogManager-tag', realtimeTagLogManage)
},
},
{
id: 'getLogManager',
func: () => {
logManager = Taro.getLogManager()
TestConsole.consoleNormal('getLogManager', logManager)
},
},
{
id: 'LogManager-debug',
func: () => {
logManager.debug(['test'])
TestConsole.consoleNormal('LogManager-debug')
},
},
{
id: 'LogManager-info',
func: () => {
logManager.info(['test'])
TestConsole.consoleNormal('LogManager-info')
},
},
{
id: 'LogManager-log',
func: () => {
logManager.log(['test'])
TestConsole.consoleNormal('LogManager-log')
},
},
{
id: 'LogManager-warn',
func: () => {
logManager.warn(['test'])
TestConsole.consoleNormal('LogManager-warn')
},
},
{
id: 'console',
func: null,
},
{
id: 'RealtimeTagLogManager',
func: null,
},
],
}
render() {
const { list } = this.state
return (
<View className='api-page'>
<ButtonList buttonList={list} />
</View>
)
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
"build:binding:release": "pnpm --filter @tarojs/binding run build",
"format::rs": "cargo fmt --all",
"clear-all": "rimraf **/node_modules",
"lint": "eslint packages/ --ext .js --ext .ts --ext .tsx",
"lint": "eslint ./packages/ --ext .js,.jsx,.ts,.tsx",
"lint:style": "stylelint ./packages/**/*.{css,scss}",
"format": "prettier --write --cache .",
"format:check": "prettier --check --cache .",
"test": "pnpm --if-present -r --aggregate-output --filter=./packages/* test:ci",
"test:binding": "pnpm --filter @tarojs/binding run test",
"updateSnapshot": "pnpm --if-present -r --aggregate-output --filter=./packages/* updateSnapshot",
Expand Down
1 change: 0 additions & 1 deletion packages/shared/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ export class BaseTemplate {
? `<template is="{{'tmpl_0_' + item.nn}}" data="{{${data}}}" />`
: `<template is="{{'tmpl_' + c + '_' + item.nn}}" data="{{${data}}}" />`
}

}

private getChildren (comp: Component, level: number): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-alipay/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class Template extends RecursiveTemplate {
if (pageConfig?.enablePageMeta) {
const getComponentAttrs = (componentName: string, dataPath: string) => {
return Object.entries(this.transferComponents[componentName]).reduce((sum, [key, value]) => {
sum +=`${key}="${value === 'eh' ? value : `{{${value.replace('i.', dataPath)}}}`}" `
sum += `${key}="${value === 'eh' ? value : `{{${value.replace('i.', dataPath)}}}`}" `
return sum
}, '')
}
Expand Down
1 change: 0 additions & 1 deletion packages/taro-api/__tests__/interceptorify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ describe('taro interceptorify', () => {
const res2 = await execLink.request({ msg: 'test2' })
expect(res2.msg).toBe('test2__exec')
})

})
1 change: 0 additions & 1 deletion packages/taro-api/__tests__/pxTransform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,4 @@ describe('pxtransform', () => {
})
expect(Taro.pxTransform(20)).toBe('0.585rem')
})

})
4 changes: 2 additions & 2 deletions packages/taro-api/src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export function getPxTransform (taro) {
const config = taro.config || {}
const baseFontSize = config.baseFontSize
const deviceRatio = config.deviceRatio || defaultDesignRatio
const designWidth = (((input = 0) => isFunction(config.designWidth)
const designWidth = ((input = 0) => isFunction(config.designWidth)
? config.designWidth(input)
: config.designWidth || defaultDesignWidth))(size)
: config.designWidth || defaultDesignWidth)(size)
if (!(designWidth in deviceRatio)) {
throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`)
}
Expand Down
Loading

0 comments on commit 542e357

Please sign in to comment.