eslint-config-jc 2.1.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.
package/README.md CHANGED
@@ -8,14 +8,43 @@ This is designed to be a replacement for `eslint:recommended`, `plugin:react-hoo
8
8
 
9
9
  It requires the following plugins:
10
10
 
11
- - `eslint-plugin-react-hooks`
12
- - `@typescript-eslint/eslint-plugin`
13
- - `eslint-plugin-import`
14
- - `eslint-plugin-jsx-a11y`
15
- - `eslint-plugin-react`
11
+ ```json
12
+ {
13
+ "devDependencies": {
14
+ "@typescript-eslint/eslint-plugin": "^5.10.2",
15
+ "@typescript-eslint/parser": "^5.10.2",
16
+ "eslint": "^8.8.0",
17
+ "eslint-plugin-header": "^3.1.1",
18
+ "eslint-plugin-import": "^2.25.3",
19
+ "eslint-plugin-jsx-a11y": "^6.5.1",
20
+ "eslint-plugin-react": "^7.27.0",
21
+ "eslint-plugin-react-hooks": "^4.3.0"
22
+ }
23
+ }
24
+ ```
16
25
 
17
26
  Although peer dependencies are evil, we can't self-install these plugins if the downstream user depends on a different version—the wrong one will be resolved.
18
27
 
28
+ ## Configuration
29
+
30
+ ESLint config:
31
+
32
+ ```json
33
+ {
34
+ "root": true,
35
+ "extends": ["jc"]
36
+ }
37
+ ```
38
+
39
+ Prettier config:
40
+
41
+ ```json
42
+ {
43
+ "bracketSameLine": true,
44
+ "trailingComma": "all"
45
+ }
46
+ ```
47
+
19
48
  ## Configuration philosophy
20
49
 
21
50
  When analyzing whether a rule should be `error`, `warn`, or `off`, the following assumptions are made:
@@ -51,3 +80,5 @@ A rule will _not_ be off solely because:
51
80
  - It enforces a practice concerning a construct that we never use in the first place
52
81
 
53
82
  Instead, in such case, we'd rather have multiple errors.
83
+
84
+ All rules are considered as `error` by default, unless there are enough justifications to turn it into a warning or turn it off, as outlined above.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-jc",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Josh-Cena's personal coding style",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -17,6 +17,15 @@
17
17
  "url": "https://github.com/jc-verse/eslint-config-jc/issues"
18
18
  },
19
19
  "homepage": "https://github.com/jc-verse/eslint-config-jc#readme",
20
+ "exports": {
21
+ ".": "./index.js",
22
+ "./base": "./rules/base.js",
23
+ "./import": "./rules/import.js",
24
+ "./jsx": "./rules/jsx.js",
25
+ "./react": "./rules/react.js",
26
+ "./typescript": "./rules/typescript.js",
27
+ "./typescript-typecheck": "./rules/typescript-typecheck.js"
28
+ },
20
29
  "peerDependencies": {
21
30
  "@typescript-eslint/eslint-plugin": "^5.10.2",
22
31
  "@typescript-eslint/parser": "^5.10.2",
package/rules/base.js CHANGED
@@ -5,8 +5,14 @@ module.exports = {
5
5
  node: true,
6
6
  },
7
7
  rules: {
8
- // Only warn if there's a set but not a get. Allows readonly members.
9
- "accessor-pairs": "warn",
8
+ "accessor-pairs": [
9
+ "error",
10
+ {
11
+ enforceForClassMembers: true,
12
+ getWithoutSet: true,
13
+ setWithoutGet: true,
14
+ },
15
+ ],
10
16
 
11
17
  "array-callback-return": [
12
18
  "error",
@@ -40,7 +46,7 @@ module.exports = {
40
46
 
41
47
  // Requires return statements to either always or never specify values.
42
48
  // TypeScript sometimes enforces this, but it can be stylistic as well.
43
- "consistent-return": "error",
49
+ "consistent-return": ["error", { treatUndefinedAsUnspecified: false }],
44
50
 
45
51
  // Enforces consistent naming when capturing the current execution context.
46
52
  // We warn against aliasing `this` altogether, but when we do, the name
@@ -64,22 +70,21 @@ module.exports = {
64
70
  "default-param-last": "off",
65
71
 
66
72
  // e.g. `foo.bar` instead of `foo["bar"]`
67
- "dot-notation": "error",
73
+ "dot-notation": ["error", { allowKeywords: true }],
68
74
 
69
- // Requires the use of === and !==.
70
- eqeqeq: "error",
75
+ eqeqeq: ["error", "always", { null: "ignore" }],
71
76
 
72
77
  "for-direction": "error",
73
78
 
74
79
  // We rarely use function expressions.
75
- "func-name-matching": "warn",
80
+ "func-name-matching": ["warn", "always"],
76
81
 
77
82
  // We rarely use function expressions.
78
83
  "func-names": "warn",
79
84
 
80
85
  "func-style": ["warn", "declaration", { allowArrowFunctions: true }],
81
86
 
82
- "getter-return": "error",
87
+ "getter-return": ["error", { allowImplicit: false }],
83
88
 
84
89
  // It's also common to have all getters in one place and setters in another.
85
90
  "grouped-accessor-pairs": "off",
package/rules/react.js CHANGED
@@ -149,9 +149,9 @@ module.exports = {
149
149
 
150
150
  "react/void-dom-elements-no-children": "error",
151
151
 
152
- 'react-hooks/exhaustive-deps': "error",
152
+ "react-hooks/exhaustive-deps": "error",
153
153
 
154
- 'react-hooks/rules-of-hooks': "error",
154
+ "react-hooks/rules-of-hooks": "error",
155
155
  },
156
156
  settings: {
157
157
  react: {