@alfresco/eslint-plugin-eslint-angular 7.0.0-alpha.8-13070814523 → 7.0.0-alpha.8-13071895950

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/main.js ADDED
@@ -0,0 +1,313 @@
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ([
4
+ /* 0 */
5
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
6
+
7
+
8
+ /*!
9
+ * @license
10
+ * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ var desc = Object.getOwnPropertyDescriptor(m, k);
27
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
28
+ desc = { enumerable: true, get: function() { return m[k]; } };
29
+ }
30
+ Object.defineProperty(o, k2, desc);
31
+ }) : (function(o, m, k, k2) {
32
+ if (k2 === undefined) k2 = k;
33
+ o[k2] = m[k];
34
+ }));
35
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
36
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
37
+ }) : function(o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar = (this && this.__importStar) || function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ const use_none_component_view_encapsulation_1 = __importStar(__webpack_require__(1));
48
+ const no_angular_material_selectors_1 = __importStar(__webpack_require__(5));
49
+ module.exports = {
50
+ rules: {
51
+ [use_none_component_view_encapsulation_1.RULE_NAME]: use_none_component_view_encapsulation_1.default,
52
+ [no_angular_material_selectors_1.RULE_NAME]: no_angular_material_selectors_1.default
53
+ }
54
+ };
55
+
56
+
57
+ /***/ }),
58
+ /* 1 */
59
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
60
+
61
+
62
+ /*!
63
+ * @license
64
+ * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
65
+ *
66
+ * Licensed under the Apache License, Version 2.0 (the "License");
67
+ * you may not use this file except in compliance with the License.
68
+ * You may obtain a copy of the License at
69
+ *
70
+ * http://www.apache.org/licenses/LICENSE-2.0
71
+ *
72
+ * Unless required by applicable law or agreed to in writing, software
73
+ * distributed under the License is distributed on an "AS IS" BASIS,
74
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
75
+ * See the License for the specific language governing permissions and
76
+ * limitations under the License.
77
+ */
78
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
79
+ exports.RULE_NAME = void 0;
80
+ const utils_1 = __webpack_require__(2);
81
+ const create_eslint_rule_1 = __webpack_require__(3);
82
+ exports.RULE_NAME = 'use-none-component-view-encapsulation';
83
+ const metadataPropertyName = 'encapsulation';
84
+ const viewEncapsulationNone = 'ViewEncapsulation.None';
85
+ const nodeToReport = (node) => {
86
+ if (!utils_1.ASTUtils.isProperty(node)) {
87
+ return node;
88
+ }
89
+ return utils_1.ASTUtils.isMemberExpression(node.value) ? node.value.property : node.value;
90
+ };
91
+ /**
92
+ * Custom ESLint rule which check if component uses ViewEncapsulation.None. It has been implemented because None encapsulation makes themes styling easier.
93
+ * It also allows to autofix.
94
+ */
95
+ exports["default"] = (0, create_eslint_rule_1.createESLintRule)({
96
+ name: exports.RULE_NAME,
97
+ meta: {
98
+ type: 'suggestion',
99
+ docs: {
100
+ description: `Disallows using other encapsulation than \`${viewEncapsulationNone}\``,
101
+ recommended: false
102
+ },
103
+ hasSuggestions: true,
104
+ schema: [],
105
+ messages: {
106
+ useNoneComponentViewEncapsulation: `Using encapsulation other than '${viewEncapsulationNone}' makes themes styling harder.`,
107
+ suggestAddViewEncapsulationNone: `Add '${viewEncapsulationNone}'`
108
+ }
109
+ },
110
+ defaultOptions: [],
111
+ create(context) {
112
+ const encapsulationProperty = utils_1.Selectors.metadataProperty(metadataPropertyName);
113
+ const withoutEncapsulationProperty = `${utils_1.Selectors.COMPONENT_CLASS_DECORATOR}:matches([expression.arguments.length=0], [expression.arguments.0.type='ObjectExpression']:not(:has(${encapsulationProperty})))`;
114
+ const nonNoneViewEncapsulationNoneProperty = `${utils_1.Selectors.COMPONENT_CLASS_DECORATOR} > CallExpression > ObjectExpression > ` +
115
+ `${encapsulationProperty}:matches([value.type='Identifier'][value.name='undefined'], [value.object.name='ViewEncapsulation'][value.property.name!='None'])`;
116
+ const selectors = [
117
+ withoutEncapsulationProperty,
118
+ nonNoneViewEncapsulationNoneProperty
119
+ ].join(',');
120
+ return {
121
+ [selectors](node) {
122
+ context.report({
123
+ node: nodeToReport(node),
124
+ messageId: 'useNoneComponentViewEncapsulation',
125
+ suggest: [
126
+ {
127
+ messageId: 'suggestAddViewEncapsulationNone',
128
+ fix: (fixer) => {
129
+ if (utils_1.ASTUtils.isProperty(node)) {
130
+ return [
131
+ utils_1.RuleFixes.getImportAddFix({
132
+ fixer,
133
+ importName: 'ViewEncapsulation',
134
+ moduleName: '@angular/core',
135
+ node: node.parent.parent.parent.parent
136
+ }),
137
+ utils_1.ASTUtils.isMemberExpression(node.value)
138
+ ? fixer.replaceText(node.value.property, 'None')
139
+ : fixer.replaceText(node.value, viewEncapsulationNone)
140
+ ].filter(utils_1.isNotNullOrUndefined);
141
+ }
142
+ return [
143
+ utils_1.RuleFixes.getImportAddFix({
144
+ fixer,
145
+ importName: 'ViewEncapsulation',
146
+ moduleName: '@angular/core',
147
+ node: node.parent
148
+ }),
149
+ utils_1.RuleFixes.getDecoratorPropertyAddFix(node, fixer, `${metadataPropertyName}: ${viewEncapsulationNone}`)
150
+ ].filter(utils_1.isNotNullOrUndefined);
151
+ }
152
+ }
153
+ ]
154
+ });
155
+ }
156
+ };
157
+ }
158
+ });
159
+
160
+
161
+ /***/ }),
162
+ /* 2 */
163
+ /***/ ((module) => {
164
+
165
+ module.exports = require("@angular-eslint/utils");
166
+
167
+ /***/ }),
168
+ /* 3 */
169
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
170
+
171
+
172
+ /*!
173
+ * @license
174
+ * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
175
+ *
176
+ * Licensed under the Apache License, Version 2.0 (the "License");
177
+ * you may not use this file except in compliance with the License.
178
+ * You may obtain a copy of the License at
179
+ *
180
+ * http://www.apache.org/licenses/LICENSE-2.0
181
+ *
182
+ * Unless required by applicable law or agreed to in writing, software
183
+ * distributed under the License is distributed on an "AS IS" BASIS,
184
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
185
+ * See the License for the specific language governing permissions and
186
+ * limitations under the License.
187
+ */
188
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
189
+ exports.createESLintRule = void 0;
190
+ const utils_1 = __webpack_require__(4);
191
+ exports.createESLintRule = utils_1.ESLintUtils.RuleCreator((ruleName) => ruleName);
192
+
193
+
194
+ /***/ }),
195
+ /* 4 */
196
+ /***/ ((module) => {
197
+
198
+ module.exports = require("@typescript-eslint/utils");
199
+
200
+ /***/ }),
201
+ /* 5 */
202
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
203
+
204
+
205
+ /*!
206
+ * @license
207
+ * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
208
+ *
209
+ * Licensed under the Apache License, Version 2.0 (the "License");
210
+ * you may not use this file except in compliance with the License.
211
+ * You may obtain a copy of the License at
212
+ *
213
+ * http://www.apache.org/licenses/LICENSE-2.0
214
+ *
215
+ * Unless required by applicable law or agreed to in writing, software
216
+ * distributed under the License is distributed on an "AS IS" BASIS,
217
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
218
+ * See the License for the specific language governing permissions and
219
+ * limitations under the License.
220
+ */
221
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
222
+ exports.RULE_NAME = void 0;
223
+ const create_eslint_rule_1 = __webpack_require__(3);
224
+ exports.RULE_NAME = 'no-angular-material-selectors';
225
+ const ASTSelectors = [
226
+ ':not(Property[key.name="template"]) Literal[value=/(\\.|\\s|^)(mat-(?!datetimepicker)|mdc-)/i]',
227
+ ':not(Property[key.name="template"]) > TemplateLiteral > TemplateElement[value.raw=/(\\.|\\s|^)(mat-(?!datetimepicker)|mdc-)/i]'
228
+ ];
229
+ const messages = {
230
+ noAngularMaterialSelectors: 'Using Angular Material internal selectors is not allowed',
231
+ useAngularMaterialTestingHarness: 'Use testing harness instead of Angular Material internal selectors',
232
+ useE2ELocatorVariables: 'Use locator variables instead of Angular Material internal selectors'
233
+ };
234
+ const filetypeErrors = [
235
+ {
236
+ regexp: /.*\.spec\.ts/,
237
+ messageId: 'useAngularMaterialTestingHarness'
238
+ },
239
+ {
240
+ regexp: /.*\.e2e\.ts/,
241
+ messageId: 'useE2ELocatorVariables'
242
+ }
243
+ ];
244
+ /**
245
+ * Custom ESLint rule for detecting the usage of internal Angular Material selectors
246
+ */
247
+ exports["default"] = (0, create_eslint_rule_1.createESLintRule)({
248
+ name: exports.RULE_NAME,
249
+ meta: {
250
+ type: 'suggestion',
251
+ docs: {
252
+ description: 'Disallows using Angular Material internal selectors',
253
+ recommended: 'error'
254
+ },
255
+ hasSuggestions: true,
256
+ schema: [],
257
+ messages
258
+ },
259
+ defaultOptions: [],
260
+ create(context) {
261
+ return {
262
+ [ASTSelectors.join(',')](node) {
263
+ const message = filetypeErrors.find((fileTypeError) => context.getFilename().match(fileTypeError.regexp)) || { messageId: 'noAngularMaterialSelectors' };
264
+ context.report({
265
+ node,
266
+ messageId: message.messageId
267
+ });
268
+ }
269
+ };
270
+ }
271
+ });
272
+
273
+
274
+ /***/ })
275
+ /******/ ]);
276
+ /************************************************************************/
277
+ /******/ // The module cache
278
+ /******/ var __webpack_module_cache__ = {};
279
+ /******/
280
+ /******/ // The require function
281
+ /******/ function __webpack_require__(moduleId) {
282
+ /******/ // Check if module is in cache
283
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
284
+ /******/ if (cachedModule !== undefined) {
285
+ /******/ return cachedModule.exports;
286
+ /******/ }
287
+ /******/ // Create a new module (and put it into the cache)
288
+ /******/ var module = __webpack_module_cache__[moduleId] = {
289
+ /******/ // no module.id needed
290
+ /******/ // no module.loaded needed
291
+ /******/ exports: {}
292
+ /******/ };
293
+ /******/
294
+ /******/ // Execute the module function
295
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
296
+ /******/
297
+ /******/ // Return the exports of the module
298
+ /******/ return module.exports;
299
+ /******/ }
300
+ /******/
301
+ /************************************************************************/
302
+ /******/
303
+ /******/ // startup
304
+ /******/ // Load entry module and return exports
305
+ /******/ // This entry module is referenced by other modules so it can't be inlined
306
+ /******/ var __webpack_exports__ = __webpack_require__(0);
307
+ /******/ var __webpack_export_target__ = exports;
308
+ /******/ for(var __webpack_i__ in __webpack_exports__) __webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
309
+ /******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
310
+ /******/
311
+ /******/ })()
312
+ ;
313
+ //# sourceMappingURL=main.js.map
package/main.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","mappings":";;;;;;AAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA,0CAA0C,4BAA4B;AACtE,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,mBAAO,CAAC,CAAyF;AAC9J,qDAAqD,mBAAO,CAAC,CAAyE;AACtI;AACA;AACA;AACA;AACA;AACA;;;;;;;AC/Ca;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB,gBAAgB,mBAAO,CAAC,CAAuB;AAC/C,6BAA6B,mBAAO,CAAC,CAAmD;AACxF,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA,uEAAuE,sBAAsB;AAC7F;AACA,SAAS;AACT;AACA;AACA;AACA,kFAAkF,sBAAsB;AACxG,qDAAqD,sBAAsB;AAC3E;AACA,KAAK;AACL;AACA;AACA;AACA,gDAAgD,4CAA4C,sGAAsG,sBAAsB;AACxN,wDAAwD,6CAA6C;AACrG,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC,iGAAiG,qBAAqB,IAAI,sBAAsB;AAChJ;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,CAAC;;;;;;;ACjGD;;;;;;ACAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,wBAAwB;AACxB,gBAAgB,mBAAO,CAAC,CAA0B;AAClD,wBAAwB;;;;;;;ACpBxB;;;;;;ACAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB,6BAA6B,mBAAO,CAAC,CAAmD;AACxF,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,+HAA+H;AAC/H;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,CAAC;;;;;;UCnED;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://@alfresco/eslint-plugin-eslint-angular/./index.ts","webpack://@alfresco/eslint-plugin-eslint-angular/./src/rules/use-none-component-view-encapsulation/use-none-component-view-encapsulation.ts","webpack://@alfresco/eslint-plugin-eslint-angular/external commonjs \"@angular-eslint/utils\"","webpack://@alfresco/eslint-plugin-eslint-angular/./src/utils/create-eslint-rule/create-eslint-rule.ts","webpack://@alfresco/eslint-plugin-eslint-angular/external commonjs \"@typescript-eslint/utils\"","webpack://@alfresco/eslint-plugin-eslint-angular/./src/rules/no-angular-material-selectors/no-angular-material-selectors.ts","webpack://@alfresco/eslint-plugin-eslint-angular/webpack/bootstrap","webpack://@alfresco/eslint-plugin-eslint-angular/webpack/before-startup","webpack://@alfresco/eslint-plugin-eslint-angular/webpack/startup","webpack://@alfresco/eslint-plugin-eslint-angular/webpack/after-startup"],"sourcesContent":["\"use strict\";\n/*!\n * @license\n * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nconst use_none_component_view_encapsulation_1 = __importStar(require(\"./src/rules/use-none-component-view-encapsulation/use-none-component-view-encapsulation\"));\nconst no_angular_material_selectors_1 = __importStar(require(\"./src/rules/no-angular-material-selectors/no-angular-material-selectors\"));\nmodule.exports = {\n rules: {\n [use_none_component_view_encapsulation_1.RULE_NAME]: use_none_component_view_encapsulation_1.default,\n [no_angular_material_selectors_1.RULE_NAME]: no_angular_material_selectors_1.default\n }\n};\n","\"use strict\";\n/*!\n * @license\n * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RULE_NAME = void 0;\nconst utils_1 = require(\"@angular-eslint/utils\");\nconst create_eslint_rule_1 = require(\"../../utils/create-eslint-rule/create-eslint-rule\");\nexports.RULE_NAME = 'use-none-component-view-encapsulation';\nconst metadataPropertyName = 'encapsulation';\nconst viewEncapsulationNone = 'ViewEncapsulation.None';\nconst nodeToReport = (node) => {\n if (!utils_1.ASTUtils.isProperty(node)) {\n return node;\n }\n return utils_1.ASTUtils.isMemberExpression(node.value) ? node.value.property : node.value;\n};\n/**\n * Custom ESLint rule which check if component uses ViewEncapsulation.None. It has been implemented because None encapsulation makes themes styling easier.\n * It also allows to autofix.\n */\nexports.default = (0, create_eslint_rule_1.createESLintRule)({\n name: exports.RULE_NAME,\n meta: {\n type: 'suggestion',\n docs: {\n description: `Disallows using other encapsulation than \\`${viewEncapsulationNone}\\``,\n recommended: false\n },\n hasSuggestions: true,\n schema: [],\n messages: {\n useNoneComponentViewEncapsulation: `Using encapsulation other than '${viewEncapsulationNone}' makes themes styling harder.`,\n suggestAddViewEncapsulationNone: `Add '${viewEncapsulationNone}'`\n }\n },\n defaultOptions: [],\n create(context) {\n const encapsulationProperty = utils_1.Selectors.metadataProperty(metadataPropertyName);\n const withoutEncapsulationProperty = `${utils_1.Selectors.COMPONENT_CLASS_DECORATOR}:matches([expression.arguments.length=0], [expression.arguments.0.type='ObjectExpression']:not(:has(${encapsulationProperty})))`;\n const nonNoneViewEncapsulationNoneProperty = `${utils_1.Selectors.COMPONENT_CLASS_DECORATOR} > CallExpression > ObjectExpression > ` +\n `${encapsulationProperty}:matches([value.type='Identifier'][value.name='undefined'], [value.object.name='ViewEncapsulation'][value.property.name!='None'])`;\n const selectors = [\n withoutEncapsulationProperty,\n nonNoneViewEncapsulationNoneProperty\n ].join(',');\n return {\n [selectors](node) {\n context.report({\n node: nodeToReport(node),\n messageId: 'useNoneComponentViewEncapsulation',\n suggest: [\n {\n messageId: 'suggestAddViewEncapsulationNone',\n fix: (fixer) => {\n if (utils_1.ASTUtils.isProperty(node)) {\n return [\n utils_1.RuleFixes.getImportAddFix({\n fixer,\n importName: 'ViewEncapsulation',\n moduleName: '@angular/core',\n node: node.parent.parent.parent.parent\n }),\n utils_1.ASTUtils.isMemberExpression(node.value)\n ? fixer.replaceText(node.value.property, 'None')\n : fixer.replaceText(node.value, viewEncapsulationNone)\n ].filter(utils_1.isNotNullOrUndefined);\n }\n return [\n utils_1.RuleFixes.getImportAddFix({\n fixer,\n importName: 'ViewEncapsulation',\n moduleName: '@angular/core',\n node: node.parent\n }),\n utils_1.RuleFixes.getDecoratorPropertyAddFix(node, fixer, `${metadataPropertyName}: ${viewEncapsulationNone}`)\n ].filter(utils_1.isNotNullOrUndefined);\n }\n }\n ]\n });\n }\n };\n }\n});\n","module.exports = require(\"@angular-eslint/utils\");","\"use strict\";\n/*!\n * @license\n * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createESLintRule = void 0;\nconst utils_1 = require(\"@typescript-eslint/utils\");\nexports.createESLintRule = utils_1.ESLintUtils.RuleCreator((ruleName) => ruleName);\n","module.exports = require(\"@typescript-eslint/utils\");","\"use strict\";\n/*!\n * @license\n * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RULE_NAME = void 0;\nconst create_eslint_rule_1 = require(\"../../utils/create-eslint-rule/create-eslint-rule\");\nexports.RULE_NAME = 'no-angular-material-selectors';\nconst ASTSelectors = [\n ':not(Property[key.name=\"template\"]) Literal[value=/(\\\\.|\\\\s|^)(mat-(?!datetimepicker)|mdc-)/i]',\n ':not(Property[key.name=\"template\"]) > TemplateLiteral > TemplateElement[value.raw=/(\\\\.|\\\\s|^)(mat-(?!datetimepicker)|mdc-)/i]'\n];\nconst messages = {\n noAngularMaterialSelectors: 'Using Angular Material internal selectors is not allowed',\n useAngularMaterialTestingHarness: 'Use testing harness instead of Angular Material internal selectors',\n useE2ELocatorVariables: 'Use locator variables instead of Angular Material internal selectors'\n};\nconst filetypeErrors = [\n {\n regexp: /.*\\.spec\\.ts/,\n messageId: 'useAngularMaterialTestingHarness'\n },\n {\n regexp: /.*\\.e2e\\.ts/,\n messageId: 'useE2ELocatorVariables'\n }\n];\n/**\n * Custom ESLint rule for detecting the usage of internal Angular Material selectors\n */\nexports.default = (0, create_eslint_rule_1.createESLintRule)({\n name: exports.RULE_NAME,\n meta: {\n type: 'suggestion',\n docs: {\n description: 'Disallows using Angular Material internal selectors',\n recommended: 'error'\n },\n hasSuggestions: true,\n schema: [],\n messages\n },\n defaultOptions: [],\n create(context) {\n return {\n [ASTSelectors.join(',')](node) {\n const message = filetypeErrors.find((fileTypeError) => context.getFilename().match(fileTypeError.regexp)) || { messageId: 'noAngularMaterialSelectors' };\n context.report({\n node,\n messageId: message.messageId\n });\n }\n };\n }\n});\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(0);\n",""],"names":[],"sourceRoot":""}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@alfresco/eslint-plugin-eslint-angular",
3
- "version": "7.0.0-alpha.8-13070814523",
3
+ "version": "7.0.0-alpha.8-13071895950",
4
4
  "description": "Alfresco ADF eslint angular custom rules",
