Skip to content

Commit

Permalink
chore(ci): adds a few rules to the dependency-cruiser check
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij committed Dec 13, 2023
1 parent d957593 commit 0f607a8
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 7 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@types/node": "20.10.4",
"c8": "8.0.1",
"clean-pkg-json": "1.2.0",
"dependency-cruiser": "15.5.0",
"dependency-cruiser": "16.0.0-beta-4",
"husky": "8.0.3",
"lint-staged": "15.2.0",
"prettier": "3.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/codeowners/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { ITeamMap } from "../team-map/team-map.js";
import { parse } from "../virtual-code-owners/parse.js";
import readVirtualCodeOwners from "../virtual-code-owners/read.js";
import generateCodeOwners from "./generate.js";
import { IVirtualCodeOwnersCST } from "../virtual-code-owners/cst.js";
import type { IVirtualCodeOwnersCST } from "../virtual-code-owners/cst.js";

export function generateCodeOwnersFromString(
pCodeOwnersFileAsString: string,
Expand Down
1 change: 1 addition & 0 deletions tools/dependency-cruiser-config/options.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/sverweij/dependency-cruiser/main/src/schema/configuration.schema.json#/definitions/OptionsType
doNotFollow:
path: node_modules
moduleSystems:
Expand Down
27 changes: 27 additions & 0 deletions tools/dependency-cruiser-config/rules.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=this-is-not-a-prometheus-schema
---
# rules from the 'recommended' preset:
- name: no-circular
Expand Down Expand Up @@ -145,3 +146,29 @@
to:
dependencyTypes:
- npm-peer
- name: "no-tsconfig-basedir-use"
comment:
This module depends om something directly via a 'tsconfig.json' 'baseUrl' property.
This is discouraged, unless you're still doing AMD modules.
See https://www.typescriptlang.org/tsconfig#baseUrl"
severity: "error"
from: {}
to:
dependencyTypes:
- aliased-tsconfig-base-url
- name: only-type-only-in-types
comment: This .d.ts depends on something via an import that is not 'type' only.
severity: error
from:
path: "[.]d[.][cm]?ts$"
to:
dependencyTypesNot:
- type-only
- name: only-type-only-to-dts
comment: This module depends on a .d.ts file via an import that is not 'type' only.
severity: error
from: {}
to:
path: "[.]d[.][cm]?ts$"
dependencyTypesNot:
- type-only
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"module": "NodeNext" /* Specify what module code is generated. */,
"rootDir": "./src/" /* Specify the root folder within your source files. */,
"moduleResolution": "NodeNext" /* Specify how TypeScript looks up a file from a given module specifier. */,
"baseUrl": "./" /* Specify the base directory to resolve non-relative module names. */,
// "baseUrl": "./" /* Specify the base directory to resolve non-relative module names. */,
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
Expand Down

0 comments on commit 0f607a8

Please sign in to comment.