Skip to content

Commit e942e29

Browse files
committed
feat: enhance linting and documentation for modular rules
1 parent 24998bf commit e942e29

11 files changed

+25
-33
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ install:
55

66
lint:
77
npx eslint . --ext .js,.vue --fix
8-
npx markdownlint README.md
8+
npx markdownlint README.md docs/**/*.md --fix
99

1010
test: lint
1111
CI=CI npx vitest

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default [
3838
rules: {
3939
'vue-modular/no-cross-feature-imports': 'error',
4040
'vue-modular/no-cross-module-imports': 'error',
41-
'vue-modular/enforce-src-structure': 'error',
41+
'vue-modular/enforce-src-structure': 'error',
4242
'vue-modular/enforce-module-exports': 'error',
4343
},
4444
languageOptions: {
@@ -70,7 +70,7 @@ module.exports = {
7070
rules: {
7171
'vue-modular/no-cross-feature-imports': 'error',
7272
'vue-modular/no-cross-module-imports': 'error',
73-
'vue-modular/enforce-src-structure': 'error',
73+
'vue-modular/enforce-src-structure': 'error',
7474
},
7575
}
7676
```

docs/rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This plugin provides rules to enforce modular architecture boundaries in Vue.js
88
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------- | ----------- | ------- |
99
| [`vue-modular/no-cross-feature-imports`](./rules/no-cross-feature-imports.md) | Prevents direct imports from deep inside feature folders | Problem |||
1010
| [`vue-modular/no-cross-module-imports`](./rules/no-cross-module-imports.md) | Prevents imports between different modules | Problem |||
11-
| [`vue-modular/enforce-src-structure`](./rules/enforce-src-structure.md) | Enforces allowed top-level folders/files in source directory | Problem |||
11+
| [`vue-modular/enforce-src-structure`](./rules/enforce-src-structure.md) | Enforces allowed top-level folders/files in source directory | Problem |||
1212
| [`vue-modular/enforce-app-structure`](./rules/enforce-app-structure.md) | Enforces presence of application infrastructure under `src/app` | Problem |||
1313
| [`vue-modular/enforce-module-exports`](./rules/enforce-module-exports.md) | Ensures modules expose a public API via index.ts/index.js | Problem |||
1414
| [`vue-modular/enforce-feature-exports`](./rules/enforce-feature-exports.md) | Ensures global features expose a public API via index.ts/index.js | Problem |||

docs/rules/enforce-app-structure.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
````markdown
2-
# vue-modular/enforce-app-structure
1+
# enforce-app-structure
32

43
**Ensure the `src/app` folder contains the required application infrastructure.**
54

@@ -22,15 +21,15 @@ Correct structure (default required entries present):
2221

2322
```text
2423
src/
25-
app/
26-
router/
27-
index.ts
28-
stores/
29-
layouts/
30-
App.vue
31-
components/
32-
modules/
33-
main.ts
24+
app/
25+
router/
26+
index.ts
27+
stores/
28+
layouts/
29+
App.vue
30+
components/
31+
modules/
32+
main.ts
3433
```
3534

3635
Missing `App.vue` or `stores` will trigger a report.
@@ -106,4 +105,3 @@ Disable this rule if you prefer no enforcement of app-level scaffolding or if yo
106105
## Further Reading
107106

108107
- [Vue 3 Project Modules Blueprint](../vue3-project-modules-blueprint.md)
109-
````

docs/rules/enforce-feature-exports.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
````markdown
2-
# vue-modular/enforce-feature-exports
1+
# enforce-feature-exports
32

43
Ensure every global feature under `src/features` exposes a public API via an `index.ts` or `index.js` file. This enforces the blueprint requirement that global features export a stable public interface.
54

@@ -28,4 +27,3 @@ Incorrect (missing index in feature):
2827
```text
2928
src/features/search/components/SearchInput.vue
3029
```
31-
````

docs/rules/enforce-import-boundaries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# `vue-modular/enforce-import-boundaries`
1+
# enforce-import-boundaries
22

33
Enforce proper import paths based on the project modules/features blueprint. By default this rule prevents deep imports into other modules or features — imports between modules/features should go through the respective public API index files.
44

docs/rules/enforce-module-exports.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
````markdown
2-
# vue-modular/enforce-module-exports
1+
# enforce-module-exports
32

43
Ensure every module under `src/modules` exposes a public API via an `index.ts` or `index.js` file. This helps the `app/` layer and other modules import modules through a stable public interface.
54

@@ -32,4 +31,3 @@ Incorrect (missing index in module):
3231
```text
3332
src/modules/auth/views/LoginView.vue
3433
```
35-
````

docs/rules/enforce-src-structure.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
````markdown
2-
# vue-modular/enforce-src-structure
1+
# enforce-src-structure
32

43
Enforce allowed top-level folders and files in the `src` directory.
54

@@ -27,5 +26,3 @@ This rule ensures that the top-level entries inside your configured source direc
2726
}
2827
}
2928
```
30-
31-
````

docs/rules/no-cross-feature-imports.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Notes:
7474

7575
## Project Structure
7676

77-
```
77+
```text
7878
src/
7979
├── features/
8080
│ ├── user/

src/rules/no-cross-feature-imports.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export default {
3333
},
3434
],
3535
messages: {
36-
crossFeatureImport:
37-
'Cannot import "{{importPath}}" from outside feature "{{featureName}}". Only imports from "{{allowedPath}}" are allowed.',
36+
crossFeatureImport: 'Cannot import "{{importPath}}" from outside "{{name}}". Only imports from "{{allowedPath}}" are allowed.',
3837
},
3938
},
4039
create(context) {
@@ -58,7 +57,7 @@ export default {
5857
context.report({
5958
node: node.source,
6059
messageId: 'crossFeatureImport',
61-
data: { importPath: source, featureName: modulePublicName, allowedPath: `@/${modulesDir}/${modulePublicName}` },
60+
data: { importPath: source, name: modulePublicName, allowedPath: `@/${modulesDir}/${modulePublicName}` },
6261
})
6362
return
6463
}
@@ -71,7 +70,7 @@ export default {
7170
context.report({
7271
node: node.source,
7372
messageId: 'crossFeatureImport',
74-
data: { importPath: source, featureName: featureInfo.featureName, allowedPath: featureInfo.allowedPath },
73+
data: { importPath: source, name: featureInfo.featureName, allowedPath: featureInfo.allowedPath },
7574
})
7675
}
7776
},

0 commit comments

Comments
 (0)