@prowise/eslint-config-linting-rules 1.0.18 → 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/README.md CHANGED
@@ -1,15 +1,17 @@
1
- # Prowise linting rules #
1
+ # Prowise linting rules
2
2
 
3
3
  This repository contains the Prowise basic linting rules
4
4
  Rules are based on:
5
- * the airbnb rule sets
6
- * the recommended rules of eslint and the different plugins
7
- * Prowise preferences
8
- ### What is this repository for? ###
5
+
6
+ * The Airbnb rule sets
7
+ * The recommended rules of Eslint and the different plugins
8
+ * Prowise Style Guide
9
+
10
+ ### What is this repository for?
9
11
 
10
12
  * Easy setup to all linting rules on a code repository
11
13
 
12
- ### How to use ###
14
+ ### How to use
13
15
 
14
16
  * Install this package with `npm install @prowise/eslint-config-linting-rules -D`
15
17
  * Depending on the type of project, add the following line to your `eslintrc` file:
@@ -29,5 +31,4 @@ module.exports = {
29
31
  },
30
32
  };
31
33
 
32
- ```
33
-
34
+ ```
package/backend.js CHANGED
@@ -5,7 +5,8 @@ module.exports = {
5
5
 
6
6
  env: { node: true },
7
7
 
8
- plugins: ["eslint-plugin-node"],
8
+ // For Node, we require that you add extensions (.js) to every Javascript/Typescript file.
9
+ plugins: ["eslint-plugin-node", "require-extensions"],
9
10
 
10
11
  rules: { ...nodeRules },
11
12
  };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@prowise/eslint-config-linting-rules","version":"1.0.18","description":"Default Prowise linting rules for npm packages.","main":"index.js","exports":{"./default":"./index.js","./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":"^6.7.3","@typescript-eslint/parser":"^6.7.3","confusing-browser-globals":"^1.0.11","eslint":"^8.50.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-import":"^2.28.1","eslint-plugin-jest":"^27.4.0","eslint-plugin-jsdoc":"^46.8.2","eslint-plugin-node":"^11.1.0","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0","object.assign":"^4.1.4"},"overrides":{"semver":"^7.5.3"}}
1
+ {"name":"@prowise/eslint-config-linting-rules","version":"1.1.0","description":"Default Prowise linting rules for npm packages.","main":"index.js","exports":{"./default":"./index.js","./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":"^6.9.0","@typescript-eslint/parser":"^6.9.0","confusing-browser-globals":"^1.0.11","eslint":"^8.52.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-import":"^2.29.0","eslint-plugin-jest":"^27.4.3","eslint-plugin-jsdoc":"^46.8.2","eslint-plugin-node":"^11.1.0","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-require-extensions":"^0.1.3","object.assign":"^4.1.4"},"overrides":{"semver":"^7.5.3"}}
@@ -1298,7 +1298,7 @@ module.exports = {
1298
1298
  /**
1299
1299
  * Disallow use of Object.prototype.hasOwnProperty.call() and prefer use of Object.hasOwn() 🔧
1300
1300
  * https://eslint.org/docs/latest/rules/prefer-object-has-own.
1301
- * Turned off: only supported with ES2022 and node 18: can be turned on when all projects support node18/ES2022
1301
+ * Turned off: only supported with ES2022 and node 18: can be turned on when all projects support node18/ES2022.
1302
1302
  */
1303
1303
  "prefer-object-has-own": "off",
1304
1304
 
@@ -27,6 +27,8 @@ module.exports = {
27
27
  /**
28
28
  * Ensure consistent use of file extension within the import path
29
29
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/extensions.md.
30
+ *
31
+ * Only warn, do not error on this, certain bundlers might accept it.
30
32
  */
31
33
  "import/extensions": ["error", "ignorePackages", { js: "never", mjs: "never", jsx: "never" }],
32
34
 
@@ -162,9 +162,23 @@ module.exports = {
162
162
  * Requires that block description, explicit `@description`, and `@param`/`@returns`
163
163
  * tag descriptions are written in complete sentences
164
164
  * https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-description-complete-sentence.
165
- * Keep this on, new projects should have this on!
166
- */
167
- "jsdoc/require-description-complete-sentence": "warn",
165
+ *
166
+ * This is disabled for the following reason:
167
+ *
168
+ * - It makes a lot of mistakes, such as considering two words a sentence
169
+ * or considering an URL a sentence.
170
+ * - It gets in the way of developer productivity, if you need a spell checker
171
+ * or sentence tool, install one in your IDE.
172
+ * - The autofixer is very liberal with its autofixing of dots at the end
173
+ * of the sentence, which often leads to wrong dots. Therefore, readability
174
+ * actually gets worse.
175
+ *
176
+ * In conclusion, if you write JSDocs, please actually take time to write,
177
+ * instead of relying on some broken jsdoc rule.
178
+ *
179
+ * If you cannot do that, PR reviewers should call you out on it.
180
+ */
181
+ "jsdoc/require-description-complete-sentence": "off",
168
182
 
169
183
  /**
170
184
  * Requires that all functions have examples
@@ -57,5 +57,17 @@ module.exports = {
57
57
  * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-process-exit.md.
58
58
  */
59
59
  "node/no-process-exit": "off",
60
+
61
+ /**
62
+ * Require specifying an extension for Node projects when in ESM export mode.
63
+ * Node does not support leaving out the extension when importing.
64
+ * Therefore all backend Node.js projects should always include .js as an extension.
65
+ *
66
+ * This does not effect projects that use CJS exports, but it doesn't hurt either.
67
+ * Https://github.com/solana-labs/eslint-plugin-require-extensions.
68
+ */
69
+ "import/extensions": "off",
70
+ "require-extensions/require-extensions": "error",
71
+ "require-extensions/require-index": "error",
60
72
  },
61
73
  };
@@ -375,7 +375,7 @@ module.exports = {
375
375
  /**
376
376
  * Enforce a defaultProps definition for every prop that is not a required prop
377
377
  * https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md.
378
- * Turned off: a bit of overkill
378
+ * Turned off: a bit of overkill.
379
379
  */
380
380
  "react/require-default-props": ["off", { forbidDefaultForRequired: true }],
381
381
 
@@ -143,7 +143,7 @@ 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
+ * Turned off => we want to keep difference between defining type and interface.
147
147
  */
148
148
  "@typescript-eslint/consistent-type-definitions": "off",
149
149