Преглед на файлове

chore: ci add lint & ts

dragooncjw преди 10 месеца
родител
ревизия
700221c69b

+ 4 - 0
.github/workflows/ci.yml

@@ -28,5 +28,9 @@ jobs:
         run: node common/scripts/install-run-rush.js install
       - name: Rush build
         run: node common/scripts/install-run-rush.js build
+      # - name: Check Lint
+      #   run: node common/scripts/install-run-rush.js lint
+      - name: Check TS
+        run: node common/scripts/install-run-rush.js ts-check
       - name: Test (coverage)
         run: node common/scripts/install-run-rush.js test:cov

+ 5 - 3
apps/demo-fixed-layout-simple/src/app.tsx

@@ -1,5 +1,7 @@
-import ReactDOM from 'react-dom';
-import { Editor } from './editor'
+import { createRoot } from 'react-dom/client';
 
+import { Editor } from './editor';
 
-ReactDOM.render(<Editor />, document.getElementById('root'));
+const app = createRoot(document.getElementById('root')!);
+
+app.render(<Editor />);

+ 4 - 6
apps/demo-fixed-layout-simple/src/components/branch-adder.tsx

@@ -1,14 +1,12 @@
+import { nanoid } from 'nanoid';
 import { type FlowNodeEntity, useClientContext } from '@flowgram.ai/fixed-layout-editor';
 import { IconPlus } from '@douyinfe/semi-icons';
-import { nanoid } from 'nanoid';
-
 
 interface PropsType {
   activated?: boolean;
   node: FlowNodeEntity;
 }
 
-
 export function BranchAdder(props: PropsType) {
   const { activated, node } = props;
   const nodeData = node.firstChild!.renderData;
@@ -22,8 +20,8 @@ export function BranchAdder(props: PropsType) {
       type: 'block',
       data: {
         title: 'New Branch',
-        content: ''
-      }
+        content: '',
+      },
     });
 
     setTimeout(() => {
@@ -38,7 +36,7 @@ export function BranchAdder(props: PropsType) {
   const className = [
     'demo-fixed-adder',
     isVertical ? '' : 'isHorizontal',
-    activated ? 'activated' : ''
+    activated ? 'activated' : '',
   ].join(' ');
 
   return (

+ 1 - 0
apps/demo-fixed-layout/src/plugins/group-plugin/icons/index.tsx

@@ -29,6 +29,7 @@ const SvgUngroup = () => (
 );
 
 const IconFactory = (svg: ReactNode) =>
+  // eslint-disable-next-line react/display-name
   forwardRef((props: Omit<IconProps, 'svg' | 'ref'>, ref: Ref<HTMLSpanElement>) => (
     <Icon svg={svg} {...props} ref={ref} />
   ));

+ 1 - 1
apps/docs/package.json

@@ -6,7 +6,7 @@
     "build": "rm -rf ./doc_build && rspress build",
     "docs": "sucrase-node ./scripts/auto-generate.ts",
     "dev": "rspress dev",
-    "lint": "eslint .",
+    "lint": "eslint ./components --cache",
     "preview": "rspress preview"
   },
   "dependencies": {

+ 16 - 0
common/config/rush/command-line.json

@@ -235,6 +235,22 @@
       "safeForSimultaneousRushProcesses": true,
       "shellCommand": "concurrently --kill-others --prefix \"{name}\" --names [watch],[demo] -c white,blue \"rush build:watch --to-except @flowgram.ai/docs\" \"cd apps/docs && rushx dev\""
     },
+    {
+      "name": "ts-check",
+      "commandKind": "bulk",
+      "summary": "⭐️️ Run ts check in packages",
+      "ignoreMissingScript": true,
+      "enableParallelism": true,
+      "safeForSimultaneousRushProcesses": true
+    },
+    {
+      "name": "lint",
+      "commandKind": "bulk",
+      "summary": "⭐️️ Run eslint check in packages",
+      "ignoreMissingScript": true,
+      "enableParallelism": true,
+      "safeForSimultaneousRushProcesses": true
+    },
     {
       "name": "dev:demo-fixed-layout",
       "commandKind": "global",

+ 5 - 1
config/eslint-config/.eslintrc.base.js

@@ -62,7 +62,11 @@ module.exports = {
           },
         },
       },
-      extends: ['plugin:prettier/recommended', 'plugin:react/recommended'],
+      extends: [
+        'plugin:prettier/recommended',
+        'plugin:react/recommended',
+        'plugin:react/jsx-runtime',
+      ],
       plugins: ['@typescript-eslint', 'import'],
 
       parserOptions: {

+ 1 - 1
config/eslint-config/package.json

@@ -7,7 +7,7 @@
   "scripts": {
     "build": "tsc -b --force",
     "dev": "npm run build -- -w",
-    "lint": "eslint ./ --cache --quiet",
+    "lint": "eslint ./src --cache",
     "lint:fix": "eslint --fix ../../packages",
     "test": "exit",
     "test:cov": "exit"

+ 1 - 0
packages/node-engine/form-core/__tests__/form.test.ts

@@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it } from 'vitest';
 
 describe('form test', () => {
   it('form test', () => {
+    // eslint-disable-next-line no-console
     console.log('form test');
   });
 });