@coze-arch/cli 0.0.1-alpha.7e1be4 → 0.0.1-alpha.800d04

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.
@@ -26,6 +26,8 @@
26
26
  │ │ └── Screen.tsx # 页面容器组件(必用)
27
27
  │ ├── hooks/ # 自定义 Hooks
28
28
  │ ├── contexts/ # React Context 代码
29
+ │ ├── constants/ # 常量定义(如主题配置)
30
+ │ ├── utils/ # 工具函数
29
31
  │ ├── assets/ # 静态资源
30
32
  | └── package.json # Expo 应用 package.json
31
33
  ├── package.json
@@ -1,10 +1,11 @@
1
- import js from "@eslint/js";
2
- import globals from "globals";
3
- import tseslint from "typescript-eslint";
4
- import pluginReact from "eslint-plugin-react";
5
- import reactHooks from "eslint-plugin-react-hooks";
6
- import regexp from "eslint-plugin-regexp";
7
- import pluginImport from "eslint-plugin-import";
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+ import tseslint from 'typescript-eslint';
4
+ import pluginReact from 'eslint-plugin-react';
5
+ import reactHooks from 'eslint-plugin-react-hooks';
6
+ import regexp from 'eslint-plugin-regexp';
7
+ import pluginImport from 'eslint-plugin-import';
8
+ import fontawesome6 from '../eslint-plugins/fontawesome6/index.js';
8
9
 
9
10
  export default [
10
11
  {
@@ -20,14 +21,14 @@ export default [
20
21
  regexp.configs["flat/recommended"],
21
22
  js.configs.recommended,
22
23
  ...tseslint.configs.recommended,
23
-
24
+
24
25
  // React 的推荐配置
25
26
  pluginReact.configs.flat.recommended,
26
27
  pluginReact.configs.flat['jsx-runtime'],
27
28
  reactHooks.configs.flat.recommended,
28
29
  {
29
30
  files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
30
-
31
+
31
32
  // 语言选项:设置全局变量
32
33
  languageOptions: {
33
34
  globals: {
@@ -52,6 +53,7 @@ export default [
52
53
 
53
54
  plugins: {
54
55
  import: pluginImport,
56
+ fontawesome6,
55
57
  },
56
58
  rules: {
57
59
  // 关闭代码风格规则
@@ -70,6 +72,7 @@ export default [
70
72
  'no-prototype-builtins': 'off',
71
73
  'react/react-in-jsx-scope': 'off',
72
74
  'react/jsx-uses-react': 'off',
75
+ 'fontawesome6/valid-name': 'error',
73
76
  },
74
77
  },
75
78
 
@@ -91,7 +94,7 @@ export default [
91
94
  // 在 .js 文件中关闭 TS 规则
92
95
  '@typescript-eslint/no-require-imports': 'off',
93
96
  // 在 Node.js 文件中允许 require
94
- '@typescript-eslint/no-var-requires': 'off',
97
+ '@typescript-eslint/no-var-requires': 'off',
95
98
  'no-undef': 'off',
96
99
  },
97
100
  },
@@ -1,13 +1,33 @@
1
- import { Colors } from "@/constants/theme";
2
- import { useColorScheme } from "@/hooks/useColorScheme";
1
+ import { Colors } from '@/constants/theme';
2
+ import { useColorScheme } from '@/hooks/useColorScheme';
3
3
 
4
- export function useTheme() {
5
- const colorScheme = useColorScheme();
6
- const isDark = colorScheme === "dark";
7
- const theme = Colors[(colorScheme as "light" | "dark") ?? "light"];
4
+ enum COLOR_SCHEME_CHOICE {
5
+ FOLLOW_SYSTEM = 'follow-system', // 跟随系统自动变化
6
+ DARK = 'dark', // 固定为 dark 主题,不随系统变化
7
+ LIGHT = 'light', // 固定为 light 主题,不随系统变化
8
+ };
9
+
10
+ const userPreferColorScheme: COLOR_SCHEME_CHOICE = COLOR_SCHEME_CHOICE.FOLLOW_SYSTEM;
11
+
12
+ function getTheme(colorScheme?: 'dark' | 'light' | null) {
13
+ const isDark = colorScheme === 'dark';
14
+ const theme = Colors[colorScheme ?? 'light'];
8
15
 
9
16
  return {
10
17
  theme,
11
18
  isDark,
12
19
  };
13
20
  }
21
+
22
+ function useTheme() {
23
+ const systemColorScheme = useColorScheme()
24
+ const colorScheme = userPreferColorScheme === COLOR_SCHEME_CHOICE.FOLLOW_SYSTEM ?
25
+ systemColorScheme :
26
+ userPreferColorScheme;
27
+
28
+ return getTheme(colorScheme);
29
+ }
30
+
31
+ export {
32
+ useTheme,
33
+ }
@@ -0,0 +1,9 @@
1
+ const validName = require('./rule')
2
+
3
+ const plugin = {
4
+ rules: {
5
+ 'valid-name': validName,
6
+ },
7
+ };
8
+
9
+ module.exports = plugin