@sj_lk/eslint-plugin-sj-plugin 0.1.0 → 0.1.1

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.
@@ -12,16 +12,28 @@ const rule = {
12
12
  url: null, // URL to the documentation page for this rule
13
13
  },
14
14
  fixable: null, // Or `code` or `whitespace`
15
- schema: [], // Add a schema if the rule has options
15
+ schema: [
16
+ {
17
+ type: 'object',
18
+ properties: {
19
+ alias: {
20
+ type: 'string',
21
+ description: 'alias for the rule',
22
+ }
23
+ }
24
+ }
25
+ ], defaultOptions: [{alias: ''}], // Add a schema if the rule has options
16
26
  messages: {
17
27
  someProblem: 'В рамках одного слайса все пути должны быть относительными',
18
28
  }, // Add messageId and message
19
29
  },
20
30
 
21
31
  create(context) {
32
+ const alias = context.options[0]?.alias || ''
22
33
  return {
23
34
  ImportDeclaration(node) {
24
- const importTo = node.source.value
35
+ const value = node.source.value
36
+ const importTo = alias ? value.replace(`${alias}/`, '') : value
25
37
  const fromFilename = context.filename
26
38
 
27
39
  if(shouldBeRelative(fromFilename, importTo)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sj_lk/eslint-plugin-sj-plugin",
3
- "version": "0.1.0",
4
- "description": "path-checker is working now",
3
+ "version": "0.1.1",
4
+ "description": "add working alias for the rule",
5
5
  "keywords": [
6
6
  "eslint",
7
7
  "eslintplugin",