eslint-plugin-big-react-app-plugin 0.0.1 → 0.0.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/lib/rules/path-checker.js +31 -21
- package/package.json +1 -1
|
@@ -1,27 +1,37 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
meta: {
|
|
7
|
+
type: null, // `problem`, `suggestion`, or `layout`
|
|
8
|
+
docs: {
|
|
9
|
+
description: "feature sliced relative path checker",
|
|
10
|
+
category: "Fill me in",
|
|
11
|
+
recommended: false,
|
|
12
|
+
url: null, // URL to the documentation page for this rule
|
|
13
|
+
},
|
|
14
|
+
fixable: null, // Or `code` or `whitespace`
|
|
15
|
+
schema: [], // Add a schema if the rule has options
|
|
10
16
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
|
|
18
|
+
create(context) {
|
|
19
|
+
return {
|
|
20
|
+
ImportDeclaration(node) {
|
|
21
|
+
// example app/entities/Article
|
|
22
|
+
const importTo = node.source.value;
|
|
23
|
+
|
|
24
|
+
// example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
|
|
25
|
+
const fromFilename = context.getFilename();
|
|
26
|
+
|
|
27
|
+
if(shouldBeRelative(fromFilename, importTo)) {
|
|
28
|
+
context.report(node, 'В рамках одного слайса все пути должны быть относительными');
|
|
29
|
+
}
|
|
21
30
|
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
25
35
|
const layers = {
|
|
26
36
|
"entities":"entities",
|
|
27
37
|
"features":"features",
|