From 3c625c0e9a123f62c8198e7c44f5489157e1e898 Mon Sep 17 00:00:00 2001 From: dragooncjw <289056872@qq.com> Date: Fri, 21 Feb 2025 18:08:34 +0800 Subject: [PATCH] chore: add eslint ts config --- apps/demo-fixed-layout-simple/.eslintrc.js | 78 ++------------------- apps/demo-fixed-layout-simple/package.json | 2 + apps/demo-fixed-layout-simple/tsconfig.json | 1 + apps/demo-fixed-layout/.eslintrc.js | 78 ++------------------- apps/demo-fixed-layout/package.json | 2 + apps/demo-fixed-layout/tsconfig.json | 1 + apps/demo-free-layout-simple/.eslintrc.js | 78 ++------------------- apps/demo-free-layout-simple/package.json | 2 + apps/demo-free-layout-simple/tsconfig.json | 1 + apps/demo-free-layout/.eslintrc.js | 78 ++------------------- apps/demo-free-layout/package.json | 2 + apps/demo-free-layout/tsconfig.json | 1 + common/config/rush/pnpm-lock.yaml | 24 +++++++ 13 files changed, 64 insertions(+), 284 deletions(-) diff --git a/apps/demo-fixed-layout-simple/.eslintrc.js b/apps/demo-fixed-layout-simple/.eslintrc.js index b8748f0c..02803479 100644 --- a/apps/demo-fixed-layout-simple/.eslintrc.js +++ b/apps/demo-fixed-layout-simple/.eslintrc.js @@ -1,74 +1,10 @@ -module.exports = { - parser: "@typescript-eslint/parser", - parserOptions: { - requireConfigFile: false, - babelOptions: { - babelrc: false, - configFile: false, - cwd: __dirname, - }, - }, - ignorePatterns: [ - '**/*.d.ts', - '**/__mocks__', - '**/node_modules', - '**/build', - '**/dist', - '**/es', - '**/lib', - '**/.codebase', - '**/.changeset', - '**/config', - '**/common/scripts', - '**/output', - 'error-log-str.js', - '*.bundle.js', - '*.min.js', - '*.js.map', - '**/output', - '**/*.log', - '**/tsconfig.tsbuildinfo', - '**/vitest.config.ts', - 'package.json', - '*.json', - ], +const { defineConfig } = require('@flowgram.ai/eslint-config'); + +module.exports = defineConfig({ + preset: 'web', + packageRoot: __dirname, rules: { 'no-console': 'off', - 'react/no-deprecated': 'off', - 'import/prefer-default-export': 'off', - 'lines-between-class-members': 'warn', - 'react/jsx-no-useless-fragment': 'off', - 'no-unused-vars': 'off', - 'no-redeclare': 'off', - 'no-empty-fuNction': 'off', - 'prefer-destructurin': 'off', - 'no-underscore-dangle': 'off', - 'no-empty-function': 'off', - 'no-multi-assign': 'off', - 'arrow-body-style': 'warn', - 'no-useless-constructor': 'off', - 'no-param-reassign': 'off', - 'max-classes-per-file': 'off', - 'grouped-accessor-pairs': 'off', - 'no-plusplus': 'off', - 'no-restricted-syntax': 'off', - 'react/destructuring-assignment': 'off', - 'import/extensions': 'off', - 'consistent-return': 'off', - 'jsx-a11y/no-static-element-interactions': 'off', - 'no-use-before-define': 'off', - 'no-bitwise': 'off', - 'no-case-declarations': 'off', - 'react/no-array-index-key': 'off', - 'react/require-default-props': 'off', - 'no-dupe-class-members': 'off', - 'react/jsx-props-no-spreading': 'off', - 'no-console': 'off', - 'no-shadow': 'off', - 'class-methods-use-this': 'off', - 'default-param-last': 'off', - 'no-unused-vars': 'off', - 'import/prefer-default-export': 'off', - 'import/extensions': 'off', + 'react/prop-types': 'off', }, -} +}); diff --git a/apps/demo-fixed-layout-simple/package.json b/apps/demo-fixed-layout-simple/package.json index 937413f0..6f74418c 100644 --- a/apps/demo-fixed-layout-simple/package.json +++ b/apps/demo-fixed-layout-simple/package.json @@ -28,6 +28,8 @@ "watch": "exit 0" }, "dependencies": { + "@flowgram.ai/ts-config": "workspace:*", + "@flowgram.ai/eslint-config": "workspace:*", "@douyinfe/semi-icons": "^2.72.3", "@douyinfe/semi-ui": "^2.72.3", "@flowgram.ai/fixed-layout-editor": "workspace:*", diff --git a/apps/demo-fixed-layout-simple/tsconfig.json b/apps/demo-fixed-layout-simple/tsconfig.json index cf77cad0..be31be25 100644 --- a/apps/demo-fixed-layout-simple/tsconfig.json +++ b/apps/demo-fixed-layout-simple/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "@flowgram.ai/ts-config/tsconfig.flow.path.json", "compilerOptions": { "rootDir": "./src", "experimentalDecorators": true, diff --git a/apps/demo-fixed-layout/.eslintrc.js b/apps/demo-fixed-layout/.eslintrc.js index b8748f0c..02803479 100644 --- a/apps/demo-fixed-layout/.eslintrc.js +++ b/apps/demo-fixed-layout/.eslintrc.js @@ -1,74 +1,10 @@ -module.exports = { - parser: "@typescript-eslint/parser", - parserOptions: { - requireConfigFile: false, - babelOptions: { - babelrc: false, - configFile: false, - cwd: __dirname, - }, - }, - ignorePatterns: [ - '**/*.d.ts', - '**/__mocks__', - '**/node_modules', - '**/build', - '**/dist', - '**/es', - '**/lib', - '**/.codebase', - '**/.changeset', - '**/config', - '**/common/scripts', - '**/output', - 'error-log-str.js', - '*.bundle.js', - '*.min.js', - '*.js.map', - '**/output', - '**/*.log', - '**/tsconfig.tsbuildinfo', - '**/vitest.config.ts', - 'package.json', - '*.json', - ], +const { defineConfig } = require('@flowgram.ai/eslint-config'); + +module.exports = defineConfig({ + preset: 'web', + packageRoot: __dirname, rules: { 'no-console': 'off', - 'react/no-deprecated': 'off', - 'import/prefer-default-export': 'off', - 'lines-between-class-members': 'warn', - 'react/jsx-no-useless-fragment': 'off', - 'no-unused-vars': 'off', - 'no-redeclare': 'off', - 'no-empty-fuNction': 'off', - 'prefer-destructurin': 'off', - 'no-underscore-dangle': 'off', - 'no-empty-function': 'off', - 'no-multi-assign': 'off', - 'arrow-body-style': 'warn', - 'no-useless-constructor': 'off', - 'no-param-reassign': 'off', - 'max-classes-per-file': 'off', - 'grouped-accessor-pairs': 'off', - 'no-plusplus': 'off', - 'no-restricted-syntax': 'off', - 'react/destructuring-assignment': 'off', - 'import/extensions': 'off', - 'consistent-return': 'off', - 'jsx-a11y/no-static-element-interactions': 'off', - 'no-use-before-define': 'off', - 'no-bitwise': 'off', - 'no-case-declarations': 'off', - 'react/no-array-index-key': 'off', - 'react/require-default-props': 'off', - 'no-dupe-class-members': 'off', - 'react/jsx-props-no-spreading': 'off', - 'no-console': 'off', - 'no-shadow': 'off', - 'class-methods-use-this': 'off', - 'default-param-last': 'off', - 'no-unused-vars': 'off', - 'import/prefer-default-export': 'off', - 'import/extensions': 'off', + 'react/prop-types': 'off', }, -} +}); diff --git a/apps/demo-fixed-layout/package.json b/apps/demo-fixed-layout/package.json index 7cfc3986..9dea2ded 100644 --- a/apps/demo-fixed-layout/package.json +++ b/apps/demo-fixed-layout/package.json @@ -41,6 +41,8 @@ "styled-components": "^5" }, "devDependencies": { + "@flowgram.ai/ts-config": "workspace:*", + "@flowgram.ai/eslint-config": "workspace:*", "@rspack/cli": "0.2.1", "@types/lodash-es": "^4.17.12", "@types/node": "^18", diff --git a/apps/demo-fixed-layout/tsconfig.json b/apps/demo-fixed-layout/tsconfig.json index d4b2793e..171a60f5 100644 --- a/apps/demo-fixed-layout/tsconfig.json +++ b/apps/demo-fixed-layout/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "@flowgram.ai/ts-config/tsconfig.flow.path.json", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", diff --git a/apps/demo-free-layout-simple/.eslintrc.js b/apps/demo-free-layout-simple/.eslintrc.js index b8748f0c..02803479 100644 --- a/apps/demo-free-layout-simple/.eslintrc.js +++ b/apps/demo-free-layout-simple/.eslintrc.js @@ -1,74 +1,10 @@ -module.exports = { - parser: "@typescript-eslint/parser", - parserOptions: { - requireConfigFile: false, - babelOptions: { - babelrc: false, - configFile: false, - cwd: __dirname, - }, - }, - ignorePatterns: [ - '**/*.d.ts', - '**/__mocks__', - '**/node_modules', - '**/build', - '**/dist', - '**/es', - '**/lib', - '**/.codebase', - '**/.changeset', - '**/config', - '**/common/scripts', - '**/output', - 'error-log-str.js', - '*.bundle.js', - '*.min.js', - '*.js.map', - '**/output', - '**/*.log', - '**/tsconfig.tsbuildinfo', - '**/vitest.config.ts', - 'package.json', - '*.json', - ], +const { defineConfig } = require('@flowgram.ai/eslint-config'); + +module.exports = defineConfig({ + preset: 'web', + packageRoot: __dirname, rules: { 'no-console': 'off', - 'react/no-deprecated': 'off', - 'import/prefer-default-export': 'off', - 'lines-between-class-members': 'warn', - 'react/jsx-no-useless-fragment': 'off', - 'no-unused-vars': 'off', - 'no-redeclare': 'off', - 'no-empty-fuNction': 'off', - 'prefer-destructurin': 'off', - 'no-underscore-dangle': 'off', - 'no-empty-function': 'off', - 'no-multi-assign': 'off', - 'arrow-body-style': 'warn', - 'no-useless-constructor': 'off', - 'no-param-reassign': 'off', - 'max-classes-per-file': 'off', - 'grouped-accessor-pairs': 'off', - 'no-plusplus': 'off', - 'no-restricted-syntax': 'off', - 'react/destructuring-assignment': 'off', - 'import/extensions': 'off', - 'consistent-return': 'off', - 'jsx-a11y/no-static-element-interactions': 'off', - 'no-use-before-define': 'off', - 'no-bitwise': 'off', - 'no-case-declarations': 'off', - 'react/no-array-index-key': 'off', - 'react/require-default-props': 'off', - 'no-dupe-class-members': 'off', - 'react/jsx-props-no-spreading': 'off', - 'no-console': 'off', - 'no-shadow': 'off', - 'class-methods-use-this': 'off', - 'default-param-last': 'off', - 'no-unused-vars': 'off', - 'import/prefer-default-export': 'off', - 'import/extensions': 'off', + 'react/prop-types': 'off', }, -} +}); diff --git a/apps/demo-free-layout-simple/package.json b/apps/demo-free-layout-simple/package.json index 99d78360..904433b5 100644 --- a/apps/demo-free-layout-simple/package.json +++ b/apps/demo-free-layout-simple/package.json @@ -35,6 +35,8 @@ "react-dom": "^18" }, "devDependencies": { + "@flowgram.ai/ts-config": "workspace:*", + "@flowgram.ai/eslint-config": "workspace:*", "@rspack/cli": "0.2.1", "@types/lodash-es": "^4.17.12", "@types/node": "^18", diff --git a/apps/demo-free-layout-simple/tsconfig.json b/apps/demo-free-layout-simple/tsconfig.json index d4b2793e..171a60f5 100644 --- a/apps/demo-free-layout-simple/tsconfig.json +++ b/apps/demo-free-layout-simple/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "@flowgram.ai/ts-config/tsconfig.flow.path.json", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", diff --git a/apps/demo-free-layout/.eslintrc.js b/apps/demo-free-layout/.eslintrc.js index b8748f0c..02803479 100644 --- a/apps/demo-free-layout/.eslintrc.js +++ b/apps/demo-free-layout/.eslintrc.js @@ -1,74 +1,10 @@ -module.exports = { - parser: "@typescript-eslint/parser", - parserOptions: { - requireConfigFile: false, - babelOptions: { - babelrc: false, - configFile: false, - cwd: __dirname, - }, - }, - ignorePatterns: [ - '**/*.d.ts', - '**/__mocks__', - '**/node_modules', - '**/build', - '**/dist', - '**/es', - '**/lib', - '**/.codebase', - '**/.changeset', - '**/config', - '**/common/scripts', - '**/output', - 'error-log-str.js', - '*.bundle.js', - '*.min.js', - '*.js.map', - '**/output', - '**/*.log', - '**/tsconfig.tsbuildinfo', - '**/vitest.config.ts', - 'package.json', - '*.json', - ], +const { defineConfig } = require('@flowgram.ai/eslint-config'); + +module.exports = defineConfig({ + preset: 'web', + packageRoot: __dirname, rules: { 'no-console': 'off', - 'react/no-deprecated': 'off', - 'import/prefer-default-export': 'off', - 'lines-between-class-members': 'warn', - 'react/jsx-no-useless-fragment': 'off', - 'no-unused-vars': 'off', - 'no-redeclare': 'off', - 'no-empty-fuNction': 'off', - 'prefer-destructurin': 'off', - 'no-underscore-dangle': 'off', - 'no-empty-function': 'off', - 'no-multi-assign': 'off', - 'arrow-body-style': 'warn', - 'no-useless-constructor': 'off', - 'no-param-reassign': 'off', - 'max-classes-per-file': 'off', - 'grouped-accessor-pairs': 'off', - 'no-plusplus': 'off', - 'no-restricted-syntax': 'off', - 'react/destructuring-assignment': 'off', - 'import/extensions': 'off', - 'consistent-return': 'off', - 'jsx-a11y/no-static-element-interactions': 'off', - 'no-use-before-define': 'off', - 'no-bitwise': 'off', - 'no-case-declarations': 'off', - 'react/no-array-index-key': 'off', - 'react/require-default-props': 'off', - 'no-dupe-class-members': 'off', - 'react/jsx-props-no-spreading': 'off', - 'no-console': 'off', - 'no-shadow': 'off', - 'class-methods-use-this': 'off', - 'default-param-last': 'off', - 'no-unused-vars': 'off', - 'import/prefer-default-export': 'off', - 'import/extensions': 'off', + 'react/prop-types': 'off', }, -} +}); diff --git a/apps/demo-free-layout/package.json b/apps/demo-free-layout/package.json index 559a4cc4..ffc203a0 100644 --- a/apps/demo-free-layout/package.json +++ b/apps/demo-free-layout/package.json @@ -40,6 +40,8 @@ "styled-components": "^5" }, "devDependencies": { + "@flowgram.ai/ts-config": "workspace:*", + "@flowgram.ai/eslint-config": "workspace:*", "@rspack/cli": "0.2.1", "@types/lodash-es": "^4.17.12", "@types/node": "^18", diff --git a/apps/demo-free-layout/tsconfig.json b/apps/demo-free-layout/tsconfig.json index d4b2793e..171a60f5 100644 --- a/apps/demo-free-layout/tsconfig.json +++ b/apps/demo-free-layout/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "@flowgram.ai/ts-config/tsconfig.flow.path.json", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index eeb9e7cc..1fc71e26 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -90,6 +90,12 @@ importers: specifier: ^5 version: 5.3.11(react-dom@18.3.1)(react@18.3.1) devDependencies: + '@flowgram.ai/eslint-config': + specifier: workspace:* + version: link:../../config/eslint-config + '@flowgram.ai/ts-config': + specifier: workspace:* + version: link:../../config/ts-config '@rspack/cli': specifier: 0.2.1 version: 0.2.1 @@ -129,6 +135,9 @@ importers: '@douyinfe/semi-ui': specifier: ^2.72.3 version: 2.72.3(react-dom@18.3.1)(react@18.3.1) + '@flowgram.ai/eslint-config': + specifier: workspace:* + version: link:../../config/eslint-config '@flowgram.ai/fixed-layout-editor': specifier: workspace:* version: link:../../packages/client/fixed-layout-editor @@ -138,6 +147,9 @@ importers: '@flowgram.ai/minimap-plugin': specifier: workspace:* version: link:../../packages/plugins/minimap-plugin + '@flowgram.ai/ts-config': + specifier: workspace:* + version: link:../../config/ts-config nanoid: specifier: ^4.0.2 version: 4.0.2 @@ -206,6 +218,12 @@ importers: specifier: ^5 version: 5.3.11(react-dom@18.3.1)(react@18.3.1) devDependencies: + '@flowgram.ai/eslint-config': + specifier: workspace:* + version: link:../../config/eslint-config + '@flowgram.ai/ts-config': + specifier: workspace:* + version: link:../../config/ts-config '@rspack/cli': specifier: 0.2.1 version: 0.2.1 @@ -258,6 +276,12 @@ importers: specifier: ^18 version: 18.3.1(react@18.3.1) devDependencies: + '@flowgram.ai/eslint-config': + specifier: workspace:* + version: link:../../config/eslint-config + '@flowgram.ai/ts-config': + specifier: workspace:* + version: link:../../config/ts-config '@rspack/cli': specifier: 0.2.1 version: 0.2.1