@yasainet/eslint 0.0.75 → 0.0.77

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yasainet/eslint",
3
- "version": "0.0.75",
3
+ "version": "0.0.77",
4
4
  "description": "ESLint",
5
5
  "type": "module",
6
6
  "exports": {
@@ -36,7 +36,8 @@
36
36
  "access": "public"
37
37
  },
38
38
  "scripts": {
39
- "docs": "node scripts/generate-rules-catalog.mjs"
39
+ "docs": "node scripts/generate-rules-catalog.mjs",
40
+ "check": "node scripts/check-layer-selectors.mjs"
40
41
  },
41
42
  "dependencies": {
42
43
  "@stylistic/eslint-plugin": "^5.9.0",
@@ -48,5 +49,9 @@
48
49
  "peerDependencies": {
49
50
  "eslint": "^9",
50
51
  "typescript-eslint": "^8"
52
+ },
53
+ "devDependencies": {
54
+ "eslint": "^9",
55
+ "typescript-eslint": "^8"
51
56
  }
52
57
  }
@@ -9,8 +9,10 @@
9
9
  - 例 (naming): feature-name / namespace-import / form-state
10
10
  - 例 (rule): logger / jsdoc / no-any-return / supabase-columns-satisfies
11
11
  - `layers/<layer>.mjs` — features 内部の階層単位
12
- - 種類: queries / services / entries / utils / constants / schemas / types / lib / top-level-utils
12
+ - 種類: queries / services / entries / utils / constants / schemas / types
13
13
  - 1 layer の全制約 (naming + syntax + imports + local rules) を 1 file に集約
14
+ - `layers/top-level/<layer>.mjs` — features と同階層 (top-level) のディレクトリ単位
15
+ - 種類: lib / utils
14
16
  - `local-plugins/` — ESLint local plugin の実装本体
15
17
  - `index.mjs` — common entry。上記 file を合成して export
16
18
 
@@ -20,7 +20,7 @@ function findProjectRoot() {
20
20
 
21
21
  const PROJECT_ROOT = findProjectRoot();
22
22
 
23
- const EXCLUDE_LIST = ["type.ts", "proxy.ts"];
23
+ const EXCLUDE_LIST = ["type.ts", "proxy.ts", "utils.ts"];
24
24
 
25
25
  export function generatePrefixLibMapping(featureRoot) {
26
26
  const libRoot = featureRoot.replace(/features$/, "lib");
@@ -1,8 +1,8 @@
1
1
  export const LIB_BOUNDARY_PATTERNS = [
2
2
  {
3
- group: ["@/lib/*", "@/lib/**"],
3
+ regex: "^@/lib/(?!.*/utils$).+",
4
4
  message:
5
- "lib/* は queries からのみ import 可。他層は queries 経由で使う。",
5
+ "lib/* は queries からのみ import (lib/**/utils.ts の純粋ヘルパーは全層から可)。他層は queries 経由で使う。",
6
6
  },
7
7
  ];
8
8
 
@@ -13,11 +13,11 @@ import { createNoColocatedTestConfigs } from "./cross-cutting/no-colocated-test.
13
13
  import { createSupabaseColumnsSatisfiesConfigs } from "./cross-cutting/supabase-columns-satisfies.mjs";
14
14
  import { createConstantsConfigs } from "./layers/constants.mjs";
15
15
  import { createEntriesConfigs } from "./layers/entries.mjs";
16
- import { createLibLayerConfigs } from "./layers/lib.mjs";
16
+ import { createTopLevelLibConfigs } from "./layers/top-level/lib.mjs";
17
17
  import { createQueriesConfigs } from "./layers/queries.mjs";
18
18
  import { createSchemasConfigs } from "./layers/schemas.mjs";
19
19
  import { createServicesConfigs } from "./layers/services.mjs";
20
- import { createTopLevelUtilsConfigs } from "./layers/top-level-utils.mjs";
20
+ import { createTopLevelUtilsConfigs } from "./layers/top-level/utils.mjs";
21
21
  import { createTypesConfigs } from "./layers/types.mjs";
22
22
  import { createUtilsConfigs } from "./layers/utils.mjs";
23
23
 
@@ -31,11 +31,14 @@ export function createCommonConfigs(
31
31
  ...createTypescriptConfigs({ typeAware, ...(rulesFiles && { files: rulesFiles }) }),
32
32
  ...createFeatureNameConfigs(ctx),
33
33
  ...createNamespaceImportConfigs(ctx),
34
+ // logger は features/**\/*.ts 全体に no-restricted-syntax を設定するため、
35
+ // 同 rule を持つ services/queries より前に置く (flat config は後勝ちで完全置換)。
36
+ ...createLoggerConfigs(ctx),
34
37
  ...createServicesConfigs(ctx),
35
38
  ...createQueriesConfigs(ctx),
36
39
  ...createFormStateConfigs(ctx),
37
40
  ...createSupabaseColumnsSatisfiesConfigs(ctx),
38
- ...createLibLayerConfigs(ctx),
41
+ ...createTopLevelLibConfigs(ctx),
39
42
  ...createTopLevelUtilsConfigs(ctx),
40
43
  ...createTypesConfigs(ctx),
41
44
  ...createSchemasConfigs(ctx),
@@ -44,7 +47,6 @@ export function createCommonConfigs(
44
47
  ...createEntriesConfigs(ctx),
45
48
  ...createFeaturesTsOnlyConfigs(ctx),
46
49
  ...createNoColocatedTestConfigs(ctx),
47
- ...createLoggerConfigs(ctx),
48
50
  ...createNoAnyReturnConfigs(ctx),
49
51
  ...createFeatureDefaultImportsConfigs(ctx),
50
52
  ...createJsdocConfigs(ctx),
@@ -1,10 +1,10 @@
1
- import { checkFile } from "../_internal/plugins.mjs";
1
+ import { checkFile } from "../../_internal/plugins.mjs";
2
2
 
3
- export function createLibLayerConfigs({ featureRoot }) {
3
+ export function createTopLevelLibConfigs({ featureRoot }) {
4
4
  const libRoot = featureRoot.replace(/features$/, "lib");
5
5
  return [
6
6
  {
7
- name: "naming/lib",
7
+ name: "naming/top-level-lib",
8
8
  files: [`${libRoot}/**/*.ts`],
9
9
  plugins: { "check-file": checkFile },
10
10
  rules: {
@@ -1,4 +1,4 @@
1
- import { checkFile } from "../_internal/plugins.mjs";
1
+ import { checkFile } from "../../_internal/plugins.mjs";
2
2
 
3
3
  export function createTopLevelUtilsConfigs({ featureRoot }) {
4
4
  const utilsRoot = featureRoot.replace(/features$/, "utils");
@@ -511,7 +511,7 @@ export const entryTemplateRule = {
511
511
  logWrongMessage:
512
512
  "{{ where }} log message は '{{ expectedMessage }}'。実際: '{{ actual }}'。",
513
513
  logFirstArgNotObject:
514
- "'{{ funcName }}' の {{ where }} log の第1引数は object literal にする。",
514
+ "'{{ funcName }}' の {{ where }} log の第 1 引数は object literal にする。",
515
515
  logErrKeyNotFirst:
516
516
  "'{{ funcName }}' の {{ where }} log object は `err:` キーで始める。",
517
517
  logMissingInputArg: