mirror of
				https://github.com/soybeanjs/soybean-admin.git
				synced 2025-11-04 15:53:43 +08:00 
			
		
		
		
	chore(projects): use eslint flat config & update config
This commit is contained in:
		
							
								
								
									
										11
									
								
								.editorconfig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								.editorconfig
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
# Editor configuration, see http://editorconfig.org
 | 
			
		||||
 | 
			
		||||
root = true
 | 
			
		||||
 | 
			
		||||
[*]
 | 
			
		||||
charset = utf-8
 | 
			
		||||
indent_style = space
 | 
			
		||||
indent_size = 2
 | 
			
		||||
end_of_line = lf
 | 
			
		||||
trim_trailing_whitespace = true
 | 
			
		||||
insert_final_newline = true
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "extends": "sa/vue",
 | 
			
		||||
  "settings": {
 | 
			
		||||
    "import/core-modules": ["uno.css", "~icons/*", "virtual:svg-icons-register"]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1
									
								
								.npmrc
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								.npmrc
									
									
									
									
									
								
							@@ -1,2 +1,3 @@
 | 
			
		||||
registry=https://registry.npmmirror.com/
 | 
			
		||||
shamefully-hoist=true
 | 
			
		||||
ignore-workspace-root-check=true
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										65
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										65
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							@@ -1,70 +1,17 @@
 | 
			
		||||
{
 | 
			
		||||
  "cSpell.words": [
 | 
			
		||||
    "apifox",
 | 
			
		||||
    "clickoutside",
 | 
			
		||||
    "clsx",
 | 
			
		||||
    "colord",
 | 
			
		||||
    "consola",
 | 
			
		||||
    "Destructurable",
 | 
			
		||||
    "EDITMSG",
 | 
			
		||||
    "espree",
 | 
			
		||||
    "execa",
 | 
			
		||||
    "gitee",
 | 
			
		||||
    "gridicons",
 | 
			
		||||
    "heroicons",
 | 
			
		||||
    "HEXA",
 | 
			
		||||
    "hexcode",
 | 
			
		||||
    "iconify",
 | 
			
		||||
    "INDEXEDDB",
 | 
			
		||||
    "jiti",
 | 
			
		||||
    "kolorist",
 | 
			
		||||
    "Laba",
 | 
			
		||||
    "localforage",
 | 
			
		||||
    "LOCALSTORAGE",
 | 
			
		||||
    "majesticons",
 | 
			
		||||
    "MEDZ",
 | 
			
		||||
    "nocheck",
 | 
			
		||||
    "nprogress",
 | 
			
		||||
    "ofetch",
 | 
			
		||||
    "pickr",
 | 
			
		||||
    "preflights",
 | 
			
		||||
    "sider",
 | 
			
		||||
    "simonwep",
 | 
			
		||||
    "simplebar",
 | 
			
		||||
    "tada",
 | 
			
		||||
    "tauri",
 | 
			
		||||
    "Uncapitalize",
 | 
			
		||||
    "unocss",
 | 
			
		||||
    "unplugin",
 | 
			
		||||
    "VITE",
 | 
			
		||||
    "vitepress",
 | 
			
		||||
    "vueuse",
 | 
			
		||||
    "WEBSQL",
 | 
			
		||||
    "wechat"
 | 
			
		||||
  ],
 | 
			
		||||
  "editor.codeActionsOnSave": {
 | 
			
		||||
    "source.fixAll.eslint": true
 | 
			
		||||
    "source.fixAll.eslint": "explicit",
 | 
			
		||||
    "source.organizeImports": "never"
 | 
			
		||||
  },
 | 
			
		||||
  "editor.fontLigatures": true,
 | 
			
		||||
  "eslint.experimental.useFlatConfig": true,
 | 
			
		||||
  "editor.formatOnSave": false,
 | 
			
		||||
  "editor.quickSuggestions": {
 | 
			
		||||
    "strings": true
 | 
			
		||||
  },
 | 
			
		||||
  "editor.tabSize": 2,
 | 
			
		||||
  "files.associations": {
 | 
			
		||||
    "*.env.*": "dotenv",
 | 
			
		||||
    "*.svg": "html"
 | 
			
		||||
  },
 | 
			
		||||
  "files.eol": "\n",
 | 
			
		||||
  "eslint.validate": ["html", "css", "scss", "json", "jsonc"],
 | 
			
		||||
  "i18n-ally.displayLanguage": "zh-cn",
 | 
			
		||||
  "i18n-ally.enabledParsers": ["ts"],
 | 
			
		||||
  "i18n-ally.enabledFrameworks": ["vue"],
 | 
			
		||||
  "i18n-ally.editor.preferEditor": true,
 | 
			
		||||
  "i18n-ally.keystyle": "nested",
 | 
			
		||||
  "i18n-ally.localesPaths": ["src/locales/lang"],
 | 
			
		||||
  "unocss.root": ["./"],
 | 
			
		||||
  "[html][css][less][scss][sass][markdown][yaml][yml][json][jsonc]": {
 | 
			
		||||
    "editor.defaultFormatter": "esbenp.prettier-vscode",
 | 
			
		||||
    "editor.formatOnSave": true
 | 
			
		||||
  }
 | 
			
		||||
  "prettier.enable": false,
 | 
			
		||||
  "unocss.root": ["./"]
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								eslint.config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								eslint.config.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
import { defineConfig } from '@soybeanjs/eslint-config';
 | 
			
		||||
 | 
			
		||||
export default defineConfig(
 | 
			
		||||
  { vue: true },
 | 
			
		||||
  {
 | 
			
		||||
    rules: {
 | 
			
		||||
      'vue/multi-word-component-names': [
 | 
			
		||||
        'warn',
 | 
			
		||||
        {
 | 
			
		||||
          ignores: ['index', 'App', '[id]']
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
);
 | 
			
		||||
@@ -46,6 +46,7 @@
 | 
			
		||||
    "@iconify/json": "2.2.143",
 | 
			
		||||
    "@sa/scripts": "workspace:*",
 | 
			
		||||
    "@sa/uno-preset": "workspace:*",
 | 
			
		||||
    "@soybeanjs/eslint-config": "^1.1.2",
 | 
			
		||||
    "@types/lodash-es": "4.17.11",
 | 
			
		||||
    "@types/node": "20.9.1",
 | 
			
		||||
    "@types/nprogress": "0.2.3",
 | 
			
		||||
@@ -57,7 +58,6 @@
 | 
			
		||||
    "@vitejs/plugin-vue": "4.5.0",
 | 
			
		||||
    "@vitejs/plugin-vue-jsx": "3.1.0",
 | 
			
		||||
    "cross-env": "7.0.3",
 | 
			
		||||
    "eslint-config-sa": "workspace:*",
 | 
			
		||||
    "npm-run-all": "4.1.5",
 | 
			
		||||
    "sass": "1.69.5",
 | 
			
		||||
    "simple-git-hooks": "2.9.0",
 | 
			
		||||
@@ -72,6 +72,6 @@
 | 
			
		||||
  },
 | 
			
		||||
  "simple-git-hooks": {
 | 
			
		||||
    "commit-msg": "pnpm sa git-commit-verify",
 | 
			
		||||
    "pre-commit": "pnpm typecheck && pnpm sa lint-staged"
 | 
			
		||||
    "pre-commit": "pnpm typecheck"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @type {import('eslint').ESLint.ConfigData}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = {
 | 
			
		||||
  extends: [require.resolve('./ts.js'), require.resolve('./prettier.js')]
 | 
			
		||||
};
 | 
			
		||||
@@ -1,44 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @type {import('eslint').ESLint.ConfigData}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = {
 | 
			
		||||
  root: true,
 | 
			
		||||
  env: {
 | 
			
		||||
    browser: true,
 | 
			
		||||
    node: true,
 | 
			
		||||
    commonjs: true,
 | 
			
		||||
    es2024: true
 | 
			
		||||
  },
 | 
			
		||||
  parserOptions: {
 | 
			
		||||
    ecmaVersion: 2024,
 | 
			
		||||
    ecmaFeatures: {
 | 
			
		||||
      jsx: true
 | 
			
		||||
    },
 | 
			
		||||
    sourceType: 'module'
 | 
			
		||||
  },
 | 
			
		||||
  ignorePatterns: [
 | 
			
		||||
    'node_modules',
 | 
			
		||||
    '*.min.*',
 | 
			
		||||
    'CHANGELOG.md',
 | 
			
		||||
    'dist',
 | 
			
		||||
    'LICENSE*',
 | 
			
		||||
    'output',
 | 
			
		||||
    'coverage',
 | 
			
		||||
    'public',
 | 
			
		||||
    'temp',
 | 
			
		||||
    'package-lock.json',
 | 
			
		||||
    'pnpm-lock.yaml',
 | 
			
		||||
    'yarn.lock',
 | 
			
		||||
    '__snapshots__',
 | 
			
		||||
    '!.github',
 | 
			
		||||
    '!.vitepress',
 | 
			
		||||
    '!.vscode'
 | 
			
		||||
  ],
 | 
			
		||||
  plugins: ['n', 'promise'],
 | 
			
		||||
  extends: [require.resolve('../rules/all.js'), 'plugin:import/recommended'],
 | 
			
		||||
  rules: {
 | 
			
		||||
    // import
 | 
			
		||||
    'import/no-mutable-exports': 'error',
 | 
			
		||||
    'import/no-named-as-default': 'off'
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
const prettierRules = require('../rules/prettier');
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @type {import('eslint').ESLint.ConfigData}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = {
 | 
			
		||||
  extends: ['plugin:prettier/recommended'],
 | 
			
		||||
  rules: {
 | 
			
		||||
    'prettier/prettier': ['error', prettierRules]
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
@@ -1,61 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @type {import('eslint').ESLint.ConfigData}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = {
 | 
			
		||||
  plugins: ['@typescript-eslint'],
 | 
			
		||||
  extends: [require.resolve('./js.js'), 'plugin:import/typescript', 'plugin:@typescript-eslint/recommended'],
 | 
			
		||||
  settings: {
 | 
			
		||||
    'import/resolver': {
 | 
			
		||||
      typescript: {
 | 
			
		||||
        project: ['tsconfig.json', 'packages/*/tsconfig.json', 'examples/*/tsconfig.json', 'docs/*/tsconfig.json']
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  overrides: [
 | 
			
		||||
    {
 | 
			
		||||
      files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
 | 
			
		||||
      parser: '@typescript-eslint/parser'
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      files: ['*.js', '*.mjs', '*.cjs', '*.cts'],
 | 
			
		||||
      rules: {
 | 
			
		||||
        '@typescript-eslint/no-var-requires': 'off'
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  rules: {
 | 
			
		||||
    // TS
 | 
			
		||||
    '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports', disallowTypeAnnotations: false }],
 | 
			
		||||
    '@typescript-eslint/no-empty-interface': [
 | 
			
		||||
      'error',
 | 
			
		||||
      {
 | 
			
		||||
        allowSingleExtends: true
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    // Override JS
 | 
			
		||||
    'no-redeclare': 'off',
 | 
			
		||||
    '@typescript-eslint/no-redeclare': 'error',
 | 
			
		||||
    'no-unused-vars': 'off',
 | 
			
		||||
    '@typescript-eslint/no-unused-vars': [
 | 
			
		||||
      'error',
 | 
			
		||||
      {
 | 
			
		||||
        vars: 'all',
 | 
			
		||||
        args: 'all',
 | 
			
		||||
        ignoreRestSiblings: false,
 | 
			
		||||
        varsIgnorePattern: '^_',
 | 
			
		||||
        argsIgnorePattern: '^_'
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    'no-use-before-define': 'off',
 | 
			
		||||
    '@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false, variables: true }],
 | 
			
		||||
    'no-shadow': 'off',
 | 
			
		||||
    '@typescript-eslint/no-shadow': 'error',
 | 
			
		||||
 | 
			
		||||
    // off
 | 
			
		||||
    '@typescript-eslint/consistent-type-definitions': 'off',
 | 
			
		||||
    '@typescript-eslint/no-empty-function': 'off',
 | 
			
		||||
    '@typescript-eslint/no-explicit-any': 'off',
 | 
			
		||||
    '@typescript-eslint/no-non-null-assertion': 'off'
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
@@ -1,30 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @type {import('eslint').ESLint.ConfigData}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = {
 | 
			
		||||
  extends: ['plugin:vue/vue3-recommended', require.resolve('./base.js')],
 | 
			
		||||
  overrides: [
 | 
			
		||||
    {
 | 
			
		||||
      files: ['*.vue'],
 | 
			
		||||
      parser: 'vue-eslint-parser',
 | 
			
		||||
      parserOptions: {
 | 
			
		||||
        parser: {
 | 
			
		||||
          js: 'espree',
 | 
			
		||||
          jsx: 'espree',
 | 
			
		||||
          ts: '@typescript-eslint/parser',
 | 
			
		||||
          tsx: '@typescript-eslint/parser'
 | 
			
		||||
        },
 | 
			
		||||
        extraFileExtensions: ['.vue'],
 | 
			
		||||
        ecmaFeatures: {
 | 
			
		||||
          jsx: true
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      rules: {
 | 
			
		||||
        'no-undef': 'off' // TS will check un declared variables, if the script code is is in a .vue file, this rule should not disabled
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  rules: {
 | 
			
		||||
    'vue/multi-word-component-names': 'off'
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
const baseConfig = require('./configs/base');
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @type {import('eslint').ESLint.ConfigData}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = baseConfig;
 | 
			
		||||
@@ -1,23 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "eslint-config-sa",
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "description": "SoybeanAdmin's eslint config resets",
 | 
			
		||||
  "exports": {
 | 
			
		||||
    ".": "./index.js",
 | 
			
		||||
    "./vue": "./configs/vue.js"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/eslint": "8.44.7",
 | 
			
		||||
    "@typescript-eslint/eslint-plugin": "6.11.0",
 | 
			
		||||
    "@typescript-eslint/parser": "6.11.0",
 | 
			
		||||
    "eslint": "8.53.0",
 | 
			
		||||
    "eslint-config-prettier": "9.0.0",
 | 
			
		||||
    "eslint-import-resolver-typescript": "3.6.1",
 | 
			
		||||
    "eslint-plugin-import": "2.29.0",
 | 
			
		||||
    "eslint-plugin-n": "16.3.1",
 | 
			
		||||
    "eslint-plugin-prettier": "5.0.1",
 | 
			
		||||
    "eslint-plugin-promise": "6.1.1",
 | 
			
		||||
    "eslint-plugin-vue": "9.18.1",
 | 
			
		||||
    "prettier": "3.1.0"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,26 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @type {import('prettier').Options}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = {
 | 
			
		||||
  printWidth: 120,
 | 
			
		||||
  tabWidth: 2,
 | 
			
		||||
  useTabs: false,
 | 
			
		||||
  semi: true,
 | 
			
		||||
  singleQuote: true,
 | 
			
		||||
  quoteProps: 'as-needed',
 | 
			
		||||
  jsxSingleQuote: false,
 | 
			
		||||
  trailingComma: 'none',
 | 
			
		||||
  bracketSpacing: true,
 | 
			
		||||
  bracketSameLine: false,
 | 
			
		||||
  arrowParens: 'avoid',
 | 
			
		||||
  rangeStart: 0,
 | 
			
		||||
  rangeEnd: Number.POSITIVE_INFINITY,
 | 
			
		||||
  requirePragma: false,
 | 
			
		||||
  insertPragma: false,
 | 
			
		||||
  proseWrap: 'preserve',
 | 
			
		||||
  htmlWhitespaceSensitivity: 'ignore',
 | 
			
		||||
  vueIndentScriptAndStyle: false,
 | 
			
		||||
  endOfLine: 'lf',
 | 
			
		||||
  embeddedLanguageFormatting: 'auto',
 | 
			
		||||
  singleAttributePerLine: false
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										856
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										856
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user