mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 18:42:56 +00:00
ci: add lint
This commit is contained in:
parent
cdb9445c5f
commit
cbf57e367e
@ -1,8 +1,10 @@
|
||||
import stylistic from '@stylistic/eslint-plugin';
|
||||
import tseslint from 'typescript-eslint'
|
||||
import js from '@eslint/js';
|
||||
import react from 'eslint-plugin-react'
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import reactRefresh from 'eslint-plugin-react-refresh';
|
||||
import globals from 'globals'
|
||||
|
||||
export default tseslint.config({
|
||||
files: ['packages/*/src/**/*.{ts?(x),js?(x)}'],
|
||||
@ -13,19 +15,39 @@ export default tseslint.config({
|
||||
],
|
||||
plugins: {
|
||||
'@stylistic': stylistic,
|
||||
react,
|
||||
'react-hooks': reactHooks,
|
||||
'react-refresh': reactRefresh
|
||||
},
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.nodeBuiltin,
|
||||
...globals.jest
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'@stylistic/indent': ['error', 2],
|
||||
'@stylistic/indent-binary-ops': ['error', 2],
|
||||
'@stylistic/max-len': ['error', { tabWidth: 2 }],
|
||||
'@stylistic/max-len': ['error', { tabWidth: 2, "ignoreStrings": true }],
|
||||
'@stylistic/no-tabs': 'error',
|
||||
'@stylistic/quotes': ['error', 'single'],
|
||||
'@stylistic/jsx-pascal-case': [2],
|
||||
'@stylistic/jsx-indent': [2, 2, { checkAttributes: true, indentLogicalExpressions: true }],
|
||||
'@stylistic/semi': ['error', 'always'],
|
||||
|
||||
'react/jsx-no-undef': 'error',
|
||||
'react/jsx-uses-vars': 'error',
|
||||
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
|
||||
'react/no-this-in-sfc': 'error',
|
||||
'react/require-render-return': 'warn',
|
||||
'react/no-children-prop': 'warn',
|
||||
|
||||
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
|
||||
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
"clean": "rimraf ./packages/*/dist",
|
||||
"clean:lib": "rimraf ./node_modules ./packages/*/node_modules",
|
||||
"lint": "eslint . --cache",
|
||||
"docs": "pnpm --filter @alilc/lowcode-engine-docs run start",
|
||||
"pub": "npm run watchdog:build && lerna publish patch --yes --force-publish --exact --no-changelog",
|
||||
"pub:minor": "npm run watchdog:build && lerna publish minor --yes --force-publish --exact --no-changelog",
|
||||
"pub:major": "npm run watchdog:build && lerna publish major --yes --force-publish --exact --no-changelog",
|
||||
@ -32,13 +33,13 @@
|
||||
"@types/react-router": "5.1.18",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-react": "^7.34.1",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.6",
|
||||
"execa": "^8.0.1",
|
||||
"globals": "^15.0.0",
|
||||
"husky": "^9.0.11",
|
||||
"less": "^4.2.0",
|
||||
"lint-staged": "^15.2.2",
|
||||
"minimist": "^1.2.8",
|
||||
"rimraf": "^5.0.2",
|
||||
"rollup": "^4.13.0",
|
||||
"typescript": "^5.4.2",
|
||||
|
||||
@ -7,4 +7,5 @@ export function IconHidden(props: IconProps) {
|
||||
</SVGIcon>
|
||||
);
|
||||
}
|
||||
|
||||
IconHidden.displayName = 'Hidden';
|
||||
|
||||
@ -9,7 +9,6 @@ import {
|
||||
} from './plugin-types';
|
||||
import { filterValidOptions, isLowCodeRegisterOptions } from './plugin-utils';
|
||||
import { LowCodePluginRuntime } from './plugin';
|
||||
// eslint-disable-next-line import/no-named-as-default
|
||||
import LowCodePluginContext from './plugin-context';
|
||||
import { invariant } from '../utils';
|
||||
import sequencify from './sequencify';
|
||||
|
||||
@ -39,7 +39,7 @@ export function registerSetter(
|
||||
function getInitialFromSetter(setter: any) {
|
||||
return setter && (
|
||||
setter.initial || setter.Initial
|
||||
|| (setter.type && (setter.type.initial || setter.type.Initial))
|
||||
|| (setter.type && (setter.type.initial || setter.type.Initial))
|
||||
) || null; // eslint-disable-line
|
||||
}
|
||||
|
||||
|
||||
@ -211,7 +211,7 @@ class SkeletonCabin implements IPublicApiCommonSkeletonCabin {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
get PopupPipe(): any {
|
||||
get PopupPipe(): any {
|
||||
return InnerPopupPipe;
|
||||
}
|
||||
}
|
||||
@ -233,9 +233,9 @@ class Utils implements IPublicApiCommonUtils {
|
||||
}
|
||||
|
||||
getNodeSchemaById(
|
||||
schema: IPublicTypeNodeSchema,
|
||||
nodeId: string,
|
||||
): IPublicTypeNodeSchema | undefined {
|
||||
schema: IPublicTypeNodeSchema,
|
||||
nodeId: string,
|
||||
): IPublicTypeNodeSchema | undefined {
|
||||
return innerGetNodeSchemaById(schema, nodeId);
|
||||
}
|
||||
|
||||
@ -248,18 +248,18 @@ class Utils implements IPublicApiCommonUtils {
|
||||
}
|
||||
|
||||
executeTransaction(
|
||||
fn: () => void,
|
||||
type: IPublicEnumTransitionType = IPublicEnumTransitionType.REPAINT,
|
||||
): void {
|
||||
fn: () => void,
|
||||
type: IPublicEnumTransitionType = IPublicEnumTransitionType.REPAINT,
|
||||
): void {
|
||||
transactionManager.executeTransaction(fn, type);
|
||||
}
|
||||
|
||||
createIntl(instance: string | object): {
|
||||
intlNode(id: string, params?: object): ReactNode;
|
||||
intl(id: string, params?: object): string;
|
||||
getLocale(): string;
|
||||
setLocale(locale: string): void;
|
||||
} {
|
||||
intlNode(id: string, params?: object): ReactNode;
|
||||
intl(id: string, params?: object): string;
|
||||
getLocale(): string;
|
||||
setLocale(locale: string): void;
|
||||
} {
|
||||
return innerCreateIntl(instance);
|
||||
}
|
||||
|
||||
|
||||
@ -2,3 +2,4 @@ packages:
|
||||
- 'packages/*'
|
||||
- 'playground'
|
||||
- 'docs'
|
||||
- 'scripts'
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
import { resolve } from 'node:path';
|
||||
import { existsSync } from 'node:fs';
|
||||
import { readdir } from 'node:fs/promises';
|
||||
import { argv } from 'node:process';
|
||||
import { URL } from 'node:url'
|
||||
import { argv, cwd } from 'node:process';
|
||||
import minimist from 'minimist';
|
||||
import { execa } from 'execa';
|
||||
import { findWorkspacePackages } from '@pnpm/workspace.find-packages'
|
||||
|
||||
const args = minimist(argv.slice(2));
|
||||
const targets = args['_'][0].split(',');
|
||||
const formatArgs = args['format'];
|
||||
const targets = args['_'][0];
|
||||
const formatArgs = args['formats'];
|
||||
const prod = args['prod'] || args['p'];
|
||||
|
||||
const packagesUrl = new URL('../packages', import.meta.url);
|
||||
|
||||
async function run() {
|
||||
const packageDirs = await readdir(packagesUrl.pathname);
|
||||
const targetPackages = packageDirs
|
||||
.filter((dir) => targets.includes(dir))
|
||||
const packages = await findWorkspacePackages(cwd());
|
||||
const targetPackageName = `@alilc/lowcode-${targets[0]}`
|
||||
|
||||
const finalName = packages
|
||||
.filter((item) => item.manifest.name.includes(targetPackageName))
|
||||
.filter((dir) => existsSync(resolve(packagesUrl.pathname, dir)));
|
||||
|
||||
await execa('pnpm', ['--filter', `@alilc/lowcode-${targetPackages[0]}`, 'build:target'], {
|
||||
await execa('pnpm', ['--filter', finalName, 'build:target'], {
|
||||
stdio: 'inherit',
|
||||
env: {
|
||||
FORMATS: !prod ? formatArgs : undefined,
|
||||
|
||||
10
scripts/package.json
Normal file
10
scripts/package.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "scripts",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@pnpm/workspace.find-packages": "^1.1.12",
|
||||
"execa": "^8.0.1",
|
||||
"minimist": "^1.2.8"
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
import { join } from 'node:path';
|
||||
import { existsSync, readdirSync } from 'node:fs';
|
||||
import { env, exit } from 'node:process'
|
||||
import * as console from 'node:console'
|
||||
import console from 'node:console'
|
||||
import { Extractor, ExtractorConfig } from '@microsoft/api-extractor';
|
||||
import { rimraf } from 'rimraf';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
import { request } from 'node:http';
|
||||
import packageJson from '../packages/engine/package.json';
|
||||
import * as console from 'node:console';
|
||||
import console from 'node:console';
|
||||
import { Buffer } from 'node:buffer'
|
||||
|
||||
const { version, name } = packageJson;
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
"removeComments": false,
|
||||
"baseUrl": ".",
|
||||
"rootDir": ".",
|
||||
// provide type friendly tips
|
||||
"paths": {
|
||||
"@alilc/lowcode-*": ["packages/*/src"]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user