Bladeren bron

chore: add eslint ts config

dragooncjw 10 maanden geleden
bovenliggende
commit
3c625c0e9a

+ 7 - 71
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',
   },
-}
+});

+ 2 - 0
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:*",

+ 1 - 0
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,

+ 7 - 71
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',
   },
-}
+});

+ 2 - 0
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",

+ 1 - 0
apps/demo-fixed-layout/tsconfig.json

@@ -1,4 +1,5 @@
 {
+  "extends": "@flowgram.ai/ts-config/tsconfig.flow.path.json",
   "compilerOptions": {
     "rootDir": "./src",
     "outDir": "./dist",

+ 7 - 71
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',
   },
-}
+});

+ 2 - 0
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",

+ 1 - 0
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",

+ 7 - 71
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',
   },
-}
+});

+ 2 - 0
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",

+ 1 - 0
apps/demo-free-layout/tsconfig.json

@@ -1,4 +1,5 @@
 {
+  "extends": "@flowgram.ai/ts-config/tsconfig.flow.path.json",
   "compilerOptions": {
     "rootDir": "./src",
     "outDir": "./dist",

+ 24 - 0
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