@slip-stream-kit/eslint-plugin 0.44.0 → 0.45.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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { servicesNamespaceImport } from './services-namespace-import';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slip-stream-kit/eslint-plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ArthurSaenz/infra-kit.git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"eslint": ">=9"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@slip-stream-kit/config": "0.
|
|
44
|
+
"@slip-stream-kit/config": "0.45.0",
|
|
45
45
|
"@types/node": "^26.5.1",
|
|
46
46
|
"@typescript-eslint/parser": "^8.70.0",
|
|
47
47
|
"@wl/eslint-config": "0.1.0",
|
package/readme.md
CHANGED
|
@@ -834,6 +834,41 @@ Tests, stories and `.d.ts` files are skipped, as are backend and e2e packages.
|
|
|
834
834
|
| `extraServiceFiles` | `string[]` | `[]` | Extra `services/` names, likewise. |
|
|
835
835
|
| `paths`/`ignore` | `string[]` | `[]` | Globs restricting / skipping files. |
|
|
836
836
|
|
|
837
|
+
### `services-namespace-import`
|
|
838
|
+
|
|
839
|
+
🔧 Automatically fixable.
|
|
840
|
+
|
|
841
|
+
A relative import of a `services` module (`./services`, `../services`, `../services/index`) is a
|
|
842
|
+
namespace import named `service`, so every call site reads as `service.<member>` and a `vi.mock` of the
|
|
843
|
+
module replaces what the code actually reads. `import type` and inline `type` specifiers are allowed.
|
|
844
|
+
|
|
845
|
+
```ts
|
|
846
|
+
// ❌ Incorrect
|
|
847
|
+
import { $isOpen, fetchItemsFx } from '../services'
|
|
848
|
+
import * as services from '../services'
|
|
849
|
+
// ✅ Correct
|
|
850
|
+
import * as service from '../services'
|
|
851
|
+
import type { Item } from '../services'
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
```
|
|
855
|
+
Import `../services` as a namespace — `import * as service from '../services'` — and read members as `service.<member>`.
|
|
856
|
+
Name the `../services` namespace `service`, not `services`.
|
|
857
|
+
```
|
|
858
|
+
|
|
859
|
+
Autofix rewrites the import and prefixes every reference (`{ foo }` becomes `{ foo: service.foo }`). It
|
|
860
|
+
stands down — the report stays — when a reference is a JSX tag or a local re-export, when `service` is
|
|
861
|
+
already bound or shadowed where a reference sits, or when a file imports two different services modules.
|
|
862
|
+
Tests and stories are checked too; `index.*` barrels (which publish the services under a module-specific
|
|
863
|
+
name) and backend and e2e packages are skipped.
|
|
864
|
+
|
|
865
|
+
#### Options
|
|
866
|
+
|
|
867
|
+
| Option | Type | Default | Description |
|
|
868
|
+
| ---------------- | ---------- | ----------- | ----------------------------------- |
|
|
869
|
+
| `name` | `string` | `'service'` | The namespace binding. |
|
|
870
|
+
| `paths`/`ignore` | `string[]` | `[]` | Globs restricting / skipping files. |
|
|
871
|
+
|
|
837
872
|
### `component-name-matches-file`
|
|
838
873
|
|
|
839
874
|
The exported component is named after its file in PascalCase: `abroad-slider-component.tsx` →
|