@automattic/eslint-plugin-wpvip 0.9.1 → 0.10.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 +9 -3
- package/configs/javascript.js +1 -1
- package/configs/typescript.js +2 -2
- package/configs/weak-typescript.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,10 +72,10 @@ Note that the order of configs can matter, since they can contain overrides. It
|
|
|
72
72
|
|
|
73
73
|
### Prettier
|
|
74
74
|
|
|
75
|
-
Install [WP Prettier](https://github.com/Automattic/wp-prettier) to benefit from additional formatting rules:
|
|
75
|
+
Install [WP Prettier](https://github.com/Automattic/wp-prettier) v2.x to benefit from additional formatting rules:
|
|
76
76
|
|
|
77
77
|
```sh
|
|
78
|
-
npm i --save-dev --save-exact "prettier@npm:wp-prettier@
|
|
78
|
+
npm i --save-dev --save-exact "prettier@npm:wp-prettier@2.8.5"
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
This repo also provides a Prettier config, which you can use with the following `.prettierrc`:
|
|
@@ -100,7 +100,7 @@ module.exports = {
|
|
|
100
100
|
};
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
If your project is not a CLI tool but calls `
|
|
103
|
+
If your project is not a CLI tool but calls `process` methods occasionally, you probably don't need this config. Instead, disable those rules only where necessary and include an explanation:
|
|
104
104
|
|
|
105
105
|
```js
|
|
106
106
|
// Intentionally exiting because we have observed an unrecoverable error.
|
|
@@ -108,6 +108,12 @@ If your project is not a CLI tool but calls `console` or `process` methods occas
|
|
|
108
108
|
process.exit( 1 );
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+
Note that `console.log` is still forbidden ([see here for an explanation](https://github.com/Automattic/eslint-config-wpvip/pull/198#issuecomment-2015322062)). If you're writing one-off Node scripts, you can disable the rule per file:
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
/* eslint-disable no-console */
|
|
115
|
+
```
|
|
116
|
+
|
|
111
117
|
## JSDoc
|
|
112
118
|
|
|
113
119
|
JSDoc is considered optional, especially compared to better alternatives like TypeScript and OpenAPI documentation. If you want to enforce the use of JSDoc, use the `jsdoc` config:
|
package/configs/javascript.js
CHANGED
|
@@ -254,7 +254,7 @@ module.exports = {
|
|
|
254
254
|
settings: {
|
|
255
255
|
'import/resolver': {
|
|
256
256
|
node: {
|
|
257
|
-
extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
|
|
257
|
+
extensions: [ '.js', '.jsx', '.ts', '.tsx', '.cjs', '.mjs', '.cts', '.mts' ],
|
|
258
258
|
},
|
|
259
259
|
typescript: 'eslint-import-resolver-typescript',
|
|
260
260
|
},
|
package/configs/typescript.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
-
ignorePatterns: [ '**/*.d.ts' ],
|
|
7
|
+
ignorePatterns: [ '**/*.d.ts', '**/*.d.cts', '**/*.d.mts' ],
|
|
8
8
|
|
|
9
9
|
overrides: [
|
|
10
10
|
{
|
|
@@ -14,7 +14,7 @@ module.exports = {
|
|
|
14
14
|
'plugin:@typescript-eslint/strict',
|
|
15
15
|
],
|
|
16
16
|
|
|
17
|
-
files: [ '**/*.ts', '**/*.tsx' ],
|
|
17
|
+
files: [ '**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts' ],
|
|
18
18
|
|
|
19
19
|
parser: '@typescript-eslint/parser',
|
|
20
20
|
|