@o3r/eslint-plugin 9.6.0-alpha.5 → 9.6.0-alpha.7

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.6.0-alpha.5",
3
+ "version": "9.6.0-alpha.7",
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": [
@@ -35,8 +35,8 @@
35
35
  }
36
36
  },
37
37
  "peerDependencies": {
38
- "@angular-eslint/template-parser": "~16.2.0",
39
- "@angular-eslint/utils": "~16.2.0",
38
+ "@angular-eslint/template-parser": "~16.3.0",
39
+ "@angular-eslint/utils": "~16.3.0",
40
40
  "@angular/compiler": "~16.2.0",
41
41
  "@typescript-eslint/eslint-plugin": "^5.60.1",
42
42
  "@typescript-eslint/parser": "^5.60.1",
@@ -46,16 +46,16 @@
46
46
  "devDependencies": {
47
47
  "@angular-devkit/core": "~16.2.0",
48
48
  "@angular-devkit/schematics": "~16.2.0",
49
- "@angular-eslint/eslint-plugin": "~16.2.0",
50
- "@angular-eslint/template-parser": "~16.2.0",
51
- "@angular-eslint/utils": "~16.2.0",
49
+ "@angular-eslint/eslint-plugin": "~16.3.0",
50
+ "@angular-eslint/template-parser": "~16.3.0",
51
+ "@angular-eslint/utils": "~16.3.0",
52
52
  "@angular/compiler": "~16.2.0",
53
53
  "@babel/core": "~7.23.0",
54
54
  "@babel/preset-typescript": "~7.23.0",
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.6.0-alpha.5",
58
+ "@o3r/build-helpers": "^9.6.0-alpha.7",
59
59
  "@types/jest": "~29.5.2",
60
60
  "@types/node": "^18.0.0",
61
61
  "@types/semver": "^7.3.13",
@@ -0,0 +1,6 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Add Otter eslint-plugin to an Angular Project
4
+ */
5
+ export declare function ngAdd(): Rule;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;GAEG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAG5B"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAdd = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ /**
6
+ * Add Otter eslint-plugin to an Angular Project
7
+ */
8
+ function ngAdd() {
9
+ /* ng add rules */
10
+ return (0, schematics_1.noop)();
11
+ }
12
+ exports.ngAdd = ngAdd;
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,5 @@
1
+ export interface NgAddSchematicsSchema {
2
+ /** Project name */
3
+ projectName?: string | undefined;
4
+ }
5
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
package/src/index.js CHANGED
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  /* eslint-disable @typescript-eslint/naming-convention */
4
4
  const no_folder_import_for_module_1 = require("./rules/typescript/no-folder-import-for-module/no-folder-import-for-module");
5
5
  const o3r_widget_tags_1 = require("./rules/typescript/o3r-widget-tags/o3r-widget-tags");
6
+ const no_inner_html_1 = require("./rules/template/no-inner-html/no-inner-html");
6
7
  const template_async_number_limitation_1 = require("./rules/template/template-async-number-limitation/template-async-number-limitation");
7
8
  const json_dependency_versions_harmonize_1 = require("./rules/json/json-dependency-versions-harmonize/json-dependency-versions-harmonize");
8
9
  const matching_configuration_name_1 = require("./rules/typescript/matching-configuration-name/matching-configuration-name");
9
10
  module.exports = {
10
11
  rules: {
11
12
  'no-folder-import-for-module': no_folder_import_for_module_1.default,
13
+ 'no-inner-html': no_inner_html_1.default,
12
14
  'template-async-number-limitation': template_async_number_limitation_1.default,
13
15
  'o3r-widget-tags': o3r_widget_tags_1.default,
14
16
  'json-dependency-versions-harmonize': json_dependency_versions_harmonize_1.default,
@@ -0,0 +1,5 @@
1
+ /** Rule Name */
2
+ export declare const name = "no-inner-html";
3
+ type Messages = 'error' | 'fix';
4
+ declare const _default: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<Messages, [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
5
+ export default _default;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.name = void 0;
4
+ const utils_1 = require("../utils");
5
+ const utils_2 = require("../../utils");
6
+ /** Rule Name */
7
+ exports.name = 'no-inner-html';
8
+ exports.default = (0, utils_2.createRule)({
9
+ name: exports.name,
10
+ defaultOptions: [],
11
+ meta: {
12
+ type: 'problem',
13
+ hasSuggestions: true,
14
+ docs: {
15
+ description: 'Ensures that your template does not use innerHTML',
16
+ recommended: 'warn'
17
+ },
18
+ schema: [],
19
+ messages: {
20
+ error: 'Unexpected use of innerHTML',
21
+ fix: 'Replace innerHTML by innerText'
22
+ },
23
+ fixable: 'code'
24
+ },
25
+ create: (context) => {
26
+ // To throw error if use without @angular-eslint/template-parser
27
+ (0, utils_1.getTemplateParserServices)(context);
28
+ return {
29
+ // eslint-disable-next-line @typescript-eslint/naming-convention
30
+ 'Element$1': (node) => {
31
+ const innerHTMLAttribute = node.attributes.find((a) => /innerHTML/i.test(a.name));
32
+ if (innerHTMLAttribute && innerHTMLAttribute.keySpan) {
33
+ context.report({
34
+ messageId: 'error',
35
+ loc: {
36
+ column: innerHTMLAttribute.keySpan.start.col,
37
+ line: innerHTMLAttribute.keySpan.start.line,
38
+ end: {
39
+ column: innerHTMLAttribute.keySpan.end.col,
40
+ line: innerHTMLAttribute.keySpan.end.line
41
+ },
42
+ start: {
43
+ column: innerHTMLAttribute.keySpan.start.col,
44
+ line: innerHTMLAttribute.keySpan.start.line
45
+ }
46
+ },
47
+ fix: (fixer) => fixer.replaceTextRange([innerHTMLAttribute.keySpan.start.offset, innerHTMLAttribute.keySpan.end.offset], 'innerText'),
48
+ suggest: [{
49
+ messageId: 'fix',
50
+ fix: (fixer) => fixer.replaceTextRange([innerHTMLAttribute.keySpan.start.offset, innerHTMLAttribute.keySpan.end.offset], 'innerText')
51
+ }]
52
+ });
53
+ }
54
+ }
55
+ };
56
+ }
57
+ });