@sj_lk/eslint-plugin-sj-plugin 0.1.5 → 0.1.6

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.
@@ -38,7 +38,7 @@ module.exports = {
38
38
  }
39
39
  ], defaultOptions: [{alias: ''}], // Add a schema if the rule has options
40
40
  messages: {
41
- layersImportError: 'Слой может импортировать в себя только нижележащие слои (shared, entities, features, widgets, pages, app'
41
+ layersImportError: 'Слой может импортировать в себя только нижележащие слои (shared, entities, features, widgets, pages, app)'
42
42
  }, // Add messageId and message
43
43
  },
44
44
 
@@ -95,7 +95,6 @@ module.exports = {
95
95
  }
96
96
 
97
97
  const isIgnored = ignoreImportPatterns.some(pattern => {
98
- console.log(importPath, pattern)
99
98
  return micromatch.isMatch(importPath, pattern)
100
99
  })
101
100
 
@@ -13,7 +13,7 @@ module.exports = {
13
13
  recommended: false,
14
14
  url: null, // URL to the documentation page for this rule
15
15
  },
16
- fixable: null, // Or `code` or `whitespace`
16
+ fixable: 'code', // Or `code` or `whitespace`
17
17
  schema: [
18
18
  {
19
19
  type: 'object',
@@ -56,6 +56,7 @@ module.exports = {
56
56
  const segments = importTo.split('/')
57
57
 
58
58
  const layer = segments[0]
59
+ const slice = segments[1]
59
60
 
60
61
  if(!allowedLayers[layer]) {
61
62
  return;
@@ -68,6 +69,9 @@ module.exports = {
68
69
  context.report({
69
70
  node,
70
71
  messageId: 'importProblem',
72
+ fix: (fixer) => {
73
+ return fixer.replaceText(node.source, `'${alias}/${layer}/${slice}'`)
74
+ }
71
75
  })
72
76
  }
73
77
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sj_lk/eslint-plugin-sj-plugin",
3
- "version": "0.1.5",
4
- "description": "add validation for layers imports",
3
+ "version": "0.1.6",
4
+ "description": "add feature sliced relative path checker, validator for layers imports and absolute imports from a public API",
5
5
  "keywords": [
6
6
  "eslint",
7
7
  "eslintplugin",