Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

babel-eslint升级 #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": ["@babel/preset-react"],
"plugins": ["@babel/plugin-proposal-class-properties",
["@babel/plugin-proposal-decorators",
{
"legacy": true
}]
]
}
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![npm version](https://badge.fury.io/js/eslint-config-za.svg)](https://www.npmjs.com/package/eslint-config-za)

众安 **ESLint** 规则
众安 **ESLint** 规则
基于[airbnb](https://github.com/airbnb/javascript)的 ESLint 规则,进行二次定制。


Expand All @@ -11,7 +11,7 @@
### JavaScrip

```
npm install --save-dev eslint babel-eslint eslint-plugin-babel eslint-plugin-import eslint-config-za
npm install --save-dev eslint @babel/eslint-parser eslint-plugin-babel eslint-plugin-import eslint-config-za
```

```json
Expand All @@ -25,7 +25,7 @@ npm install --save-dev eslint babel-eslint eslint-plugin-babel eslint-plugin-imp
### React

```
npm install --save-dev eslint babel-eslint eslint-plugin-babel eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y eslint-config-za
npm install --save-dev eslint @babel/eslint-parser eslint-plugin-babel eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y eslint-config-za
```

```json
Expand All @@ -39,7 +39,7 @@ npm install --save-dev eslint babel-eslint eslint-plugin-babel eslint-plugin-imp
### Vue

```
npm install --save-dev eslint babel-eslint eslint-plugin-babel eslint-plugin-import eslint-plugin-vue eslint-config-za
npm install --save-dev eslint @babel/eslint-parser eslint-plugin-babel eslint-plugin-import eslint-plugin-vue eslint-config-za
```

```json
Expand Down Expand Up @@ -82,7 +82,7 @@ VSCode 的 ESLint 插件默认并不支持 `vue` `ts` `tsx`,需要自行修改

## 提示

**eslint-config-za** 定义了相应的 `peerDependencies`。因此选择不同规则时需要自行安装对应的依赖。具体参考[使用](#使用)说明。
**eslint-config-za** 定义了相应的 `peerDependencies`。因此选择不同规则时需要自行安装对应的依赖。具体参考[使用](#使用)说明。

```
npm info "eslint-config-za@latest" peerDependencies
Expand All @@ -94,9 +94,9 @@ npx install-peerdeps --dev eslint-config-za
> npx eslint --print-config .eslintrc > /path/you/file

## 规则链接
[eslint](https://github.com/eslint/eslint/tree/master/docs/rules)
[import](https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules)
[jsx-a11y](https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules)
[react](https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules)
[react-hooks](https://reactjs.org/docs/hooks-rules.html)
[typescript](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/docs/rules)
[eslint](https://github.com/eslint/eslint/tree/master/docs/rules)
[import](https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules)
[jsx-a11y](https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules)
[react](https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules)
[react-hooks](https://reactjs.org/docs/hooks-rules.html)
[typescript](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/docs/rules)
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ module.exports = {
'./rules/es',
'./rules/import',
].map(require.resolve),
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
};
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-za",
"version": "2.3.1",
"version": "2.3.2",
"description": "ZhongAn's ESLint config",
"main": "index.js",
"config": {
Expand Down Expand Up @@ -33,9 +33,12 @@
"eslint-config-airbnb": "^18.2.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.12.1",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.12",
"@babel/preset-react": "^7.12.10",
"@typescript-eslint/eslint-plugin": "^4.9.0",
"@typescript-eslint/parser": "^4.9.0",
"babel-eslint": "^10.0.1",
"conventional-changelog-cli": "^2.0.25",
"eslint": "^7.2.0",
"eslint-plugin-babel": "^5.3.0",
Expand All @@ -51,7 +54,10 @@
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^4.9.0",
"@typescript-eslint/parser": "^4.9.0",
"babel-eslint": "^10.0.1",
"@babel/eslint-parser": "^7.12.1",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.12",
"@babel/preset-react": "^7.12.10",
"eslint": "^5.16.0 || ^6.8.0 || ^7.2.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.22.1",
Expand Down
2 changes: 1 addition & 1 deletion react.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.exports = {
'./rules/jsx-a11y',
'./rules/react',
].map(require.resolve),
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
};
2 changes: 1 addition & 1 deletion vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ module.exports = {
].map(require.resolve),
parser: 'vue-eslint-parser',
parserOptions: {
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
},
};