eslint-plugin-nextfriday 4.3.1 → 4.4.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/CHANGELOG.md +16 -0
- package/README.md +7 -9
- package/docs/rules/PREFER_PROPS_WITH_CHILDREN.md +17 -35
- package/lib/index.cjs +80 -117
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +0 -42
- package/lib/index.d.cts.map +1 -1
- package/lib/index.d.ts +0 -42
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +80 -117
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/docs/rules/PREFER_INLINE_TYPE_EXPORT.md +0 -64
package/package.json
CHANGED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# prefer-inline-type-export
|
|
2
|
-
|
|
3
|
-
Require type and interface declarations to be exported inline rather than via a separate export statement.
|
|
4
|
-
|
|
5
|
-
> This rule is auto-fixable using `--fix`.
|
|
6
|
-
|
|
7
|
-
## Rule Details
|
|
8
|
-
|
|
9
|
-
This rule enforces that `interface` and `type` declarations are exported directly at the declaration site using the `export` keyword, rather than being exported separately via `export type { ... }` or `export { ... }` at the bottom of the file.
|
|
10
|
-
|
|
11
|
-
### Why?
|
|
12
|
-
|
|
13
|
-
Inline exports make it immediately clear at the declaration site that a type is part of the module's public API. Separate export statements create a disconnect between the declaration and its visibility, making it harder to understand the module's surface area at a glance.
|
|
14
|
-
|
|
15
|
-
## Examples
|
|
16
|
-
|
|
17
|
-
### Incorrect
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
interface ButtonProps {
|
|
21
|
-
label: string;
|
|
22
|
-
disabled: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type Theme = "light" | "dark";
|
|
26
|
-
|
|
27
|
-
export type { ButtonProps, Theme };
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
```ts
|
|
31
|
-
interface Config {
|
|
32
|
-
port: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export { Config };
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Correct
|
|
39
|
-
|
|
40
|
-
```ts
|
|
41
|
-
export interface ButtonProps {
|
|
42
|
-
label: string;
|
|
43
|
-
disabled: boolean;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type Theme = "light" | "dark";
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
export interface Config {
|
|
51
|
-
port: number;
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Exceptions
|
|
56
|
-
|
|
57
|
-
This rule only applies to `interface` and `type` declarations defined in the same file. It does not flag:
|
|
58
|
-
|
|
59
|
-
- Re-exports from other modules (`export type { Foo } from './types'`)
|
|
60
|
-
- Separate exports of non-type declarations (variables, functions, classes)
|
|
61
|
-
|
|
62
|
-
## When Not To Use It
|
|
63
|
-
|
|
64
|
-
If your project prefers grouping all exports at the bottom of the file for consistency.
|