@conarti/eslint-plugin-feature-sliced 2.0.0-rc.5 → 2.0.0-rc.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.
package/dist/index.cjs CHANGED
@@ -79,7 +79,7 @@ function canLayerContainSlices(layer, config) {
79
79
  }
80
80
 
81
81
  // package.json
82
- var version = "2.0.0-rc.4";
82
+ var version = "2.0.0-rc.5";
83
83
 
84
84
  // src/rules/index.ts
85
85
  var _eslintpluginimportx = require('eslint-plugin-import-x'); var _eslintpluginimportx2 = _interopRequireDefault(_eslintpluginimportx);
@@ -1154,6 +1154,7 @@ var importOrderRuleConfigs = createImportOrderRuleConfigs();
1154
1154
  // src/create-plugin.ts
1155
1155
  function createPlugin(options = {}) {
1156
1156
  const {
1157
+ severity = "error",
1157
1158
  layers: layers2,
1158
1159
  sortImports = "recommended",
1159
1160
  absoluteRelative,
@@ -1161,7 +1162,7 @@ function createPlugin(options = {}) {
1161
1162
  publicApi
1162
1163
  } = options;
1163
1164
  const normalizedLayers = normalizeLayersConfig(layers2);
1164
- const rules2 = defineRules({ absoluteRelative, layersSlices, publicApi, sortImports }, normalizedLayers);
1165
+ const rules2 = defineRules({ severity, absoluteRelative, layersSlices, publicApi, sortImports }, normalizedLayers);
1165
1166
  return {
1166
1167
  name: PLUGIN_NAME,
1167
1168
  plugins: {
@@ -1177,12 +1178,19 @@ function createPlugin(options = {}) {
1177
1178
  }
1178
1179
  function defineRules(options, layersConfig) {
1179
1180
  const {
1181
+ severity: globalSeverity = "error",
1180
1182
  absoluteRelative = {},
1181
1183
  layersSlices = {},
1182
1184
  publicApi = {},
1183
1185
  sortImports = "recommended"
1184
1186
  } = options;
1185
- const createRuleEntry = (ruleOptions) => ruleOptions ? ["error", ruleOptions] : ["off"];
1187
+ const createRuleEntry = (ruleOptions) => {
1188
+ if (ruleOptions === false) {
1189
+ return "off";
1190
+ }
1191
+ const { severity = globalSeverity, ...restOptions } = ruleOptions;
1192
+ return [severity, restOptions];
1193
+ };
1186
1194
  const rules2 = {
1187
1195
  [RULE_NAMES.LAYERS_SLICES]: createRuleEntry(layersSlices),
1188
1196
  [RULE_NAMES.ABSOLUTE_RELATIVE]: createRuleEntry(absoluteRelative),
package/dist/index.d.cts CHANGED
@@ -72,32 +72,48 @@ type Options$2 = [
72
72
  }
73
73
  ];
74
74
 
75
+ type Severity = 'error' | 'warn';
75
76
  interface AbsoluteRelativeOptions {
77
+ /**
78
+ * Severity level for this rule
79
+ * @default uses global severity or 'error'
80
+ */
81
+ severity?: Severity;
76
82
  /**
77
83
  * Ignore certain import paths (import foo from '<path-to-ignore>')
78
84
  */
79
- ignoreImports: string[];
85
+ ignoreImports?: string[];
80
86
  /**
81
87
  * Disable the rule in certain files
82
88
  */
83
- ignoreFiles: string[];
89
+ ignoreFiles?: string[];
84
90
  }
85
91
  interface LayersSlicesOptions {
92
+ /**
93
+ * Severity level for this rule
94
+ * @default uses global severity or 'error'
95
+ */
96
+ severity?: Severity;
86
97
  /**
87
98
  * Ignore cross-imports of types
88
99
  * @default true
89
100
  */
90
- allowTypeImports: boolean;
101
+ allowTypeImports?: boolean;
91
102
  /**
92
103
  * Ignore certain import paths (import foo from '<path-to-ignore>')
93
104
  */
94
- ignoreImports: string[];
105
+ ignoreImports?: string[];
95
106
  /**
96
107
  * Disable the rule in certain files
97
108
  */
98
- ignoreFiles: string[];
109
+ ignoreFiles?: string[];
99
110
  }
100
111
  interface PublicApiOptions {
112
+ /**
113
+ * Severity level for this rule
114
+ * @default uses global severity or 'error'
115
+ */
116
+ severity?: Severity;
101
117
  /**
102
118
  * Adjusts the depth.
103
119
  * 'slices' will check for presence 'index' file at the slice level only,
@@ -105,17 +121,23 @@ interface PublicApiOptions {
105
121
  * Default is 'slices', but 'segments' is recommended
106
122
  * @default 'slices'
107
123
  */
108
- level: ValidationLevel;
124
+ level?: ValidationLevel;
109
125
  /**
110
126
  * Ignore certain import paths (import foo from '<path-to-ignore>')
111
127
  */
112
- ignoreImports: string[];
128
+ ignoreImports?: string[];
113
129
  /**
114
130
  * Disable the rule in certain files
115
131
  */
116
- ignoreFiles: string[];
132
+ ignoreFiles?: string[];
117
133
  }
118
134
  interface ESLintPluginFeatureSlicedOptions {
135
+ /**
136
+ * Global severity level for all rules.
137
+ * Can be overridden per-rule.
138
+ * @default 'error'
139
+ */
140
+ severity?: Severity;
119
141
  /**
120
142
  * Custom layers configuration.
121
143
  * Supports mixed syntax: strings for layers with slices, objects for customization.
@@ -130,9 +152,9 @@ interface ESLintPluginFeatureSlicedOptions {
130
152
  * ]
131
153
  */
132
154
  layers?: LayersConfig;
133
- absoluteRelative?: false | AbsoluteRelativeOptions;
134
- layersSlices?: false | LayersSlicesOptions;
135
- publicApi?: false | PublicApiOptions;
155
+ absoluteRelative?: false | Partial<AbsoluteRelativeOptions>;
156
+ layersSlices?: false | Partial<LayersSlicesOptions>;
157
+ publicApi?: false | Partial<PublicApiOptions>;
136
158
  sortImports?: false | ImportOrderConfigName;
137
159
  }
138
160
  declare function createPlugin(options?: ESLintPluginFeatureSlicedOptions): TypedFlatConfigItem;
@@ -177,4 +199,4 @@ declare const plugin: {
177
199
 
178
200
  // @ts-ignore
179
201
  export = createPlugin;
180
- export { type ImportOrderConfigName, type Layer, PLUGIN_NAME, RULE_NAMES, type Segment, type TypedFlatConfigItem, createPlugin, layers, plugin, segments };
202
+ export { type ImportOrderConfigName, type Layer, PLUGIN_NAME, RULE_NAMES, type Segment, type Severity, type TypedFlatConfigItem, createPlugin, layers, plugin, segments };
package/dist/index.d.ts CHANGED
@@ -72,32 +72,48 @@ type Options$2 = [
72
72
  }
73
73
  ];
74
74
 
75
+ type Severity = 'error' | 'warn';
75
76
  interface AbsoluteRelativeOptions {
77
+ /**
78
+ * Severity level for this rule
79
+ * @default uses global severity or 'error'
80
+ */
81
+ severity?: Severity;
76
82
  /**
77
83
  * Ignore certain import paths (import foo from '<path-to-ignore>')
78
84
  */
79
- ignoreImports: string[];
85
+ ignoreImports?: string[];
80
86
  /**
81
87
  * Disable the rule in certain files
82
88
  */
83
- ignoreFiles: string[];
89
+ ignoreFiles?: string[];
84
90
  }
85
91
  interface LayersSlicesOptions {
92
+ /**
93
+ * Severity level for this rule
94
+ * @default uses global severity or 'error'
95
+ */
96
+ severity?: Severity;
86
97
  /**
87
98
  * Ignore cross-imports of types
88
99
  * @default true
89
100
  */
90
- allowTypeImports: boolean;
101
+ allowTypeImports?: boolean;
91
102
  /**
92
103
  * Ignore certain import paths (import foo from '<path-to-ignore>')
93
104
  */
94
- ignoreImports: string[];
105
+ ignoreImports?: string[];
95
106
  /**
96
107
  * Disable the rule in certain files
97
108
  */
98
- ignoreFiles: string[];
109
+ ignoreFiles?: string[];
99
110
  }
100
111
  interface PublicApiOptions {
112
+ /**
113
+ * Severity level for this rule
114
+ * @default uses global severity or 'error'
115
+ */
116
+ severity?: Severity;
101
117
  /**
102
118
  * Adjusts the depth.
103
119
  * 'slices' will check for presence 'index' file at the slice level only,
@@ -105,17 +121,23 @@ interface PublicApiOptions {
105
121
  * Default is 'slices', but 'segments' is recommended
106
122
  * @default 'slices'
107
123
  */
108
- level: ValidationLevel;
124
+ level?: ValidationLevel;
109
125
  /**
110
126
  * Ignore certain import paths (import foo from '<path-to-ignore>')
111
127
  */
112
- ignoreImports: string[];
128
+ ignoreImports?: string[];
113
129
  /**
114
130
  * Disable the rule in certain files
115
131
  */
116
- ignoreFiles: string[];
132
+ ignoreFiles?: string[];
117
133
  }
118
134
  interface ESLintPluginFeatureSlicedOptions {
135
+ /**
136
+ * Global severity level for all rules.
137
+ * Can be overridden per-rule.
138
+ * @default 'error'
139
+ */
140
+ severity?: Severity;
119
141
  /**
120
142
  * Custom layers configuration.
121
143
  * Supports mixed syntax: strings for layers with slices, objects for customization.
@@ -130,9 +152,9 @@ interface ESLintPluginFeatureSlicedOptions {
130
152
  * ]
131
153
  */
132
154
  layers?: LayersConfig;
133
- absoluteRelative?: false | AbsoluteRelativeOptions;
134
- layersSlices?: false | LayersSlicesOptions;
135
- publicApi?: false | PublicApiOptions;
155
+ absoluteRelative?: false | Partial<AbsoluteRelativeOptions>;
156
+ layersSlices?: false | Partial<LayersSlicesOptions>;
157
+ publicApi?: false | Partial<PublicApiOptions>;
136
158
  sortImports?: false | ImportOrderConfigName;
137
159
  }
138
160
  declare function createPlugin(options?: ESLintPluginFeatureSlicedOptions): TypedFlatConfigItem;
@@ -175,4 +197,4 @@ declare const plugin: {
175
197
  };
176
198
  };
177
199
 
178
- export { type ImportOrderConfigName, type Layer, PLUGIN_NAME, RULE_NAMES, type Segment, type TypedFlatConfigItem, createPlugin, createPlugin as default, layers, plugin, segments };
200
+ export { type ImportOrderConfigName, type Layer, PLUGIN_NAME, RULE_NAMES, type Segment, type Severity, type TypedFlatConfigItem, createPlugin, createPlugin as default, layers, plugin, segments };
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ function canLayerContainSlices(layer, config) {
79
79
  }
80
80
 
81
81
  // package.json
82
- var version = "2.0.0-rc.4";
82
+ var version = "2.0.0-rc.5";
83
83
 
84
84
  // src/rules/index.ts
85
85
  import pluginImport from "eslint-plugin-import-x";
@@ -1154,6 +1154,7 @@ var importOrderRuleConfigs = createImportOrderRuleConfigs();
1154
1154
  // src/create-plugin.ts
1155
1155
  function createPlugin(options = {}) {
1156
1156
  const {
1157
+ severity = "error",
1157
1158
  layers: layers2,
1158
1159
  sortImports = "recommended",
1159
1160
  absoluteRelative,
@@ -1161,7 +1162,7 @@ function createPlugin(options = {}) {
1161
1162
  publicApi
1162
1163
  } = options;
1163
1164
  const normalizedLayers = normalizeLayersConfig(layers2);
1164
- const rules2 = defineRules({ absoluteRelative, layersSlices, publicApi, sortImports }, normalizedLayers);
1165
+ const rules2 = defineRules({ severity, absoluteRelative, layersSlices, publicApi, sortImports }, normalizedLayers);
1165
1166
  return {
1166
1167
  name: PLUGIN_NAME,
1167
1168
  plugins: {
@@ -1177,12 +1178,19 @@ function createPlugin(options = {}) {
1177
1178
  }
1178
1179
  function defineRules(options, layersConfig) {
1179
1180
  const {
1181
+ severity: globalSeverity = "error",
1180
1182
  absoluteRelative = {},
1181
1183
  layersSlices = {},
1182
1184
  publicApi = {},
1183
1185
  sortImports = "recommended"
1184
1186
  } = options;
1185
- const createRuleEntry = (ruleOptions) => ruleOptions ? ["error", ruleOptions] : ["off"];
1187
+ const createRuleEntry = (ruleOptions) => {
1188
+ if (ruleOptions === false) {
1189
+ return "off";
1190
+ }
1191
+ const { severity = globalSeverity, ...restOptions } = ruleOptions;
1192
+ return [severity, restOptions];
1193
+ };
1186
1194
  const rules2 = {
1187
1195
  [RULE_NAMES.LAYERS_SLICES]: createRuleEntry(layersSlices),
1188
1196
  [RULE_NAMES.ABSOLUTE_RELATIVE]: createRuleEntry(absoluteRelative),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@conarti/eslint-plugin-feature-sliced",
3
3
  "type": "module",
4
- "version": "2.0.0-rc.5",
4
+ "version": "2.0.0-rc.6",
5
5
  "description": "Feature-sliced design methodology plugin",
6
6
  "author": "Aleksandr Belous <abelous2009@gmail.com>",
7
7
  "license": "ISC",