@haltcase/style 6.0.0-canary.2 → 6.1.0-canary.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/eslint/rules/typescript/index.js +13 -0
- package/package.json +1 -1
- package/readme.md +14 -14
|
@@ -66,6 +66,19 @@ module.exports = {
|
|
|
66
66
|
selector: "interface"
|
|
67
67
|
}
|
|
68
68
|
],
|
|
69
|
+
/**
|
|
70
|
+
* Prevent `void` type expressions from being used in misleading locations
|
|
71
|
+
* such as being assigned to a variable, provided as a function argument,
|
|
72
|
+
* or returned from a function (except concise arrow functions).
|
|
73
|
+
*
|
|
74
|
+
* 🔧 Fixable - https://typescript-eslint.io/rules/no-confusing-void-expression/
|
|
75
|
+
*/
|
|
76
|
+
"@typescript-eslint/no-confusing-void-expression": [
|
|
77
|
+
error,
|
|
78
|
+
{
|
|
79
|
+
ignoreArrowShorthand: true
|
|
80
|
+
}
|
|
81
|
+
],
|
|
69
82
|
/**
|
|
70
83
|
* Disallow Promises in places not designed to handle them.
|
|
71
84
|
*
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# `@haltcase/style` · [](https://www.npmjs.com/package/@haltcase/style) [](https://www.npmjs.com/package/@haltcase/style) [](https://haltcase.dev/style)
|
|
2
2
|
|
|
3
3
|
> Style guide and configurations for tools in the web ecosystem.
|
|
4
4
|
|
|
@@ -23,14 +23,15 @@ pnpm i --save-dev @haltcase/style
|
|
|
23
23
|
yarn add --dev @haltcase/style
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
>
|
|
27
|
-
>
|
|
26
|
+
> [!NOTE]
|
|
27
|
+
> Some scenarios require additional peer dependencies.
|
|
28
|
+
> See the [Prettier](#prettier) and [ESLint](#eslint) sections.
|
|
28
29
|
|
|
29
30
|
## usage
|
|
30
31
|
|
|
31
32
|
### Prettier
|
|
32
33
|
|
|
33
|
-
>
|
|
34
|
+
> [!NOTE]
|
|
34
35
|
> Prettier is a peer dependency you'll need to install
|
|
35
36
|
> at the root of your project.
|
|
36
37
|
>
|
|
@@ -46,7 +47,7 @@ Add the following in `package.json`:
|
|
|
46
47
|
|
|
47
48
|
### ESLint
|
|
48
49
|
|
|
49
|
-
>
|
|
50
|
+
> [!NOTE]
|
|
50
51
|
> ESLint is a peer dependency you'll need to install
|
|
51
52
|
> at the root of your project.
|
|
52
53
|
>
|
|
@@ -59,7 +60,7 @@ Start with at least one of these base configs, which should always be first in `
|
|
|
59
60
|
- `@haltcase/style/eslint/browser`
|
|
60
61
|
- `@haltcase/style/eslint/node`
|
|
61
62
|
|
|
62
|
-
>
|
|
63
|
+
> [!TIP]
|
|
63
64
|
> You can scope configs so they only target specific files.
|
|
64
65
|
>
|
|
65
66
|
> See: [Scoped configuration with `overrides`](#scoped-configuration-with-overrides).
|
|
@@ -92,15 +93,13 @@ module.exports = {
|
|
|
92
93
|
#### Configuring ESLint for TypeScript
|
|
93
94
|
|
|
94
95
|
Some of the rules enabled in the TypeScript config require additional type
|
|
95
|
-
information, you'll need to
|
|
96
|
+
information, so you'll need to use `project: true` and `tsconfigRootDir` or
|
|
97
|
+
explicitly supply the path(s) to your `tsconfig.json` per the typescript-eslint
|
|
98
|
+
documentation.
|
|
96
99
|
|
|
97
|
-
For more information, see: https://typescript-eslint.io/
|
|
100
|
+
For more information, see: https://typescript-eslint.io/linting/typed-linting/
|
|
98
101
|
|
|
99
102
|
```js
|
|
100
|
-
const { resolve } = require("path");
|
|
101
|
-
|
|
102
|
-
const project = resolve(__dirname, "tsconfig.json");
|
|
103
|
-
|
|
104
103
|
module.exports = {
|
|
105
104
|
root: true,
|
|
106
105
|
extends: [
|
|
@@ -108,7 +107,8 @@ module.exports = {
|
|
|
108
107
|
require.resolve("@haltcase/style/eslint/typescript")
|
|
109
108
|
],
|
|
110
109
|
parserOptions: {
|
|
111
|
-
project
|
|
110
|
+
project: true,
|
|
111
|
+
tsconfigRootDir: __dirname
|
|
112
112
|
},
|
|
113
113
|
settings: {
|
|
114
114
|
"import/resolver": {
|
|
@@ -221,7 +221,7 @@ You could also combine them with an `extends` array in [Typescript 5+](https://d
|
|
|
221
221
|
}
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
-
>
|
|
224
|
+
> [!TIP]
|
|
225
225
|
> Run `tsc --showConfig` to see the result of the combined configs.
|
|
226
226
|
|
|
227
227
|
## contributing
|