chore: ci add lint & ts

This commit is contained in:
dragooncjw 2025-03-03 19:40:26 +08:00
parent 61f558a0da
commit 700221c69b
9 changed files with 38 additions and 12 deletions

View File

@ -28,5 +28,9 @@ jobs:
run: node common/scripts/install-run-rush.js install run: node common/scripts/install-run-rush.js install
- name: Rush build - name: Rush build
run: node common/scripts/install-run-rush.js 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) - name: Test (coverage)
run: node common/scripts/install-run-rush.js test:cov run: node common/scripts/install-run-rush.js test:cov

View File

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

View File

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

View File

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

View File

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

View File

@ -235,6 +235,22 @@
"safeForSimultaneousRushProcesses": true, "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\"" "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", "name": "dev:demo-fixed-layout",
"commandKind": "global", "commandKind": "global",

View File

@ -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'], plugins: ['@typescript-eslint', 'import'],
parserOptions: { parserOptions: {

View File

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

View File

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