@yasainet/eslint 0.0.37 → 0.0.39
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 +1 -16
- package/package.json +1 -5
- package/src/common/imports.mjs +24 -0
- package/src/next/index.mjs +2 -1
- package/src/hono/index.d.mts +0 -3
- package/src/hono/index.mjs +0 -6
package/README.md
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# @yasainet/eslint
|
|
2
2
|
|
|
3
|
-
Shared ESLint configuration for Next.js,
|
|
3
|
+
Shared ESLint configuration for Next.js, Node.js and Deno.
|
|
4
4
|
|
|
5
5
|
## Entry Points
|
|
6
6
|
|
|
7
7
|
| Entry | Feature Root | Entry Points | Description |
|
|
8
8
|
| ----------------------- | ------------------------------ | ----------------------- | ----------------------------- |
|
|
9
9
|
| `@yasainet/eslint/next` | `src/features/` | - | Common rules + Next.js |
|
|
10
|
-
| `@yasainet/eslint/hono` | `src/features/` | - | Common rules (web server) |
|
|
11
10
|
| `@yasainet/eslint/node` | `scripts/features/` | `scripts/commands/*.ts` | Common rules (CLI scripts) |
|
|
12
11
|
| `@yasainet/eslint/deno` | `supabase/functions/features/` | - | Common rules (Edge Functions) |
|
|
13
12
|
|
|
@@ -17,7 +16,6 @@ Shared ESLint configuration for Next.js, Hono, Node.js and Deno.
|
|
|
17
16
|
src/
|
|
18
17
|
├── common/ # Shared rules for all environments
|
|
19
18
|
├── next/ # Next.js-specific rules (hooks, components, directives)
|
|
20
|
-
├── hono/ # Hono web server (src/features)
|
|
21
19
|
├── node/ # Node.js CLI scripts (scripts/features, scripts/commands)
|
|
22
20
|
└── deno/ # Deno entry point (entry-point boundary, _utils boundary, _lib boundary)
|
|
23
21
|
```
|
|
@@ -104,19 +102,6 @@ export default defineConfig([
|
|
|
104
102
|
]);
|
|
105
103
|
```
|
|
106
104
|
|
|
107
|
-
### Hono
|
|
108
|
-
|
|
109
|
-
```sh
|
|
110
|
-
npm install -D @yasainet/eslint eslint typescript-eslint
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
```js
|
|
114
|
-
// eslint.config.mjs
|
|
115
|
-
import { eslintConfig } from "@yasainet/eslint/hono";
|
|
116
|
-
|
|
117
|
-
export default [...eslintConfig];
|
|
118
|
-
```
|
|
119
|
-
|
|
120
105
|
### Node.js
|
|
121
106
|
|
|
122
107
|
```sh
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yasainet/eslint",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"description": "ESLint",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
"types": "./src/node/index.d.mts",
|
|
13
13
|
"default": "./src/node/index.mjs"
|
|
14
14
|
},
|
|
15
|
-
"./hono": {
|
|
16
|
-
"types": "./src/hono/index.d.mts",
|
|
17
|
-
"default": "./src/hono/index.mjs"
|
|
18
|
-
},
|
|
19
15
|
"./deno": {
|
|
20
16
|
"types": "./src/deno/index.d.mts",
|
|
21
17
|
"default": "./src/deno/index.mjs"
|
package/src/common/imports.mjs
CHANGED
|
@@ -102,6 +102,19 @@ const LIB_BOUNDARY_PATTERNS = [
|
|
|
102
102
|
},
|
|
103
103
|
];
|
|
104
104
|
|
|
105
|
+
const PAGE_BOUNDARY_PATTERNS = [
|
|
106
|
+
{
|
|
107
|
+
group: ["*/repositories/*", "*/repositories"],
|
|
108
|
+
message:
|
|
109
|
+
"page.tsx can only import actions, not repositories (page-boundary violation)",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
group: ["*/services/*", "*/services"],
|
|
113
|
+
message:
|
|
114
|
+
"page.tsx can only import actions, not services (page-boundary violation)",
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
|
|
105
118
|
function makeConfig(name, files, ...patternArrays) {
|
|
106
119
|
const patterns = patternArrays.flat();
|
|
107
120
|
if (patterns.length === 0) return null;
|
|
@@ -114,6 +127,17 @@ function makeConfig(name, files, ...patternArrays) {
|
|
|
114
127
|
};
|
|
115
128
|
}
|
|
116
129
|
|
|
130
|
+
/** Next.js-only: restrict page.tsx to only import actions. */
|
|
131
|
+
export const pageBoundaryConfigs = [
|
|
132
|
+
{
|
|
133
|
+
name: "imports/page-boundary",
|
|
134
|
+
files: ["src/app/**/page.tsx"],
|
|
135
|
+
rules: {
|
|
136
|
+
"no-restricted-imports": ["error", { patterns: PAGE_BOUNDARY_PATTERNS }],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
];
|
|
140
|
+
|
|
117
141
|
/** Next.js-only: restrict @/lib imports to repositories. */
|
|
118
142
|
export const libBoundaryConfigs = [
|
|
119
143
|
{
|
package/src/next/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createEntryPointConfigs } from "../common/entry-points.mjs";
|
|
2
2
|
import { createCommonConfigs } from "../common/index.mjs";
|
|
3
|
-
import { libBoundaryConfigs } from "../common/imports.mjs";
|
|
3
|
+
import { libBoundaryConfigs, pageBoundaryConfigs } from "../common/imports.mjs";
|
|
4
4
|
|
|
5
5
|
import { directivesConfigs } from "./directives.mjs";
|
|
6
6
|
import { importPathStyleConfigs } from "./imports.mjs";
|
|
@@ -14,6 +14,7 @@ const nextEntryPointConfigs = createEntryPointConfigs(
|
|
|
14
14
|
export const eslintConfig = [
|
|
15
15
|
...createCommonConfigs("src/features"),
|
|
16
16
|
...libBoundaryConfigs,
|
|
17
|
+
...pageBoundaryConfigs,
|
|
17
18
|
...namingConfigs,
|
|
18
19
|
...directivesConfigs,
|
|
19
20
|
...importPathStyleConfigs,
|
package/src/hono/index.d.mts
DELETED