@sj_lk/eslint-plugin-sj-plugin 0.0.0 → 0.0.2
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 +13 -5
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/** @type {import('eslint').Rule.RuleModule} */
|
|
4
|
-
|
|
4
|
+
const rule = {
|
|
5
5
|
meta: {
|
|
6
|
-
type:
|
|
6
|
+
type: "suggestion", // `problem`, `suggestion`, or `layout`
|
|
7
7
|
docs: {
|
|
8
8
|
description: "feature sliced relative path checker",
|
|
9
9
|
recommended: false,
|
|
@@ -11,7 +11,9 @@ module.exports = {
|
|
|
11
11
|
},
|
|
12
12
|
fixable: null, // Or `code` or `whitespace`
|
|
13
13
|
schema: [], // Add a schema if the rule has options
|
|
14
|
-
messages: {
|
|
14
|
+
messages: {
|
|
15
|
+
someProblem: 'Линтер ругается!',
|
|
16
|
+
}, // Add messageId and message
|
|
15
17
|
},
|
|
16
18
|
|
|
17
19
|
create(context) {
|
|
@@ -21,10 +23,16 @@ module.exports = {
|
|
|
21
23
|
const importTo = node.source.value
|
|
22
24
|
|
|
23
25
|
//example /Users/LK/Desktop/ulbiPrLinter/eslint-plugin-test1/lib/rules/path-checker.js
|
|
24
|
-
const fromFilename = context.filename
|
|
26
|
+
const fromFilename = context.filename
|
|
25
27
|
|
|
26
|
-
context.report({
|
|
28
|
+
context.report({
|
|
29
|
+
node: node,
|
|
30
|
+
messageId: 'someProblem',
|
|
31
|
+
data: `Из файла: ${fromFilename} -> Импорт в: ${importTo}`
|
|
32
|
+
})
|
|
27
33
|
}
|
|
28
34
|
};
|
|
29
35
|
},
|
|
30
36
|
};
|
|
37
|
+
|
|
38
|
+
export default rule;
|