5
- "main": "./index.js",
5
+ "main": "main.js",
6
6
  "author": "Hyland Software, Inc. and its affiliates",
7
7
  "repository": {
8
8
  "type": "git",
@@ -19,5 +19,8 @@
19
19
  "publishConfig": {
20
20
  "access": "public"
21
21
  },
22
- "type": "commonjs"
22
+ "dependencies": {
23
+ "@angular-eslint/utils": "16.3.1",
24
+ "@typescript-eslint/utils": "5.62.0"
25
+ }
23
26
  }
package/index.js DELETED
@@ -1,48 +0,0 @@
1
- "use strict";
2
- /*!
3
- * @license
4
- * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- var desc = Object.getOwnPropertyDescriptor(m, k);
21
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
- desc = { enumerable: true, get: function() { return m[k]; } };
23
- }
24
- Object.defineProperty(o, k2, desc);
25
- }) : (function(o, m, k, k2) {
26
- if (k2 === undefined) k2 = k;
27
- o[k2] = m[k];
28
- }));
29
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
30
- Object.defineProperty(o, "default", { enumerable: true, value: v });
31
- }) : function(o, v) {
32
- o["default"] = v;
33
- });
34
- var __importStar = (this && this.__importStar) || function (mod) {
35
- if (mod && mod.__esModule) return mod;
36
- var result = {};
37
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
38
- __setModuleDefault(result, mod);
39
- return result;
40
- };
41
- const use_none_component_view_encapsulation_1 = __importStar(require("./src/rules/use-none-component-view-encapsulation/use-none-component-view-encapsulation"));
42
- const no_angular_material_selectors_1 = __importStar(require("./src/rules/no-angular-material-selectors/no-angular-material-selectors"));
43
- module.exports = {
44
- rules: {
45
- [use_none_component_view_encapsulation_1.RULE_NAME]: use_none_component_view_encapsulation_1.default,
46
- [no_angular_material_selectors_1.RULE_NAME]: no_angular_material_selectors_1.default
47
- }
48
- };
@@ -1,69 +0,0 @@
1
- "use strict";
2
- /*!
3
- * @license
4
- * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.RULE_NAME = void 0;
20
- const create_eslint_rule_1 = require("../../utils/create-eslint-rule/create-eslint-rule");
21
- exports.RULE_NAME = 'no-angular-material-selectors';
22
- const ASTSelectors = [
23
- ':not(Property[key.name="template"]) Literal[value=/(\\.|\\s|^)(mat-(?!datetimepicker)|mdc-)/i]',
24
- ':not(Property[key.name="template"]) > TemplateLiteral > TemplateElement[value.raw=/(\\.|\\s|^)(mat-(?!datetimepicker)|mdc-)/i]'
25
- ];
26
- const messages = {
27
- noAngularMaterialSelectors: 'Using Angular Material internal selectors is not allowed',
28
- useAngularMaterialTestingHarness: 'Use testing harness instead of Angular Material internal selectors',
29
- useE2ELocatorVariables: 'Use locator variables instead of Angular Material internal selectors'
30
- };
31
- const filetypeErrors = [
32
- {
33
- regexp: /.*\.spec\.ts/,
34
- messageId: 'useAngularMaterialTestingHarness'
35
- },
36
- {
37
- regexp: /.*\.e2e\.ts/,
38
- messageId: 'useE2ELocatorVariables'
39
- }
40
- ];
41
- /**
42
- * Custom ESLint rule for detecting the usage of internal Angular Material selectors
43
- */
44
- exports.default = (0, create_eslint_rule_1.createESLintRule)({
45
- name: exports.RULE_NAME,
46
- meta: {
47
- type: 'suggestion',
48
- docs: {
49
- description: 'Disallows using Angular Material internal selectors'
50
- },
51
- hasSuggestions: true,
52
- schema: [],
53
- messages
54
- },
55
- defaultOptions: [],
56
- create(context) {
57
- return {
58
- [ASTSelectors.join(',')](node) {
59
- const message = filetypeErrors.find((fileTypeError) => context.getFilename().match(fileTypeError.regexp)) || {
60
- messageId: 'noAngularMaterialSelectors'
61
- };
62
- context.report({
63
- node,
64
- messageId: message.messageId
65
- });
66
- }
67
- };
68
- }
69
- });
@@ -1,94 +0,0 @@
1
- "use strict";
2
- /*!
3
- * @license
4
- * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.RULE_NAME = void 0;
20
- const utils_1 = require("@angular-eslint/utils");
21
- const create_eslint_rule_1 = require("../../utils/create-eslint-rule/create-eslint-rule");
22
- exports.RULE_NAME = 'use-none-component-view-encapsulation';
23
- const metadataPropertyName = 'encapsulation';
24
- const viewEncapsulationNone = 'ViewEncapsulation.None';
25
- const nodeToReport = (node) => {
26
- if (!utils_1.ASTUtils.isProperty(node)) {
27
- return node;
28
- }
29
- return utils_1.ASTUtils.isMemberExpression(node.value) ? node.value.property : node.value;
30
- };
31
- /**
32
- * Custom ESLint rule which check if component uses ViewEncapsulation.None. It has been implemented because None encapsulation makes themes styling easier.
33
- * It also allows to autofix.
34
- */
35
- exports.default = (0, create_eslint_rule_1.createESLintRule)({
36
- name: exports.RULE_NAME,
37
- meta: {
38
- type: 'suggestion',
39
- docs: {
40
- description: `Disallows using other encapsulation than \`${viewEncapsulationNone}\``
41
- },
42
- hasSuggestions: true,
43
- schema: [],
44
- messages: {
45
- useNoneComponentViewEncapsulation: `Using encapsulation other than '${viewEncapsulationNone}' makes themes styling harder.`,
46
- suggestAddViewEncapsulationNone: `Add '${viewEncapsulationNone}'`
47
- }
48
- },
49
- defaultOptions: [],
50
- create(context) {
51
- const encapsulationProperty = utils_1.Selectors.metadataProperty(metadataPropertyName);
52
- const withoutEncapsulationProperty = `${utils_1.Selectors.COMPONENT_CLASS_DECORATOR}:matches([expression.arguments.length=0], [expression.arguments.0.type='ObjectExpression']:not(:has(${encapsulationProperty})))`;
53
- const nonNoneViewEncapsulationNoneProperty = `${utils_1.Selectors.COMPONENT_CLASS_DECORATOR} > CallExpression > ObjectExpression > ` +
54
- `${encapsulationProperty}:matches([value.type='Identifier'][value.name='undefined'], [value.object.name='ViewEncapsulation'][value.property.name!='None'])`;
55
- const selectors = [withoutEncapsulationProperty, nonNoneViewEncapsulationNoneProperty].join(',');
56
- return {
57
- [selectors](node) {
58
- context.report({
59
- node: nodeToReport(node),
60
- messageId: 'useNoneComponentViewEncapsulation',
61
- suggest: [
62
- {
63
- messageId: 'suggestAddViewEncapsulationNone',
64
- fix: (fixer) => {
65
- if (utils_1.ASTUtils.isProperty(node)) {
66
- return [
67
- utils_1.RuleFixes.getImportAddFix({
68
- fixer,
69
- importName: 'ViewEncapsulation',
70
- moduleName: '@angular/core',
71
- node: node.parent
72
- }),
73
- utils_1.ASTUtils.isMemberExpression(node.value)
74
- ? fixer.replaceText(node.value.property, 'None')
75
- : fixer.replaceText(node.value, viewEncapsulationNone)
76
- ].filter(utils_1.isNotNullOrUndefined);
77
- }
78
- return [
79
- utils_1.RuleFixes.getImportAddFix({
80
- fixer,
81
- importName: 'ViewEncapsulation',
82
- moduleName: '@angular/core',
83
- node: node.parent
84
- }),
85
- utils_1.RuleFixes.getDecoratorPropertyAddFix(node, fixer, `${metadataPropertyName}: ${viewEncapsulationNone}`)
86
- ].filter(utils_1.isNotNullOrUndefined);
87
- }
88
- }
89
- ]
90
- });
91
- }
92
- };
93
- }
94
- });
@@ -1,21 +0,0 @@
1
- "use strict";
2
- /*!
3
- * @license
4
- * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.createESLintRule = void 0;
20
- const utils_1 = require("@typescript-eslint/utils");
21
- exports.createESLintRule = utils_1.ESLintUtils.RuleCreator((ruleName) => ruleName);