@prowise/eslint-config-linting-rules 0.0.14 → 1.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/index.js
CHANGED
|
@@ -13,7 +13,6 @@ module.exports = {
|
|
|
13
13
|
"eslint-plugin-prefer-arrow",
|
|
14
14
|
"eslint-plugin-jest",
|
|
15
15
|
"eslint-plugin-jsdoc",
|
|
16
|
-
"eslint-plugin-prettier",
|
|
17
16
|
],
|
|
18
17
|
|
|
19
18
|
parserOptions: {
|
|
@@ -39,14 +38,5 @@ module.exports = {
|
|
|
39
38
|
"jest/no-identical-title": "error",
|
|
40
39
|
"jest/prefer-to-have-length": "warn",
|
|
41
40
|
"jest/valid-expect": "error",
|
|
42
|
-
"prettier/prettier": [
|
|
43
|
-
"error",
|
|
44
|
-
{
|
|
45
|
-
singleQuote: false,
|
|
46
|
-
tabWidth: 4,
|
|
47
|
-
printWidth: 120,
|
|
48
|
-
trailingComma: "all",
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
41
|
},
|
|
52
42
|
};
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@prowise/eslint-config-linting-rules","version":"0.0
|
|
1
|
+
{"name":"@prowise/eslint-config-linting-rules","version":"1.0.0","description":"Default Prowise linting rules for npm packages.","main":"index.js","exports":{"./typescript":"./typescript.js","./backend":"./backend.js","./frontend":"./frontend.js"},"scripts":{"lint":"eslint **/*.js"},"repository":{"type":"git","url":"git+ssh://git@bitbucket.org/prowise/npm-linting-rules.git"},"author":"Prowise B.V.","license":"UNLICENSED","homepage":"https://bitbucket.org/prowise/npm-linting-rules#readme","dependencies":{"@typescript-eslint/eslint-plugin":"^5.36.2","@typescript-eslint/parser":"^5.36.2","confusing-browser-globals":"^1.0.11","eslint":"^8.24.0","eslint-import-resolver-typescript":"^3.5.1","eslint-plugin-import":"^2.26.0","eslint-plugin-jest":"^27.0.1","eslint-plugin-jsdoc":"^39.3.6","eslint-plugin-node":"^11.1.0","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-react":"^7.31.7","eslint-plugin-react-hooks":"^4.6.0","object.assign":"^4.1.4"}}
|
package/src/rules/base-rules.js
CHANGED
|
@@ -44,7 +44,7 @@ module.exports = {
|
|
|
44
44
|
* Disallow await inside of loops
|
|
45
45
|
* https://eslint.org/docs/latest/rules/no-await-in-loop.
|
|
46
46
|
*/
|
|
47
|
-
"no-await-in-loop": "
|
|
47
|
+
"no-await-in-loop": "off",
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Disallow modifying variables of class declarations ✅
|
|
@@ -326,7 +326,7 @@ module.exports = {
|
|
|
326
326
|
* Disallow use of variables before they are defined
|
|
327
327
|
* https://eslint.org/docs/latest/rules/no-use-before-define.
|
|
328
328
|
*/
|
|
329
|
-
"no-use-before-define": ["error", { functions: true, classes: true, variables: true }],
|
|
329
|
+
"no-use-before-define": ["error", { functions: true, classes: true, variables: true, allowNamedExports: true }],
|
|
330
330
|
|
|
331
331
|
/**
|
|
332
332
|
* Disallow useless backreferences in regular expressions ✅
|
|
@@ -364,9 +364,8 @@ module.exports = {
|
|
|
364
364
|
/**
|
|
365
365
|
* Enforces no braces where they can be omitted 🔧
|
|
366
366
|
* https://eslint.org/docs/latest/rules/arrow-body-style.
|
|
367
|
-
* Turned off => conflicting with the prettier rules.
|
|
368
367
|
*/
|
|
369
|
-
"arrow-body-style": "
|
|
368
|
+
"arrow-body-style": ["error", "as-needed", { requireReturnForObjectLiteral: false }],
|
|
370
369
|
|
|
371
370
|
/**
|
|
372
371
|
* Treat var statements as if they were block scoped
|
|
@@ -429,13 +428,13 @@ module.exports = {
|
|
|
429
428
|
* Specify curly brace conventions for all control statements 🔧
|
|
430
429
|
* https://eslint.org/docs/latest/rules/curly.
|
|
431
430
|
*/
|
|
432
|
-
curly: ["error", "multi
|
|
431
|
+
curly: ["error", "multi", "consistent"],
|
|
433
432
|
|
|
434
433
|
/**
|
|
435
434
|
* Require default case in switch statements
|
|
436
435
|
* https://eslint.org/docs/latest/rules/default-case.
|
|
437
436
|
*/
|
|
438
|
-
"default-case": ["error", { commentPattern: "^no
|
|
437
|
+
"default-case": ["error", { commentPattern: "^no-default$" }],
|
|
439
438
|
|
|
440
439
|
/**
|
|
441
440
|
* Enforce default clauses in switch statements to be last
|
|
@@ -475,7 +474,7 @@ module.exports = {
|
|
|
475
474
|
* Require function expressions to have a name
|
|
476
475
|
* https://eslint.org/docs/latest/rules/func-names.
|
|
477
476
|
*/
|
|
478
|
-
"func-names": "
|
|
477
|
+
"func-names": "off",
|
|
479
478
|
|
|
480
479
|
/**
|
|
481
480
|
* Enforces use of function declarations
|
|
@@ -625,9 +624,8 @@ module.exports = {
|
|
|
625
624
|
/**
|
|
626
625
|
* Disallow arrow functions where they could be confused with comparisons 🔧
|
|
627
626
|
* https://eslint.org/docs/latest/rules/no-confusing-arrow.
|
|
628
|
-
* Turned off => conflicting with the prettier rules.
|
|
629
627
|
*/
|
|
630
|
-
"no-confusing-arrow": "
|
|
628
|
+
"no-confusing-arrow": "warn",
|
|
631
629
|
|
|
632
630
|
/**
|
|
633
631
|
* Disallow use of console
|
|
@@ -639,7 +637,7 @@ module.exports = {
|
|
|
639
637
|
* Disallow use of the continue statement
|
|
640
638
|
* https://eslint.org/docs/latest/rules/no-continue.
|
|
641
639
|
*/
|
|
642
|
-
"no-continue": "
|
|
640
|
+
"no-continue": "warn",
|
|
643
641
|
|
|
644
642
|
/**
|
|
645
643
|
* Disallow deletion of variables ✅
|
|
@@ -863,7 +861,6 @@ module.exports = {
|
|
|
863
861
|
/**
|
|
864
862
|
* Disallow nested ternary expressions
|
|
865
863
|
* https://eslint.org/docs/latest/rules/no-nested-ternary.
|
|
866
|
-
* Turned off => conflicting with the prettier rules.
|
|
867
864
|
*/
|
|
868
865
|
"no-nested-ternary": "off",
|
|
869
866
|
|
|
@@ -919,7 +916,7 @@ module.exports = {
|
|
|
919
916
|
* Disallow use of unary operators, ++ and --
|
|
920
917
|
* https://eslint.org/docs/latest/rules/no-plusplus.
|
|
921
918
|
*/
|
|
922
|
-
"no-plusplus": "
|
|
919
|
+
"no-plusplus": "off",
|
|
923
920
|
|
|
924
921
|
/**
|
|
925
922
|
* Disallow usage of __proto__ property
|
|
@@ -1053,7 +1050,7 @@ module.exports = {
|
|
|
1053
1050
|
* Disallow use of assignment in return statement
|
|
1054
1051
|
* https://eslint.org/docs/latest/rules/no-return-assign.
|
|
1055
1052
|
*/
|
|
1056
|
-
"no-return-assign":
|
|
1053
|
+
"no-return-assign": "off",
|
|
1057
1054
|
|
|
1058
1055
|
/**
|
|
1059
1056
|
* Disallow redundant `return await`
|
|
@@ -1114,7 +1111,7 @@ module.exports = {
|
|
|
1114
1111
|
* https://eslint.org/docs/latest/rules/no-underscore-dangle.
|
|
1115
1112
|
*/
|
|
1116
1113
|
"no-underscore-dangle": [
|
|
1117
|
-
"
|
|
1114
|
+
"off",
|
|
1118
1115
|
{
|
|
1119
1116
|
allow: [],
|
|
1120
1117
|
allowAfterThis: true,
|
|
@@ -1138,8 +1135,8 @@ module.exports = {
|
|
|
1138
1135
|
"no-unused-expressions": [
|
|
1139
1136
|
"error",
|
|
1140
1137
|
{
|
|
1141
|
-
allowShortCircuit:
|
|
1142
|
-
allowTernary:
|
|
1138
|
+
allowShortCircuit: true,
|
|
1139
|
+
allowTernary: true,
|
|
1143
1140
|
allowTaggedTemplates: false,
|
|
1144
1141
|
},
|
|
1145
1142
|
],
|
|
@@ -1154,7 +1151,7 @@ module.exports = {
|
|
|
1154
1151
|
* Disallow unnecessary .call() and .apply()
|
|
1155
1152
|
* https://eslint.org/docs/latest/rules/no-useless-call.
|
|
1156
1153
|
*/
|
|
1157
|
-
"no-useless-call": "
|
|
1154
|
+
"no-useless-call": "warn",
|
|
1158
1155
|
|
|
1159
1156
|
/**
|
|
1160
1157
|
* Disallow unnecessary catch clauses ✅
|
|
@@ -1256,9 +1253,8 @@ module.exports = {
|
|
|
1256
1253
|
/**
|
|
1257
1254
|
* Suggest using arrow functions as callbacks 🔧
|
|
1258
1255
|
* https://eslint.org/docs/latest/rules/prefer-arrow-callback.
|
|
1259
|
-
* Turned off => conflicting with the prettier rules.
|
|
1260
1256
|
*/
|
|
1261
|
-
"prefer-arrow-callback": "
|
|
1257
|
+
"prefer-arrow-callback": "warn",
|
|
1262
1258
|
|
|
1263
1259
|
/**
|
|
1264
1260
|
* Suggest using of const declaration for variables that are never modified after declared 🔧
|
|
@@ -1274,7 +1270,7 @@ module.exports = {
|
|
|
1274
1270
|
"error",
|
|
1275
1271
|
{
|
|
1276
1272
|
VariableDeclarator: { array: false, object: true },
|
|
1277
|
-
AssignmentExpression: { array:
|
|
1273
|
+
AssignmentExpression: { array: false, object: false },
|
|
1278
1274
|
},
|
|
1279
1275
|
{
|
|
1280
1276
|
enforceForRenamedProperties: false,
|
|
@@ -1543,7 +1539,6 @@ module.exports = {
|
|
|
1543
1539
|
/**
|
|
1544
1540
|
* Require line breaks inside function parentheses if there are line breaks between parameters. 🔧
|
|
1545
1541
|
* https://eslint.org/docs/latest/rules/function-paren-newline.
|
|
1546
|
-
* Turned off => conflicting with the prettier rules.
|
|
1547
1542
|
*/
|
|
1548
1543
|
"function-paren-newline": "off",
|
|
1549
1544
|
|
|
@@ -1556,16 +1551,14 @@ module.exports = {
|
|
|
1556
1551
|
/**
|
|
1557
1552
|
* Enforce the location of arrow function bodies with implicit returns 🔧
|
|
1558
1553
|
* https://eslint.org/docs/latest/rules/implicit-arrow-linebreak.
|
|
1559
|
-
* Turned off => conflicting with the prettier rules.
|
|
1560
1554
|
*/
|
|
1561
1555
|
"implicit-arrow-linebreak": "off",
|
|
1562
1556
|
|
|
1563
1557
|
/**
|
|
1564
1558
|
* This option sets a specific tab width for your code 🔧
|
|
1565
1559
|
* https://eslint.org/docs/latest/rules/indent.
|
|
1566
|
-
* Turned off => conflicting with the prettier rules.
|
|
1567
1560
|
*/
|
|
1568
|
-
indent: "
|
|
1561
|
+
indent: "error",
|
|
1569
1562
|
|
|
1570
1563
|
/**
|
|
1571
1564
|
* Specify whether double or single quotes should be used in JSX attributes 🔧
|
|
@@ -1625,7 +1618,7 @@ module.exports = {
|
|
|
1625
1618
|
* Require or disallow an empty line between class members 🔧
|
|
1626
1619
|
* https://eslint.org/docs/latest/rules/lines-between-class-members.
|
|
1627
1620
|
*/
|
|
1628
|
-
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine:
|
|
1621
|
+
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
1629
1622
|
|
|
1630
1623
|
/**
|
|
1631
1624
|
* Specify the maximum length of a line in your program
|
|
@@ -1633,9 +1626,9 @@ module.exports = {
|
|
|
1633
1626
|
*/
|
|
1634
1627
|
"max-len": [
|
|
1635
1628
|
"error",
|
|
1636
|
-
120,
|
|
1637
|
-
2,
|
|
1638
1629
|
{
|
|
1630
|
+
code: 120,
|
|
1631
|
+
tabWidth: 4,
|
|
1639
1632
|
ignoreUrls: true,
|
|
1640
1633
|
ignoreComments: false,
|
|
1641
1634
|
ignoreRegExpLiterals: true,
|
|
@@ -1666,7 +1659,7 @@ module.exports = {
|
|
|
1666
1659
|
* Enforces new line after each method call in the chain to make it more readable and easy to maintain 🔧
|
|
1667
1660
|
* https://eslint.org/docs/latest/rules/newline-per-chained-call.
|
|
1668
1661
|
*/
|
|
1669
|
-
"newline-per-chained-call": ["error", { ignoreChainWithDepth:
|
|
1662
|
+
"newline-per-chained-call": ["error", { ignoreChainWithDepth: 3 }],
|
|
1670
1663
|
|
|
1671
1664
|
/**
|
|
1672
1665
|
* Disallow unnecessary parentheses 🔧
|
|
@@ -1724,15 +1717,14 @@ module.exports = {
|
|
|
1724
1717
|
* Enforce the location of single-line statements 🔧
|
|
1725
1718
|
* https://eslint.org/docs/latest/rules/nonblock-statement-body-position.
|
|
1726
1719
|
*/
|
|
1727
|
-
"nonblock-statement-body-position": ["error", "
|
|
1720
|
+
"nonblock-statement-body-position": ["error", "any", { overrides: {} }],
|
|
1728
1721
|
|
|
1729
1722
|
/**
|
|
1730
1723
|
* Enforce line breaks between braces. 🔧
|
|
1731
1724
|
* https://eslint.org/docs/latest/rules/object-curly-newline.
|
|
1732
|
-
* Turned off => conflicting with the prettier rules.
|
|
1733
1725
|
*/
|
|
1734
1726
|
"object-curly-newline": [
|
|
1735
|
-
"
|
|
1727
|
+
"error",
|
|
1736
1728
|
{
|
|
1737
1729
|
ObjectExpression: { minProperties: 7, multiline: true, consistent: true },
|
|
1738
1730
|
ObjectPattern: { minProperties: 7, multiline: true, consistent: true },
|
|
@@ -1756,9 +1748,8 @@ module.exports = {
|
|
|
1756
1748
|
/**
|
|
1757
1749
|
* Requires operator at the beginning of the line in multiline statements 🔧
|
|
1758
1750
|
* https://eslint.org/docs/latest/rules/operator-linebreak.
|
|
1759
|
-
* Turned off => conflicting with the prettier rules.
|
|
1760
1751
|
*/
|
|
1761
|
-
"operator-linebreak": "
|
|
1752
|
+
"operator-linebreak": ["error", "before"],
|
|
1762
1753
|
|
|
1763
1754
|
/**
|
|
1764
1755
|
* Disallow padding within blocks 🔧
|
|
@@ -91,8 +91,13 @@ module.exports = {
|
|
|
91
91
|
* Enforces a regular expression pattern on descriptions
|
|
92
92
|
* https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-match-description.
|
|
93
93
|
*/
|
|
94
|
-
"jsdoc/match-description":
|
|
95
|
-
|
|
94
|
+
"jsdoc/match-description": [
|
|
95
|
+
"error",
|
|
96
|
+
{
|
|
97
|
+
matchDescription: "[A-Z].*",
|
|
98
|
+
message: "The default description should begin with a capital letter",
|
|
99
|
+
},
|
|
100
|
+
],
|
|
96
101
|
/**
|
|
97
102
|
* Controls how and whether jsdoc blocks can be expressed as single or multiple line blocks ✅
|
|
98
103
|
* https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-multiline-blocks.
|
|
@@ -23,8 +23,9 @@ module.exports = {
|
|
|
23
23
|
|
|
24
24
|
"jsx-quotes": ["error", "prefer-double"],
|
|
25
25
|
|
|
26
|
+
// turned off just like in the base rules
|
|
26
27
|
"class-methods-use-this": [
|
|
27
|
-
"
|
|
28
|
+
"off",
|
|
28
29
|
{
|
|
29
30
|
exceptMethods: [
|
|
30
31
|
"render",
|
|
@@ -374,8 +375,9 @@ module.exports = {
|
|
|
374
375
|
/**
|
|
375
376
|
* Enforce a defaultProps definition for every prop that is not a required prop
|
|
376
377
|
* https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md.
|
|
378
|
+
* Turned off: a bit of overkill
|
|
377
379
|
*/
|
|
378
|
-
"react/require-default-props": ["
|
|
380
|
+
"react/require-default-props": ["off", { forbidDefaultForRequired: true }],
|
|
379
381
|
|
|
380
382
|
/**
|
|
381
383
|
* Enforce React components to have a shouldComponentUpdate method
|
|
@@ -521,9 +523,8 @@ module.exports = {
|
|
|
521
523
|
/**
|
|
522
524
|
* Enforce consistent linebreaks in curly braces in JSX attributes and expressions
|
|
523
525
|
* https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md.
|
|
524
|
-
* Turned off => conflicting with the prettier rules
|
|
525
526
|
*/
|
|
526
|
-
"react/jsx-curly-newline": "off",
|
|
527
|
+
"react/jsx-curly-newline": ["off", { multiline: "consistent", singleline: "consistent" }],
|
|
527
528
|
|
|
528
529
|
/**
|
|
529
530
|
* Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
|
|
@@ -565,7 +566,7 @@ module.exports = {
|
|
|
565
566
|
* Enforce JSX indentation 🔧
|
|
566
567
|
* https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md.
|
|
567
568
|
*/
|
|
568
|
-
"react/jsx-indent":
|
|
569
|
+
"react/jsx-indent": "error",
|
|
569
570
|
|
|
570
571
|
/**
|
|
571
572
|
* Enforce props indentation in JSX 🔧
|
|
@@ -192,14 +192,12 @@ module.exports = {
|
|
|
192
192
|
/**
|
|
193
193
|
* Require explicit accessibility modifiers on class properties and methods 🔧 💡
|
|
194
194
|
* https://typescript-eslint.io/rules/explicit-member-accessibility.
|
|
195
|
+
* Defaults to public, other accessability must be set explicitly!
|
|
195
196
|
*/
|
|
196
197
|
"@typescript-eslint/explicit-member-accessibility": [
|
|
197
198
|
"error",
|
|
198
199
|
{
|
|
199
|
-
accessibility: "
|
|
200
|
-
overrides: {
|
|
201
|
-
constructors: "off",
|
|
202
|
-
},
|
|
200
|
+
accessibility: "no-public",
|
|
203
201
|
},
|
|
204
202
|
],
|
|
205
203
|
|
|
@@ -859,9 +857,9 @@ module.exports = {
|
|
|
859
857
|
/**
|
|
860
858
|
* Enforce consistent indentation.
|
|
861
859
|
* Https://typescript-eslint.io/rules/indent.
|
|
862
|
-
* Turned off => conflicting with the prettier rules
|
|
863
860
|
*/
|
|
864
|
-
|
|
861
|
+
indent: "off",
|
|
862
|
+
"@typescript-eslint/indent": baseRules.indent,
|
|
865
863
|
|
|
866
864
|
/**
|
|
867
865
|
* Enforce consistent spacing before and after keywords.
|
|
@@ -938,9 +936,7 @@ module.exports = {
|
|
|
938
936
|
(result, devDep) => {
|
|
939
937
|
const toAppend = [devDep];
|
|
940
938
|
const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, "ts$1");
|
|
941
|
-
if (devDepWithTs !== devDep)
|
|
942
|
-
toAppend.push(devDepWithTs);
|
|
943
|
-
}
|
|
939
|
+
if (devDepWithTs !== devDep) toAppend.push(devDepWithTs);
|
|
944
940
|
return [...result, ...toAppend];
|
|
945
941
|
},
|
|
946
942
|
),
|