eslint-config-fe 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,23 @@
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ pull_request:
10
+ branches: [main]
11
+
12
+ jobs:
13
+ publish-npm:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ - uses: actions/setup-node@v3
18
+ with:
19
+ node-version: 14
20
+ registry-url: https://registry.npmjs.org/
21
+ - run: npm publish
22
+ env:
23
+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  ## Installation
11
11
 
12
12
  ```bash
13
- npm install --save-dev eslint @babel/core @babel/eslint-parser @babel/eslint-plugin eslint-config-fe
13
+ npm install --save-dev eslint eslint-config-fe
14
14
  ```
15
15
 
16
16
  ## Usage
@@ -27,30 +27,12 @@ npm install --save-dev eslint @babel/core @babel/eslint-parser @babel/eslint-plu
27
27
 
28
28
  [learn more](https://github.com/fengxinming/eslint-config-fe/blob/main/index.js)
29
29
 
30
- #### Less rules .eslintrc
31
-
32
- ```js
33
- {
34
- extends: ["fe/less"]
35
- }
36
- ```
37
-
38
- [learn more](https://github.com/fengxinming/eslint-config-fe/blob/main/less.js)
39
-
40
30
  ### React eslint config
41
31
 
42
32
  ```bash
43
33
  npm install --save-dev @babel/preset-react eslint-plugin-react eslint-plugin-react-hooks
44
34
  ```
45
35
 
46
- #### babel.config.js
47
-
48
- ```js
49
- module.exports = {
50
- presets: ['@babel/preset-react']
51
- };
52
- ```
53
-
54
36
  #### .eslintrc
55
37
 
56
38
  ```js
@@ -62,7 +44,7 @@ module.exports = {
62
44
  }
63
45
  ```
64
46
 
65
- [learn more](https://github.com/fengxinming/eslint-config-fe/blob/main/react/index.js)
47
+ [learn more](https://github.com/fengxinming/eslint-config-fe/blob/main/react.js)
66
48
 
67
49
  ### TS eslint config
68
50
 
@@ -81,4 +63,4 @@ npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugi
81
63
  }
82
64
  ```
83
65
 
84
- [learn more](https://github.com/fengxinming/eslint-config-fe/blob/main/ts/index.js)
66
+ [learn more](https://github.com/fengxinming/eslint-config-fe/blob/main/ts.js)
package/base.js CHANGED
@@ -9,7 +9,12 @@ module.exports = {
9
9
  ecmaFeatures: {
10
10
  jsx: true
11
11
  },
12
- requireConfigFile: false
12
+ requireConfigFile: false,
13
+ babelOptions: {
14
+ babelrc: false,
15
+ configFile: false,
16
+ presets: ['@babel/preset-env']
17
+ }
13
18
  },
14
19
  plugins: [
15
20
  '@babel'
@@ -29,4 +34,3 @@ module.exports = {
29
34
  }
30
35
  ]
31
36
  };
32
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-fe",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "ESLint config for Front End.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,22 +8,24 @@
8
8
  },
9
9
  "author": "Jesse Feng <fxm0016@126.com>",
10
10
  "license": "MIT",
11
+ "dependencies": {
12
+ "@babel/core": "^7.11.0",
13
+ "@babel/eslint-parser": "^7.11.0",
14
+ "@babel/eslint-plugin": "^7.11.0",
15
+ "@babel/preset-env": "^7.11.0",
16
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
17
+ "@typescript-eslint/parser": "^5.62.0",
18
+ "lodash": "^4.17.21"
19
+ },
11
20
  "devDependencies": {
12
- "@babel/core": "^7.14.0",
13
- "@babel/eslint-parser": "^7.13.14",
14
- "@babel/eslint-plugin": "^7.13.16",
15
- "@commitlint/cli": "^17.6.1",
16
- "@commitlint/config-conventional": "^17.6.1",
17
- "eslint": "^8.48.0",
18
- "husky": "^4.3.0",
19
- "lint-staged": "^13.2.1"
21
+ "eslint": "^8.0.0"
20
22
  },
21
23
  "peerDependencies": {
22
- "@babel/core": "^7.13.16",
23
- "@babel/eslint-parser": "^7.11.0",
24
- "@babel/eslint-plugin": "^7.11.0",
25
24
  "eslint": ">=6.2.0"
26
25
  },
26
+ "engines": {
27
+ "node": "^14.18.0 || >=16.0.0"
28
+ },
27
29
  "repository": {
28
30
  "type": "git",
29
31
  "url": "git+https://github.com/fengxinming/eslint-config-fe.git"
@@ -37,16 +39,5 @@
37
39
  "bugs": {
38
40
  "url": "https://github.com/fengxinming/eslint-config-fe/issues"
39
41
  },
40
- "homepage": "https://github.com/fengxinming/eslint-config-fe#readme",
41
- "husky": {
42
- "hooks": {
43
- "pre-commit": "lint-staged"
44
- }
45
- },
46
- "lint-staged": {
47
- "*.js": [
48
- "eslint --fix",
49
- "git add"
50
- ]
51
- }
42
+ "homepage": "https://github.com/fengxinming/eslint-config-fe#readme"
52
43
  }
package/react.js CHANGED
@@ -2,7 +2,15 @@ module.exports = {
2
2
  extends: [
3
3
  './rules/react'
4
4
  ].map(require.resolve),
5
- plugins: ['react', 'react-hooks'],
5
+ plugins: [
6
+ 'react',
7
+ 'react-hooks'
8
+ ],
9
+ parserOptions: {
10
+ babelOptions: {
11
+ presets: ['@babel/preset-react']
12
+ }
13
+ },
6
14
  settings: {
7
15
  react: {
8
16
  version: 'detect'
@@ -1,10 +1,10 @@
1
1
  module.exports = {
2
2
  rules: {
3
3
  /**
4
- * 限制构造函数首字母大写
5
- *
6
- * https://eslint.org/docs/rules/new-cap
7
- */
4
+ * 限制构造函数首字母大写
5
+ *
6
+ * https://eslint.org/docs/rules/new-cap
7
+ */
8
8
  '@babel/new-cap': [
9
9
  'error',
10
10
  {
@@ -16,19 +16,18 @@ module.exports = {
16
16
  ],
17
17
 
18
18
  /**
19
- * 限制在花括号中使用一致的空格
20
- *
21
- * https://eslint.org/docs/rules/object-curly-spacing
22
- */
19
+ * 限制在花括号中使用一致的空格
20
+ *
21
+ * https://eslint.org/docs/rules/object-curly-spacing
22
+ */
23
23
  '@babel/object-curly-spacing': ['error', 'always'],
24
24
 
25
25
  /**
26
- * 限制语句末尾使用分号
27
- * 默认选项为 'always'
28
- *
29
- * https://eslint.org/docs/rules/semi
30
- */
26
+ * 限制语句末尾使用分号
27
+ * 默认选项为 'always'
28
+ *
29
+ * https://eslint.org/docs/rules/semi
30
+ */
31
31
  '@babel/semi': 'error'
32
32
  }
33
33
  };
34
-
@@ -1,10 +1,10 @@
1
1
  module.exports = {
2
2
  rules: {
3
3
  /**
4
- * 限制构造函数首字母大写
5
- *
6
- * https://eslint.org/docs/rules/new-cap
7
- */
4
+ * 限制构造函数首字母大写
5
+ *
6
+ * https://eslint.org/docs/rules/new-cap
7
+ */
8
8
  'new-cap': [
9
9
  'error',
10
10
  {
@@ -16,19 +16,18 @@ module.exports = {
16
16
  ],
17
17
 
18
18
  /**
19
- * 限制在花括号中使用一致的空格
20
- *
21
- * https://eslint.org/docs/rules/object-curly-spacing
22
- */
19
+ * 限制在花括号中使用一致的空格
20
+ *
21
+ * https://eslint.org/docs/rules/object-curly-spacing
22
+ */
23
23
  'object-curly-spacing': ['error', 'always'],
24
24
 
25
25
  /**
26
- * 限制语句末尾使用分号
27
- * 默认选项为 'always'
28
- *
29
- * https://eslint.org/docs/rules/semi
30
- */
26
+ * 限制语句末尾使用分号
27
+ * 默认选项为 'always'
28
+ *
29
+ * https://eslint.org/docs/rules/semi
30
+ */
31
31
  semi: 'error'
32
32
  }
33
33
  };
34
-