eslint-plugin-path-checker-new 0.0.3 → 0.0.4
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/lib/rules/path-checker.js +16 -2
- package/package.json +1 -1
|
@@ -16,15 +16,29 @@ module.exports = {
|
|
|
16
16
|
url: null, // URL to the documentation page for this rule
|
|
17
17
|
},
|
|
18
18
|
fixable: null, // Or `code` or `whitespace`
|
|
19
|
-
schema: [
|
|
19
|
+
schema: [
|
|
20
|
+
{
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
alias: {
|
|
24
|
+
type: "string",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
], // Add a schema if the rule has options
|
|
20
29
|
messages: {}, // Add messageId and message
|
|
21
30
|
},
|
|
22
31
|
|
|
23
32
|
create(context) {
|
|
33
|
+
const alias = context.options[0]?.alias || "";
|
|
34
|
+
|
|
35
|
+
console.log("alias", alias);
|
|
36
|
+
|
|
24
37
|
return {
|
|
25
38
|
ImportDeclaration(node) {
|
|
26
39
|
//example app/entities/Article
|
|
27
|
-
const
|
|
40
|
+
const value = node.source.value;
|
|
41
|
+
const importTo = alias ? value.replace(`${alias}/`, "") : value;
|
|
28
42
|
|
|
29
43
|
// example C:/Users/tim/Desktop/javascript/GOOD_COURSE_test/src/entities/Article'
|
|
30
44
|
const fromFilename = context.filename;
|