eslint-plugin-mgw-eslint-rules 2.2.39 → 2.2.40

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.d.ts CHANGED
@@ -1,14 +1,3 @@
1
- declare const _default: {
2
- rules: {
3
- 'no-inline-styles': import("eslint").Rule.RuleModule;
4
- };
5
- configs: {
6
- recommended: {
7
- plugins: string[];
8
- rules: {
9
- 'react-props-restrictions/no-inline-styles': string;
10
- };
11
- };
12
- };
1
+ export declare const rules: {
2
+ 'no-inline-styles': import("eslint").Rule.RuleModule;
13
3
  };
14
- export = _default;
package/dist/index.js CHANGED
@@ -2,17 +2,20 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.rules = void 0;
5
7
  const no_inline_styles_1 = __importDefault(require("./rules/no-inline-styles"));
6
- module.exports = {
7
- rules: {
8
- 'no-inline-styles': no_inline_styles_1.default
9
- },
10
- configs: {
11
- recommended: {
12
- plugins: ['react-props-restrictions'],
13
- rules: {
14
- 'react-props-restrictions/no-inline-styles': 'error'
15
- }
16
- }
17
- }
18
- };
8
+ exports.rules = { 'no-inline-styles': no_inline_styles_1.default };
9
+ // export = {
10
+ // rules: {
11
+ // 'no-inline-styles': noInlineStyles
12
+ // },
13
+ // configs: {
14
+ // recommended: {
15
+ // plugins: ['react-props-restrictions'],
16
+ // rules: {
17
+ // 'react-props-restrictions/no-inline-styles': 'error'
18
+ // }
19
+ // }
20
+ // }
21
+ // };
@@ -30,8 +30,7 @@ exports.enforceAngularSignalCall = createRule({
30
30
  const checker = services.program.getTypeChecker();
31
31
  return {
32
32
  Identifier(node) {
33
- var _a;
34
- const variableNode = (_a = services.esTreeNodeToTSNodeMap) === null || _a === void 0 ? void 0 : _a.get(node);
33
+ const variableNode = services.esTreeNodeToTSNodeMap?.get(node);
35
34
  if (variableNode) {
36
35
  const type = checker.getTypeAtLocation(variableNode);
37
36
  const typeName = checker.typeToString(type);
@@ -34,7 +34,7 @@ const noInlineStyles = {
34
34
  const allowedComponents = options.allowInSpecificComponents || [];
35
35
  // Find the name of the parent component
36
36
  const jsxElement = node.parent;
37
- const componentName = (jsxElement === null || jsxElement === void 0 ? void 0 : jsxElement.type) === 'JSXOpeningElement' && jsxElement.name.type === 'JSXIdentifier' ? jsxElement.name.name : '';
37
+ const componentName = jsxElement?.type === 'JSXOpeningElement' && jsxElement.name.type === 'JSXIdentifier' ? jsxElement.name.name : '';
38
38
  // Allow inline styles in specific components defined in the options
39
39
  if (componentName && allowedComponents.includes(componentName)) {
40
40
  return;
@@ -61,18 +61,17 @@ exports.namingConvention = createRule({
61
61
  create(context, options) {
62
62
  return {
63
63
  "ElementAttribute[name.name='class'], ElementAttribute[name.name='id']"(node) {
64
- var _a, _b, _c;
65
- const value = (_a = node.value) === null || _a === void 0 ? void 0 : _a.value;
64
+ const value = node.value?.value;
66
65
  if (!value) {
67
66
  return;
68
67
  }
69
68
  // 'class' ou 'id'
70
- const attributeName = (_b = node.name) === null || _b === void 0 ? void 0 : _b.name;
69
+ const attributeName = node.name?.name;
71
70
  if (!attributeName) {
72
71
  return;
73
72
  }
74
73
  // Récupère les formats autorisés pour ce sélecteur
75
- const optionsFormats = (_c = options.find((opt) => opt.selector === attributeName)) === null || _c === void 0 ? void 0 : _c.formats;
74
+ const optionsFormats = options.find((opt) => opt.selector === attributeName)?.formats;
76
75
  if (!optionsFormats) {
77
76
  return;
78
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-mgw-eslint-rules",
3
- "version": "2.2.39",
3
+ "version": "2.2.40",
4
4
  "description": "Custom eslint rules of MegaO",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",