@avelonjs/bailiff 0.8.2 → 0.8.3
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 +1 -1
- package/src/rules.ts +7 -2
package/package.json
CHANGED
package/src/rules.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { posix } from 'node:path'
|
|
1
2
|
import type { Rule } from 'eslint'
|
|
2
3
|
|
|
3
4
|
interface Node {
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
classifyFile,
|
|
19
20
|
isGeneratedPath,
|
|
20
21
|
isVendorSpecifier,
|
|
22
|
+
posixPath,
|
|
21
23
|
schemaColumns,
|
|
22
24
|
wardExists,
|
|
23
25
|
type FileLayer,
|
|
@@ -172,7 +174,7 @@ function ruleModule(
|
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
const noVendorImport = ruleModule('no-vendor-import', (context, layer) => ({
|
|
175
|
-
ImportDeclaration(node) {
|
|
177
|
+
'ImportDeclaration, ExportNamedDeclaration, ExportAllDeclaration, ImportExpression'(node: Node) {
|
|
176
178
|
const specifier = specifierOf(node as ImportLike)
|
|
177
179
|
if (specifier === undefined || !isVendorSpecifier(specifier) || allowsVendor(layer)) return
|
|
178
180
|
report(
|
|
@@ -186,7 +188,10 @@ const noVendorImport = ruleModule('no-vendor-import', (context, layer) => ({
|
|
|
186
188
|
|
|
187
189
|
const noCrossLayer = ruleModule('no-cross-layer', (context, layer) => ({
|
|
188
190
|
ImportDeclaration(node) {
|
|
189
|
-
const
|
|
191
|
+
const source = specifierOf(node as ImportLike) ?? ''
|
|
192
|
+
const specifier = source.startsWith('.')
|
|
193
|
+
? posix.resolve(posix.dirname(posixPath(context.filename)), source)
|
|
194
|
+
: source
|
|
190
195
|
if (layer === 'view' && specifier.includes('/Models/')) {
|
|
191
196
|
report(
|
|
192
197
|
context,
|