Skip to content

Commit

Permalink
fix(eslint-config-ali): remove vue stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyunhe committed Jan 2, 2025
1 parent b32a9ff commit c26770b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 32 deletions.
13 changes: 0 additions & 13 deletions packages/eslint-config-ali/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ import { react } from 'eslint-config-ali';
export default [...react];
```

### Vue JavaScript/TypeScript 项目

针对 JS Vue 的项目,继承了默认配置,并启用了 [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue) 插件的规则,使用 [vue-eslint-parser](https://www.npmjs.com/package/vue-eslint-parser) 作为 parser。

ESLint 配置:

```js
// eslint.config.mjs
import { vue } from 'eslint-config-ali';

export default [...vue];
```

## 了解更多

- 如果你对 ESLint 还不熟悉,可以阅读官网的 [Getting Started](https://eslint.org/docs/user-guide/getting-started) 快速入门。
Expand Down
4 changes: 1 addition & 3 deletions packages/eslint-config-ali/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,8 @@
"@stylistic/eslint-plugin": "^2.12.1",
"eslint-plugin-react": "^7.37.3",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-vue": "^9.32.0",
"globals": "^15.14.0",
"typescript-eslint": "^8.19.0",
"vue-eslint-parser": "^9.4.3"
"typescript-eslint": "^8.19.0"
},
"devDependencies": {
"@mdx-js/react": "^3.1.0",
Expand Down
5 changes: 1 addition & 4 deletions packages/eslint-config-ali/src/configs/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@ export default defineConfig({
'react/no-access-state-in-setstate': 'error',

// 指定 React 组件的文件扩展名
'react/jsx-filename-extension': [
'error',
{ extensions: ['.jsx', '.js', '.tsx', '.ts', '.vue'] },
],
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.js', '.tsx', '.ts'] }],

// JSX 语句的文本节点中不要使用注释字符串(例如,以//或/ *开头)
'react/jsx-no-comment-textnodes': 'error',
Expand Down
3 changes: 1 addition & 2 deletions packages/eslint-config-ali/src/configs/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ts from 'typescript-eslint';
/** TypeScript */
const typescript = ts.config({
name: 'ali/typescripts',
files: ['**/*.{cts,mts,ts,tsx,vue}'],
files: ['**/*.{cts,mts,ts,tsx}'],
extends: [ts.configs.recommendedTypeChecked],
languageOptions: {
parserOptions: {
Expand All @@ -15,7 +15,6 @@ const typescript = ts.config({
globalReturn: true,
},
ecmaVersion: 'latest',
extraFileExtensions: ['.vue'],
},
},
rules: {
Expand Down
17 changes: 7 additions & 10 deletions packages/f2elint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,31 @@ npx f2elint

多包项目和前后端分离项目经常采用 monorepo 的项目代码管理模式,即一个 git 仓库中包含多个不同类型的应用,无法使用同一套规约。这种情况下,我们建议:

1. 在仓库根目录运行 `npx f2elint` 并选择 `Base (JavaScript)``Base (TypeScript)` 模板
1. 在仓库根目录运行 `npx f2elint` 并选择 `Base` 模板
2. 切换到子应用/子包目录并运行 `npx f2elint` 并选择适合的模板,f2elint 会自动检测子应用/子包,并跳过 lint-staged 和 commitlint

示例 1:前后端分离应用

```bash
npx f2elint # 选择 Base (JavaScript) 模板
npx f2elint # 选择 Base 模板

cd client
npx f2elint # 选择 React (TypeScript) 模板
npx f2elint # 选择 React 模板

cd ../server
npx f2elint # 选择 Node (TypeScript) 模板
npx f2elint # 选择 Base 模板
```

示例 2:多包项目

```bash
npx f2elint # 选择 Base (JavaScript) 模板
npx f2elint # 选择 Base 模板

cd packages/cli
npx f2elint # 选择 Node (TypeScript) 模板
npx f2elint # 选择 Base 模板

cd ../react
npx f2elint # 选择 React (TypeScript) 模板

cd ../vue
npx f2elint # 选择 Vue (TypeScript) 模板
npx f2elint # 选择 React 模板
```

## API
Expand Down

0 comments on commit c26770b

Please sign in to comment.