@jchiam/eslint-config 3.0.0 → 4.0.0

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.
package/README.md CHANGED
@@ -13,9 +13,37 @@ npm i -D @jchiam/eslint-config
13
13
  Add `.eslintrc` to project.
14
14
  ```javascript
15
15
  {
16
- "extends": "@jchiam/eslint-config",
16
+ "extends": [
17
+ "@jchiam/eslint-config/recommended",
18
+ "@jchiam/eslint-config/react"
19
+ ]
17
20
  "rules": {}
18
21
  }
19
22
  ```
20
23
 
21
24
  Override rules as needed in local `.eslintrc`.
25
+
26
+ ## Breaking Changes
27
+
28
+ ### v3 to v4
29
+
30
+ The original config file has been split from `index.js` to `recommended.js` and `react.js`. Extending both config files is equivalent to the original usage. This was done to allow for non-React projects to extend only the base config file to avoid any React-related warnings from ESLint.
31
+
32
+ From:
33
+ ```javascript
34
+ {
35
+ "extends": "@jchiam",
36
+ "rules": {}
37
+ }
38
+ ```
39
+
40
+ To:
41
+ ```javascript
42
+ {
43
+ "extends": [
44
+ "@jchiam/eslint-config/recommended",
45
+ "@jchiam/eslint-config/react"
46
+ ]
47
+ "rules": {}
48
+ }
49
+ ```
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@jchiam/eslint-config",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "my personal ESLint rules",
5
- "main": "index.js",
5
+ "main": "recommended.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
@@ -12,15 +12,15 @@
12
12
  },
13
13
  "author": "Jonathan Chiam",
14
14
  "peerDependencies": {
15
- "@typescript-eslint/eslint-plugin": "~5.0.0",
16
- "eslint-plugin-import": "~2.25.0",
17
- "eslint-plugin-jest": "~24.3.0",
18
- "eslint-plugin-react": "~7.27.0",
19
- "eslint-plugin-react-hooks": "~4.3.0"
15
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
16
+ "eslint-plugin-import": "^2.0.0",
17
+ "eslint-plugin-jest": "^26.0.0",
18
+ "eslint-plugin-react": "^7.0.0",
19
+ "eslint-plugin-react-hooks": "^4.0.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@typescript-eslint/parser": "^5.5.0",
23
- "eslint": "^8.4.0",
24
- "typescript": "^4.5.2"
22
+ "@typescript-eslint/parser": "^5.33.1",
23
+ "eslint": "^8.22.0",
24
+ "typescript": "^4.7.4"
25
25
  }
26
26
  }
package/react.js ADDED
@@ -0,0 +1,36 @@
1
+ module.exports = {
2
+ "parser": "@typescript-eslint/parser",
3
+ "extends": [
4
+ "plugin:react/recommended",
5
+ "plugin:import/react",
6
+ ],
7
+ "plugins": ["react-hooks"],
8
+ "env": {
9
+ "es6": true,
10
+ "node": true,
11
+ "browser": true
12
+ },
13
+ "parserOptions": {
14
+ "ecmaVersion": 2018,
15
+ "ecmaFeatures": {
16
+ "jsx": true
17
+ }
18
+ },
19
+ "rules": {
20
+ "react/prop-types": "off",
21
+ "react-hooks/rules-of-hooks": "error",
22
+ "react-hooks/exhaustive-deps": "warn",
23
+ "jsx-quotes": "error"
24
+ },
25
+ "settings": {
26
+ "import/resolver": {
27
+ "node": {
28
+ "extensions": [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
29
+ "moduleDirectory": ["node_modules", "src"]
30
+ }
31
+ },
32
+ "react": {
33
+ "version": "detect"
34
+ }
35
+ }
36
+ };
@@ -1,33 +1,24 @@
1
1
  module.exports = {
2
2
  "parser": "@typescript-eslint/parser",
3
3
  "extends": [
4
- "plugin:react/recommended",
5
4
  "eslint:recommended",
6
- "plugin:import/react",
7
- "plugin:import/errors",
8
- "plugin:import/warnings",
5
+ "plugin:import/recommended",
6
+ "plugin:import/typescript",
9
7
  "plugin:@typescript-eslint/recommended"
10
8
  ],
11
- "plugins": ["react-hooks"],
12
9
  "env": {
13
10
  "es6": true,
14
11
  "node": true,
15
12
  "browser": true
16
13
  },
17
14
  "parserOptions": {
18
- "ecmaVersion": 2018,
19
- "ecmaFeatures": {
20
- "jsx": true
21
- }
15
+ "ecmaVersion": 2018
22
16
  },
23
17
  "rules": {
24
- "react/prop-types": "off",
25
18
  "@typescript-eslint/array-type": ["error", { "default": "generic" }],
26
19
  "@typescript-eslint/explicit-function-return-type": "off",
27
20
  "@typescript-eslint/indent": ["error", 2, { "SwitchCase": 1 }],
28
21
  "@typescript-eslint/no-explicit-any": "off",
29
- "react-hooks/rules-of-hooks": "error",
30
- "react-hooks/exhaustive-deps": "warn",
31
22
  "eqeqeq": ["error", "smart"],
32
23
  "no-else-return": "warn",
33
24
  "no-multi-spaces": ["error", { "ignoreEOLComments": true }],
@@ -46,7 +37,6 @@ module.exports = {
46
37
  "func-call-spacing": "error",
47
38
  "func-style": ["error", "declaration", { "allowArrowFunctions": true }],
48
39
  "indent": ["error", 2, { "SwitchCase": 1 }],
49
- "jsx-quotes": "error",
50
40
  "key-spacing": "error",
51
41
  "keyword-spacing": "error",
52
42
  "lines-around-comment": ["error", { "beforeBlockComment": true, "allowBlockStart": true }],
@@ -94,12 +84,9 @@ module.exports = {
94
84
  "settings": {
95
85
  "import/resolver": {
96
86
  "node": {
97
- "extensions": [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
87
+ "extensions": [".js", ".ts", ".d.ts"],
98
88
  "moduleDirectory": ["node_modules", "src"]
99
89
  }
100
- },
101
- "react": {
102
- "version": "detect"
103
90
  }
104
91
  }
105
92
  };