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
|
|
2
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
74
|
+
const optionsFormats = options.find((opt) => opt.selector === attributeName)?.formats;
|
|
76
75
|
if (!optionsFormats) {
|
|
77
76
|
return;
|
|
78
77
|
}
|