@prowise/eslint-config-linting-rules 0.0.6 → 0.0.7

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/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@prowise/eslint-config-linting-rules","version":"0.0.6","description":"Default Prowise linting rules for npm packages.","main":"index.js","exports":{"./typescript":"./typescript.js","./backend":"./backend.js","./frontend":"./frontend.js"},"scripts":{"lint":"eslint ."},"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.23.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-prettier":"^4.2.1","eslint-plugin-react":"^7.31.7","eslint-plugin-react-hooks":"^4.6.0","object.assign":"^4.1.4","prettier":"^2.7.1","semver":"^7.3.7"}}
1
+ {"name":"@prowise/eslint-config-linting-rules","version":"0.0.7","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-prettier":"^4.2.1","eslint-plugin-react":"^7.31.7","eslint-plugin-react-hooks":"^4.6.0","object.assign":"^4.1.4","prettier":"^2.7.1"}}
@@ -1,6 +1,4 @@
1
1
  const confusingBrowserGlobals = require("confusing-browser-globals");
2
- const eslintPkg = require("eslint/package.json");
3
- const semver = require("semver");
4
2
 
5
3
  module.exports = {
6
4
  /*
@@ -406,7 +404,7 @@ module.exports = {
406
404
  * Enforce that class methods use "this"
407
405
  * https://eslint.org/docs/latest/rules/class-methods-use-this.
408
406
  */
409
- "class-methods-use-this": ["error", { exceptMethods: [] }],
407
+ "class-methods-use-this": "off",
410
408
 
411
409
  /**
412
410
  * Specify the maximum cyclomatic complexity allowed in a program
@@ -766,7 +764,7 @@ module.exports = {
766
764
  * Disallow this keywords outside of classes or class-like objects
767
765
  * https://eslint.org/docs/latest/rules/no-invalid-this.
768
766
  */
769
- "no-invalid-this": "warn",
767
+ "no-invalid-this": "off",
770
768
 
771
769
  /**
772
770
  * Disallow usage of __iterator__ property
@@ -1056,16 +1054,6 @@ module.exports = {
1056
1054
  */
1057
1055
  "no-restricted-syntax": [
1058
1056
  "error",
1059
- {
1060
- selector: "ForInStatement",
1061
- message:
1062
- "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
1063
- },
1064
- {
1065
- selector: "ForOfStatement",
1066
- message:
1067
- "iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.",
1068
- },
1069
1057
  {
1070
1058
  selector: "LabeledStatement",
1071
1059
  message:
@@ -1146,7 +1134,8 @@ module.exports = {
1146
1134
  "error",
1147
1135
  {
1148
1136
  allow: [],
1149
- allowAfterThis: false,
1137
+ allowAfterThis: true,
1138
+ allowFunctionParams: true,
1150
1139
  allowAfterSuper: false,
1151
1140
  enforceInMethodNames: true,
1152
1141
  },
@@ -1378,7 +1367,7 @@ module.exports = {
1378
1367
  * Require use of the second argument for parseInt()
1379
1368
  * https://eslint.org/docs/latest/rules/radix.
1380
1369
  */
1381
- radix: "error",
1370
+ radix: ["error", "as-needed"],
1382
1371
 
1383
1372
  /**
1384
1373
  * Require `await` in `async function` (note: this is a horrible rule that should never be used)
@@ -1472,7 +1461,7 @@ module.exports = {
1472
1461
  * Require parens in arrow function arguments 🔧
1473
1462
  * https://eslint.org/docs/latest/rules/arrow-parens.
1474
1463
  */
1475
- "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
1464
+ "arrow-parens": ["error", "always"],
1476
1465
 
1477
1466
  /**
1478
1467
  * Require space before/after arrow function"s arrow 🔧
@@ -1568,13 +1557,11 @@ module.exports = {
1568
1557
  "function-call-argument-newline": ["error", "consistent"],
1569
1558
 
1570
1559
  /**
1571
- * Require line breaks inside function parentheses if there are line breaks between parameters 🔧
1560
+ * Require line breaks inside function parentheses if there are line breaks between parameters. 🔧
1572
1561
  * https://eslint.org/docs/latest/rules/function-paren-newline.
1562
+ * Turned off => conflicting with the prettier rules.
1573
1563
  */
1574
- "function-paren-newline": [
1575
- "error",
1576
- semver.satisfies(eslintPkg.version, ">= 6") ? "multiline-arguments" : "consistent",
1577
- ],
1564
+ "function-paren-newline": "off",
1578
1565
 
1579
1566
  /**
1580
1567
  * Enforce the spacing around the * in generator functions 🔧
@@ -1585,48 +1572,16 @@ module.exports = {
1585
1572
  /**
1586
1573
  * Enforce the location of arrow function bodies with implicit returns 🔧
1587
1574
  * https://eslint.org/docs/latest/rules/implicit-arrow-linebreak.
1575
+ * Turned off => conflicting with the prettier rules.
1588
1576
  */
1589
- "implicit-arrow-linebreak": ["error", "beside"],
1577
+ "implicit-arrow-linebreak": "off",
1590
1578
 
1591
1579
  /**
1592
1580
  * This option sets a specific tab width for your code 🔧
1593
1581
  * https://eslint.org/docs/latest/rules/indent.
1582
+ * Turned off => conflicting with the prettier rules.
1594
1583
  */
1595
- indent: [
1596
- "error",
1597
- 4,
1598
- {
1599
- SwitchCase: 1,
1600
- VariableDeclarator: 1,
1601
- outerIIFEBody: 1,
1602
- FunctionDeclaration: { parameters: 1, body: 1 },
1603
- FunctionExpression: { parameters: 1, body: 1 },
1604
- CallExpression: { arguments: 1 },
1605
- ArrayExpression: 1,
1606
- ObjectExpression: 1,
1607
- ImportDeclaration: 1,
1608
- flatTernaryExpressions: false,
1609
- ignoredNodes: [
1610
- "JSXElement",
1611
- "JSXElement > *",
1612
- "JSXAttribute",
1613
- "JSXIdentifier",
1614
- "JSXNamespacedName",
1615
- "JSXMemberExpression",
1616
- "JSXSpreadAttribute",
1617
- "JSXExpressionContainer",
1618
- "JSXOpeningElement",
1619
- "JSXClosingElement",
1620
- "JSXFragment",
1621
- "JSXOpeningFragment",
1622
- "JSXClosingFragment",
1623
- "JSXText",
1624
- "JSXEmptyExpression",
1625
- "JSXSpreadChild",
1626
- ],
1627
- ignoreComments: false,
1628
- },
1629
- ],
1584
+ indent: "off",
1630
1585
 
1631
1586
  /**
1632
1587
  * Specify whether double or single quotes should be used in JSX attributes 🔧
@@ -1788,16 +1743,17 @@ module.exports = {
1788
1743
  "nonblock-statement-body-position": ["error", "beside", { overrides: {} }],
1789
1744
 
1790
1745
  /**
1791
- * Enforce line breaks between braces 🔧
1746
+ * Enforce line breaks between braces. 🔧
1792
1747
  * https://eslint.org/docs/latest/rules/object-curly-newline.
1748
+ * Turned off => conflicting with the prettier rules.
1793
1749
  */
1794
1750
  "object-curly-newline": [
1795
- "error",
1751
+ "off",
1796
1752
  {
1797
- ObjectExpression: { minProperties: 4, multiline: true, consistent: true },
1798
- ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
1799
- ImportDeclaration: { minProperties: 5, multiline: true, consistent: true },
1800
- ExportDeclaration: { minProperties: 5, multiline: true, consistent: true },
1753
+ ObjectExpression: { minProperties: 7, multiline: true, consistent: true },
1754
+ ObjectPattern: { minProperties: 7, multiline: true, consistent: true },
1755
+ ImportDeclaration: { minProperties: 7, multiline: true, consistent: true },
1756
+ ExportDeclaration: { minProperties: 7, multiline: true, consistent: true },
1801
1757
  },
1802
1758
  ],
1803
1759
 
@@ -1817,7 +1773,7 @@ module.exports = {
1817
1773
  * Requires operator at the beginning of the line in multiline statements 🔧
1818
1774
  * https://eslint.org/docs/latest/rules/operator-linebreak.
1819
1775
  */
1820
- "operator-linebreak": ["error", "before", { overrides: { "=": "none" } }],
1776
+ "operator-linebreak": ["error", "before", { overrides: { "=": "after" } }],
1821
1777
 
1822
1778
  /**
1823
1779
  * Disallow padding within blocks 🔧
@@ -30,13 +30,13 @@ module.exports = {
30
30
  * Reports invalid padding inside JSDoc blocks
31
31
  * https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-indentation.
32
32
  */
33
- "jsdoc/check-indentation": "warn",
33
+ "jsdoc/check-indentation": "off",
34
34
 
35
35
  /**
36
36
  * Reports invalid alignment of JSDoc block lines
37
37
  * https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-line-alignment.
38
38
  */
39
- "jsdoc/check-line-alignment": "warn",
39
+ "jsdoc/check-line-alignment": "off",
40
40
 
41
41
  /**
42
42
  * Ensures that parameter names in JSDoc match those in the function declaration ✅
@@ -91,7 +91,7 @@ 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": "warn",
94
+ "jsdoc/match-description": "off",
95
95
 
96
96
  /**
97
97
  * Controls how and whether jsdoc blocks can be expressed as single or multiple line blocks ✅
@@ -164,7 +164,7 @@ module.exports = {
164
164
  * tag descriptions are written in complete sentences
165
165
  * https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-description-complete-sentence.
166
166
  */
167
- "jsdoc/require-description-complete-sentence": "warn",
167
+ "jsdoc/require-description-complete-sentence": "off",
168
168
 
169
169
  /**
170
170
  * Requires that all functions have examples
@@ -219,7 +219,7 @@ module.exports = {
219
219
  * Requires that all function parameters are documented ✅
220
220
  * https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-param.
221
221
  */
222
- "jsdoc/require-param": "warn",
222
+ "jsdoc/require-param": "off",
223
223
 
224
224
  /**
225
225
  * Requires that each `@param` tag has a `description` value ✅
@@ -244,7 +244,7 @@ module.exports = {
244
244
  * is a plain `object`, `Object`, or `PlainObject
245
245
  * https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-property.
246
246
  */
247
- "jsdoc/require-property": "warn",
247
+ "jsdoc/require-property": "off",
248
248
 
249
249
  /**
250
250
  * Requires that each `@property` tag has a `description` value ✅
@@ -268,7 +268,7 @@ module.exports = {
268
268
  * Requires that returns are documented ✅
269
269
  * https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns.
270
270
  */
271
- "jsdoc/require-returns": "warn",
271
+ "jsdoc/require-returns": "off",
272
272
 
273
273
  /**
274
274
  * Requires a return statement in function body if a `@returns` tag is specified in jsdoc comment ✅
@@ -521,8 +521,9 @@ module.exports = {
521
521
  /**
522
522
  * Enforce consistent linebreaks in curly braces in JSX attributes and expressions
523
523
  * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md.
524
+ * Turned off => conflicting with the prettier rules
524
525
  */
525
- "react/jsx-curly-newline": ["error", { multiline: "consistent", singleline: "consistent" }],
526
+ "react/jsx-curly-newline": "off",
526
527
 
527
528
  /**
528
529
  * Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
@@ -663,19 +664,19 @@ module.exports = {
663
664
  * Disallow unnecessary fragments 🔧
664
665
  * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md.
665
666
  */
666
- "react/jsx-no-useless-fragment": "error",
667
+ "react/jsx-no-useless-fragment": ["error", { allowExpressions: true }],
667
668
 
668
669
  /**
669
670
  * Require one JSX element per line 🔧
670
671
  * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md.
671
672
  */
672
- "react/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
673
+ "react/jsx-one-expression-per-line": "off",
673
674
 
674
675
  /**
675
676
  * Enforce PascalCase for user-defined JSX components
676
677
  * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md.
677
678
  */
678
- "react/jsx-pascal-case": ["error", { allowAllCaps: true, ignore: [] }],
679
+ "react/jsx-pascal-case": ["error", { allowAllCaps: true, allowNamespace: true, ignore: [] }],
679
680
 
680
681
  /**
681
682
  * Disallow multiple spaces between inline JSX props 🔧
@@ -691,7 +692,7 @@ module.exports = {
691
692
  "error",
692
693
  {
693
694
  html: "enforce",
694
- custom: "enforce",
695
+ custom: "ignore",
695
696
  explicitSpread: "ignore",
696
697
  exceptions: [],
697
698
  },
@@ -42,7 +42,7 @@ module.exports = {
42
42
  * Require using either T[] or Array<T> for arrays 🔒 🔧
43
43
  * https://typescript-eslint.io/rules/array-type.
44
44
  */
45
- "@typescript-eslint/array-type": ["error", { default: "array" }],
45
+ "@typescript-eslint/array-type": ["error", { default: "array-simple" }],
46
46
 
47
47
  /**
48
48
  * Disallow awaiting a value that is not a Thenable ✅ 💭
@@ -132,7 +132,7 @@ module.exports = {
132
132
  * Require or disallow the Record type 🔒 🔧
133
133
  * https://typescript-eslint.io/rules/consistent-indexed-oject-style.
134
134
  */
135
- "@typescript-eslint/consistent-indexed-object-style": "warn",
135
+ "@typescript-eslint/consistent-indexed-object-style": ["warn", "record"],
136
136
 
137
137
  /**
138
138
  * Enforce consistent usage of type assertions 🔒
@@ -143,8 +143,9 @@ module.exports = {
143
143
  /**
144
144
  * Enforce type definitions to consistently use either interface or type 🔒 🔧
145
145
  * https://typescript-eslint.io/rules/consistent-type-definitions.
146
+ * Turned off => we want to keep difference between defining type and interface
146
147
  */
147
- "@typescript-eslint/consistent-type-definitions": "warn",
148
+ "@typescript-eslint/consistent-type-definitions": "off",
148
149
 
149
150
  /**
150
151
  * Enforce consistent usage of type exports 🔧 💭
@@ -173,16 +174,33 @@ module.exports = {
173
174
  "@typescript-eslint/dot-notation": baseRules["dot-notation"],
174
175
 
175
176
  /**
176
- * Require explicit return types on functions and class methods
177
- * https://typescript-eslint.io/rules/explicit-function-return.
177
+ * Require explicit return types on functions and class methods.
178
+ * Https://typescript-eslint.io/rules/explicit-function-return-type.
178
179
  */
179
- "@typescript-eslint/explicit-function-return-type": "warn",
180
+ "@typescript-eslint/explicit-function-return-type": [
181
+ "warn",
182
+ {
183
+ allowExpressions: true,
184
+ allowTypedFunctionExpressions: true,
185
+ allowHigherOrderFunctions: true,
186
+ allowDirectConstAssertionInArrowFunctions: true,
187
+ allowConciseArrowFunctionExpressionsStartingWithVoid: true,
188
+ },
189
+ ],
180
190
 
181
191
  /**
182
192
  * Require explicit accessibility modifiers on class properties and methods 🔧 💡
183
193
  * https://typescript-eslint.io/rules/explicit-member-accessibility.
184
194
  */
185
- "@typescript-eslint/explicit-member-accessibility": "error",
195
+ "@typescript-eslint/explicit-member-accessibility": [
196
+ "error",
197
+ {
198
+ accessibility: "explicit",
199
+ overrides: {
200
+ constructors: "off",
201
+ },
202
+ },
203
+ ],
186
204
 
187
205
  /**
188
206
  * Require explicit return and argument types on exported functions" and classes" public class methods
@@ -264,7 +282,10 @@ module.exports = {
264
282
  * Require expressions of type void to appear in statement position 🔧 💡 💭
265
283
  * https://typescript-eslint.io/rules/no-confusing-void-expression.
266
284
  */
267
- "@typescript-eslint/no-confusing-void-expression": "warn",
285
+ "@typescript-eslint/no-confusing-void-expression": [
286
+ "warn",
287
+ { ignoreArrowShorthand: true, ignoreVoidOperator: true },
288
+ ],
268
289
 
269
290
  /**
270
291
  * Disallow duplicate class members.
@@ -628,7 +649,7 @@ module.exports = {
628
649
  * Require each enum member value to be explicitly initialized 💡
629
650
  * https://typescript-eslint.io/rules/prefer-enum-initializers.
630
651
  */
631
- "@typescript-eslint/prefer-enum-initializers": "warn",
652
+ "@typescript-eslint/prefer-enum-initializers": "off",
632
653
 
633
654
  /**
634
655
  * Enforce the use of for-of loop over the standard for loop where possible 🔒
@@ -664,7 +685,7 @@ module.exports = {
664
685
  * Enforce using the nullish coalescing operator instead of logical chaining 🔒 💡 💭
665
686
  * https://typescript-eslint.io/rules/prefer-nullish-coalescing.
666
687
  */
667
- "@typescript-eslint/prefer-nullish-coalescing": "warn",
688
+ "@typescript-eslint/prefer-nullish-coalescing": "off",
668
689
 
669
690
  /**
670
691
  * Enforce using concise optional chain expressions instead of chained logical ands 🔒 💡
@@ -682,7 +703,7 @@ module.exports = {
682
703
  * Require function parameters to be typed as readonly to prevent accidental mutation of inputs 💭
683
704
  * https://typescript-eslint.io/rules/prefer-readonly-parameter-types.
684
705
  */
685
- "@typescript-eslint/prefer-readonly-parameter-types": ["warn", { ignoreInferredTypes: true }],
706
+ "@typescript-eslint/prefer-readonly-parameter-types": "off",
686
707
 
687
708
  /**
688
709
  * Enforce using type parameter when calling Array#reduce instead of casting 🔒 🔧 💭
@@ -837,9 +858,9 @@ module.exports = {
837
858
  /**
838
859
  * Enforce consistent indentation.
839
860
  * Https://typescript-eslint.io/rules/indent.
861
+ * Turned off => conflicting with the prettier rules
840
862
  */
841
- indent: "off",
842
- "@typescript-eslint/indent": baseRules.indent,
863
+ "@typescript-eslint/indent": "off",
843
864
 
844
865
  /**
845
866
  * Enforce consistent spacing before and after keywords.