@tim-code/eslint-config 0.8.1 → 1.1.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/.eslintrc.js CHANGED
@@ -36,12 +36,21 @@ module.exports = {
36
36
  "import/no-named-as-default-member": "off",
37
37
  "import/no-named-as-default": "off",
38
38
 
39
+ // functions that return JSX seem to trigger this but the functions aren't necessarily components themselves
40
+ "react/display-name": "off",
41
+ // much easier to read some punctuation such as " and ' versus the escaped forms " and '
42
+ "react/no-unescaped-entities": "off",
43
+ // prop types is not necessary
44
+ "react/prop-types": "off",
45
+ // requiring React is no longer necessary
46
+ "react/react-in-jsx-scope": "off",
47
+
39
48
  // null should be avoided entirely if possible
40
49
  "no-restricted-syntax": [
41
50
  "error",
42
51
  {
43
52
  selector:
44
- ":not(BinaryExpression:matches([operator='!=='], [operator='==='])) > Literal[value=null]",
53
+ ":not(BinaryExpression:matches([operator='!=='],[operator='===']), CallExpression[callee.object.name='Object'][callee.property.name='create']) > Literal[value=null]",
45
54
  message:
46
55
  'Usage of "null" is discouraged except when used because of legacy APIs; use "undefined" instead',
47
56
  },
@@ -56,11 +65,13 @@ module.exports = {
56
65
  "func-style": ["error", "declaration", { allowArrowFunctions: true }],
57
66
  // matches default IDE shortcut for multiline comments
58
67
  "multiline-comment-style": ["error", "separate-lines"],
59
- // errors need to be logged somehow
60
- "no-console": ["error", { allow: ["error"] }],
61
68
  // default is 50 lines which is sometimes limiting with Prettier's formatting (parameter destructuring can take up 10 lines for example)
62
69
  // adding comments or blanks should not trigger this warning
63
- "max-lines-per-function": ["error", { max: 75, skipBlankLines: true, skipComments: true }],
70
+ // doubled from 75 to allow almost all usages in pluto where it was commonly disabled
71
+ "max-lines-per-function": [
72
+ "error",
73
+ { max: 150, skipBlankLines: true, skipComments: true },
74
+ ],
64
75
  // allow mix of reassigned and const variables
65
76
  "prefer-const": ["error", { destructuring: "all" }],
66
77
  // never allow "yoda" conditions except for range
@@ -68,7 +79,7 @@ module.exports = {
68
79
  // unclear why assignment expressions cannot be used
69
80
  "prefer-destructuring": ["error", { AssignmentExpression: { array: false } }],
70
81
  // 300 lines is too low
71
- "max-lines": ["error", { max: 500 }],
82
+ "max-lines": ["error", { max: 600 }],
72
83
 
73
84
  // unsure
74
85
  "no-labels": "off", // useful to be able to break/continue an outer loop; otherwise have to write more code
@@ -103,5 +114,10 @@ module.exports = {
103
114
  "no-loop-func": "off", // this is only a concern with var declarations
104
115
  "max-classes-per-file": "off", // one class per file discourages small classes
105
116
  "lines-between-class-members": "off", // discourages smaller classes
117
+ "guard-for-in": "off", // warning about language feature; reasons to avoid it are too theoretical: works fine in nearly all cases
118
+
119
+ // disabled too often
120
+ "no-console": "off", // console error was already allowed; when is console.log actually bad?
121
+ "no-await-in-loop": "off", // warning about language feature, unavoidable
106
122
  },
107
123
  }
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # eslint-config
2
2
 
3
- `npm install @tim-code/eslint-config`
3
+ `npm install --save-dev @tim-code/eslint-config`
4
4
 
5
5
  Then in package.json:
6
6
 
@@ -16,8 +16,7 @@ Then in package.json:
16
16
 
17
17
  This assumes that code can use Node globals unless it is in a `frontend` directory. See below to change this.
18
18
 
19
- Note that `root` and `ignorePatterns` are not required but `root` is useful to prevent ESLint from searching for more config files
20
- and `ignorePatterns` is often useful to ignore files.
19
+ Note that `root` and `ignorePatterns` are not required but `root` is useful to prevent ESLint from searching for more config files and `ignorePatterns` is often eventually needed to ignore files such as a build directory.
21
20
 
22
21
  ## React
23
22
 
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@tim-code/eslint-config",
3
- "version": "0.8.1",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "main": ".eslintrc.js",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "eslint-config-prettier": ">= 8"
9
+ "eslint-config-prettier": ">= 9"
10
10
  },
11
11
  "peerDependencies": {
12
- "eslint": ">= 7",
12
+ "eslint": ">= 8",
13
13
  "eslint-plugin-import": ">= 2"
14
14
  },
15
15
  "publishConfig": {