@prowise/eslint-config-linting-rules 1.0.18 → 1.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 +9 -8
- package/backend.js +2 -1
- package/package.json +1 -1
- package/src/rules/base-rules.js +1 -1
- package/src/rules/plugin-import-rules.js +2 -0
- package/src/rules/plugin-jsdoc-rules.js +41 -5
- package/src/rules/plugin-node-rules.js +12 -0
- package/src/rules/plugin-react-rules.js +1 -1
- package/src/rules/plugin-typescript-rules.js +2 -1
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
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
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
|
-
|
|
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.
|
|
1
|
+
{"name":"@prowise/eslint-config-linting-rules","version":"1.1.1","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.16.0","@typescript-eslint/parser":"^6.16.0","confusing-browser-globals":"^1.0.11","eslint":"^8.56.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jest":"^27.6.0","eslint-plugin-jsdoc":"^46.9.1","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.5"},"overrides":{"semver":"^7.5.3"}}
|
package/src/rules/base-rules.js
CHANGED
|
@@ -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
|
|
|
@@ -60,8 +60,30 @@ module.exports = {
|
|
|
60
60
|
/**
|
|
61
61
|
* Reports invalid block tag names ✅
|
|
62
62
|
* https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-tag-names.
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
* Defined tags are valid typedoc tags
|
|
64
|
+
*/
|
|
65
|
+
"jsdoc/check-tag-names": ["warn", {
|
|
66
|
+
definedTags: [
|
|
67
|
+
"alpha",
|
|
68
|
+
"beta",
|
|
69
|
+
"category",
|
|
70
|
+
"defaultValue",
|
|
71
|
+
"eventProperty",
|
|
72
|
+
"experimental",
|
|
73
|
+
"group",
|
|
74
|
+
"hidden",
|
|
75
|
+
"internal",
|
|
76
|
+
"label",
|
|
77
|
+
"link",
|
|
78
|
+
"overload",
|
|
79
|
+
"packageDocumentation",
|
|
80
|
+
"privateRemarks",
|
|
81
|
+
"remarks",
|
|
82
|
+
"template",
|
|
83
|
+
"typeParam",
|
|
84
|
+
"virtual",
|
|
85
|
+
],
|
|
86
|
+
}],
|
|
65
87
|
|
|
66
88
|
/**
|
|
67
89
|
* Reports invalid types ✅
|
|
@@ -162,9 +184,23 @@ module.exports = {
|
|
|
162
184
|
* Requires that block description, explicit `@description`, and `@param`/`@returns`
|
|
163
185
|
* tag descriptions are written in complete sentences
|
|
164
186
|
* https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-description-complete-sentence.
|
|
165
|
-
*
|
|
166
|
-
|
|
167
|
-
|
|
187
|
+
*
|
|
188
|
+
* This is disabled for the following reason:
|
|
189
|
+
*
|
|
190
|
+
* - It makes a lot of mistakes, such as considering two words a sentence
|
|
191
|
+
* or considering an URL a sentence.
|
|
192
|
+
* - It gets in the way of developer productivity, if you need a spell checker
|
|
193
|
+
* or sentence tool, install one in your IDE.
|
|
194
|
+
* - The autofixer is very liberal with its autofixing of dots at the end
|
|
195
|
+
* of the sentence, which often leads to wrong dots. Therefore, readability
|
|
196
|
+
* actually gets worse.
|
|
197
|
+
*
|
|
198
|
+
* In conclusion, if you write JSDocs, please actually take time to write,
|
|
199
|
+
* instead of relying on some broken jsdoc rule.
|
|
200
|
+
*
|
|
201
|
+
* If you cannot do that, PR reviewers should call you out on it.
|
|
202
|
+
*/
|
|
203
|
+
"jsdoc/require-description-complete-sentence": "off",
|
|
168
204
|
|
|
169
205
|
/**
|
|
170
206
|
* 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
|
|
|
@@ -97,6 +97,7 @@ module.exports = {
|
|
|
97
97
|
Symbol: {
|
|
98
98
|
message: "Avoid using the `Symbol` type. Did you mean `symbol`?",
|
|
99
99
|
},
|
|
100
|
+
"{}": false,
|
|
100
101
|
},
|
|
101
102
|
},
|
|
102
103
|
],
|
|
@@ -143,7 +144,7 @@ module.exports = {
|
|
|
143
144
|
/**
|
|
144
145
|
* Enforce type definitions to consistently use either interface or type 🔒 🔧
|
|
145
146
|
* https://typescript-eslint.io/rules/consistent-type-definitions.
|
|
146
|
-
* Turned off => we want to keep difference between defining type and interface
|
|
147
|
+
* Turned off => we want to keep difference between defining type and interface.
|
|
147
148
|
*/
|
|
148
149
|
"@typescript-eslint/consistent-type-definitions": "off",
|
|
149
150
|
|