@o3r/eslint-plugin 9.5.0 → 9.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/eslint-plugin",
3
- "version": "9.5.0",
3
+ "version": "9.5.2",
4
4
  "description": "The module provides in-house eslint plugins to use in your own eslint configuration.",
5
5
  "main": "./src/public_api.js",
6
6
  "keywords": [
@@ -55,7 +55,7 @@
55
55
  "@compodoc/compodoc": "^1.1.19",
56
56
  "@nx/eslint-plugin": "~16.10.0",
57
57
  "@nx/jest": "~16.10.0",
58
- "@o3r/build-helpers": "^9.5.0",
58
+ "@o3r/build-helpers": "^9.5.2",
59
59
  "@types/jest": "~29.5.2",
60
60
  "@types/node": "^18.0.0",
61
61
  "@types/semver": "^7.3.13",
@@ -35,9 +35,8 @@ exports.default = (0, utils_2.createRule)({
35
35
  fixable: undefined
36
36
  },
37
37
  defaultOptions,
38
- create: (context) => {
38
+ create: (context, [options]) => {
39
39
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
40
- const options = context.options[0] || defaultOptions[0];
41
40
  const asyncRegExp = /\| *async\b/g;
42
41
  return {
43
42
  // eslint-disable-next-line @typescript-eslint/naming-convention
@@ -12,5 +12,5 @@ export interface O3rWidgetTagsRuleOption {
12
12
  };
13
13
  }
14
14
  type O3rWidgetRuleErrorId = 'notInConfigurationInterface' | 'notSupportedType' | 'notSupportedParamForType' | 'invalidParamValueType' | 'noParamWithoutWidget' | 'onlyOneWidgetAllowed' | 'duplicatedParam' | 'requiredParamMissing' | 'suggestParamMissing' | 'suggestRemoveDuplicatedO3rWidget' | 'suggestRemoveDuplicatedO3rWidgetParam' | 'suggestAddO3rWidgetTag' | 'suggestReplaceO3rWidgetType';
15
- declare const _default: TSESLint.RuleModule<O3rWidgetRuleErrorId, O3rWidgetTagsRuleOption[], TSESLint.RuleListener>;
15
+ declare const _default: TSESLint.RuleModule<O3rWidgetRuleErrorId, [Required<O3rWidgetTagsRuleOption>, ...any[]], TSESLint.RuleListener>;
16
16
  export default _default;
@@ -5,6 +5,10 @@ const utils_1 = require("../../utils");
5
5
  const o3rWidgetParameterPattern = '^[a-zA-Z0-9-_:.]+$';
6
6
  const o3rWidgetParamTypes = ['string', 'number', 'boolean', 'string[]', 'number[]', 'boolean[]'];
7
7
  const createCommentString = (comment) => `/*${comment}*/`;
8
+ const defaultOptions = [{
9
+ supportedInterfaceNames: ['Configuration', 'NestedConfiguration'],
10
+ widgets: {}
11
+ }];
8
12
  exports.default = (0, utils_1.createRule)({
9
13
  name: 'o3r-widget-tags',
10
14
  meta: {
@@ -66,17 +70,8 @@ exports.default = (0, utils_1.createRule)({
66
70
  suggestReplaceO3rWidgetType: 'Replace {{ currentType }} by {{ suggestedType }}.'
67
71
  }
68
72
  },
69
- defaultOptions: [],
70
- create: (context) => {
71
- const options = context.options
72
- .reduce((acc, option) => {
73
- acc.supportedInterfaceNames = (acc.supportedInterfaceNames || []).concat(option.supportedInterfaceNames || []);
74
- acc.widgets = {
75
- ...acc.widgets,
76
- ...option.widgets
77
- };
78
- return acc;
79
- }, { widgets: {}, supportedInterfaceNames: ['Configuration', 'NestedConfiguration'] });
73
+ defaultOptions,
74
+ create: (context, [options]) => {
80
75
  const supportedO3rWidgets = new Set(Object.keys(options.widgets));
81
76
  return {
82
77
  // eslint-disable-next-line @typescript-eslint/naming-convention