eslint-plugin-zozu-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.
@@ -3,22 +3,33 @@
3
3
  const path = require('path');
4
4
  module.exports = {
5
5
  meta: {
6
- type: null, // `problem`, `suggestion`, or `layout`
6
+ type: null,
7
7
  docs: {
8
8
  description: "feature sliced relative path checker",
9
9
  recommended: false,
10
- url: null, // URL to the documentation page for this rule
10
+ url: null,
11
11
  },
12
- fixable: null, // Or `code` or `whitespace`
13
- schema: [], // Add a schema if the rule has options
14
- messages: {}, // Add messageId and message
12
+ fixable: null,
13
+ schema: [
14
+ {
15
+ type: 'object',
16
+ properties: {
17
+ alias: {
18
+ type: 'string',
19
+ }
20
+ }
21
+ }
22
+ ],
23
+ messages: {},
15
24
  },
16
25
 
17
26
  create(context) {
27
+ const alias = context.options[0]?.alias || '';
18
28
  return {
19
29
  ImportDeclaration(node) {
20
30
  // example app/entities/Article
21
- const importTo = node.source.value;
31
+ const value = node.source.value;
32
+ const importTo = alias ? value.replace(`${alias}/`, '') : value;
22
33
 
23
34
  // example D:/Alexandr/projects/pet-projects/src/index.tsx
24
35
  const fromFilename = context.getFilename();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-zozu-plugin",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "plugin for my pet project",
5
5
  "keywords": [
6
6
  "eslint",