@breadstone-infrastructure/eslint-rules 0.0.12-beta.0

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.
Files changed (54) hide show
  1. package/Index.d.ts +11 -0
  2. package/Index.d.ts.map +1 -0
  3. package/Index.js +26 -0
  4. package/Index.js.map +1 -0
  5. package/LICENSE +21 -0
  6. package/Rules/ClassExtendsImplementsNewline.d.ts +3 -0
  7. package/Rules/ClassExtendsImplementsNewline.d.ts.map +1 -0
  8. package/Rules/ClassExtendsImplementsNewline.js +54 -0
  9. package/Rules/ClassExtendsImplementsNewline.js.map +1 -0
  10. package/Rules/CommandNamingRule.d.ts +3 -0
  11. package/Rules/CommandNamingRule.d.ts.map +1 -0
  12. package/Rules/CommandNamingRule.js +69 -0
  13. package/Rules/CommandNamingRule.js.map +1 -0
  14. package/Rules/Interfaces/IRegion.d.ts +25 -0
  15. package/Rules/Interfaces/IRegion.d.ts.map +1 -0
  16. package/Rules/Interfaces/IRegion.js +3 -0
  17. package/Rules/Interfaces/IRegion.js.map +1 -0
  18. package/Rules/RegionInClassesRule.d.ts +3 -0
  19. package/Rules/RegionInClassesRule.d.ts.map +1 -0
  20. package/Rules/RegionInClassesRule.js +95 -0
  21. package/Rules/RegionInClassesRule.js.map +1 -0
  22. package/Rules/RegionInInterfacesRule.d.ts +3 -0
  23. package/Rules/RegionInInterfacesRule.d.ts.map +1 -0
  24. package/Rules/RegionInInterfacesRule.js +79 -0
  25. package/Rules/RegionInInterfacesRule.js.map +1 -0
  26. package/Rules/Resources/DuplicateKeysRule.d.ts +3 -0
  27. package/Rules/Resources/DuplicateKeysRule.d.ts.map +1 -0
  28. package/Rules/Resources/DuplicateKeysRule.js +49 -0
  29. package/Rules/Resources/DuplicateKeysRule.js.map +1 -0
  30. package/Rules/Resources/EmptyValuesRule.d.ts +3 -0
  31. package/Rules/Resources/EmptyValuesRule.d.ts.map +1 -0
  32. package/Rules/Resources/EmptyValuesRule.js +49 -0
  33. package/Rules/Resources/EmptyValuesRule.js.map +1 -0
  34. package/Rules/Resources/KeyConsistencyRule.d.ts +3 -0
  35. package/Rules/Resources/KeyConsistencyRule.d.ts.map +1 -0
  36. package/Rules/Resources/KeyConsistencyRule.js +48 -0
  37. package/Rules/Resources/KeyConsistencyRule.js.map +1 -0
  38. package/Rules/Resources/MissingTranslationsRule.d.ts +3 -0
  39. package/Rules/Resources/MissingTranslationsRule.d.ts.map +1 -0
  40. package/Rules/Resources/MissingTranslationsRule.js +49 -0
  41. package/Rules/Resources/MissingTranslationsRule.js.map +1 -0
  42. package/Rules/Resources/MultipleKeyUsageRule.d.ts +3 -0
  43. package/Rules/Resources/MultipleKeyUsageRule.d.ts.map +1 -0
  44. package/Rules/Resources/MultipleKeyUsageRule.js +48 -0
  45. package/Rules/Resources/MultipleKeyUsageRule.js.map +1 -0
  46. package/Rules/Resources/UnusedKeysRule.d.ts +3 -0
  47. package/Rules/Resources/UnusedKeysRule.d.ts.map +1 -0
  48. package/Rules/Resources/UnusedKeysRule.js +71 -0
  49. package/Rules/Resources/UnusedKeysRule.js.map +1 -0
  50. package/Rules/Resources/Utils.d.ts +3 -0
  51. package/Rules/Resources/Utils.d.ts.map +1 -0
  52. package/Rules/Resources/Utils.js +33 -0
  53. package/Rules/Resources/Utils.js.map +1 -0
  54. package/package.json +23 -0
package/Index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export * from './Rules/ClassExtendsImplementsNewline';
2
+ export * from './Rules/CommandNamingRule';
3
+ export * from './Rules/RegionInClassesRule';
4
+ export * from './Rules/RegionInInterfacesRule';
5
+ export type * from './Rules/Interfaces/IRegion';
6
+ export * from './Rules/Resources/DuplicateKeysRule';
7
+ export * from './Rules/Resources/EmptyValuesRule';
8
+ export * from './Rules/Resources/KeyConsistencyRule';
9
+ export * from './Rules/Resources/MissingTranslationsRule';
10
+ export * from './Rules/Resources/MultipleKeyUsageRule';
11
+ //# sourceMappingURL=Index.d.ts.map
package/Index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Index.d.ts","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,mBAAmB,4BAA4B,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC"}
package/Index.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Rules/ClassExtendsImplementsNewline"), exports);
18
+ __exportStar(require("./Rules/CommandNamingRule"), exports);
19
+ __exportStar(require("./Rules/RegionInClassesRule"), exports);
20
+ __exportStar(require("./Rules/RegionInInterfacesRule"), exports);
21
+ __exportStar(require("./Rules/Resources/DuplicateKeysRule"), exports);
22
+ __exportStar(require("./Rules/Resources/EmptyValuesRule"), exports);
23
+ __exportStar(require("./Rules/Resources/KeyConsistencyRule"), exports);
24
+ __exportStar(require("./Rules/Resources/MissingTranslationsRule"), exports);
25
+ __exportStar(require("./Rules/Resources/MultipleKeyUsageRule"), exports);
26
+ //# sourceMappingURL=Index.js.map
package/Index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Index.js","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wEAAsD;AACtD,4DAA0C;AAC1C,8DAA4C;AAC5C,iEAA+C;AAE/C,sEAAoD;AACpD,oEAAkD;AAClD,uEAAqD;AACrD,4EAA0D;AAC1D,yEAAuD"}
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Breadstone
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils';
2
+ export declare const classExtendsImplementsNewlineRule: TSESLint.RuleModule<'newlineExtends' | 'newlineImplements'>;
3
+ //# sourceMappingURL=ClassExtendsImplementsNewline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassExtendsImplementsNewline.d.ts","sourceRoot":"","sources":["../../src/Rules/ClassExtendsImplementsNewline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAInE,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,UAAU,CAAC,gBAAgB,GAAG,mBAAmB,CAkDzG,CAAC"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.classExtendsImplementsNewlineRule = void 0;
5
+ // #endregion
6
+ exports.classExtendsImplementsNewlineRule = {
7
+ meta: {
8
+ type: 'layout',
9
+ docs: {
10
+ description: 'Ensures that \"extends\" and \"implements\" in class declarations are on separate lines.',
11
+ url: 'https://github.com/your-repo/eslint-rules/class-extends-implements-newline.md'
12
+ },
13
+ fixable: 'whitespace',
14
+ schema: [],
15
+ messages: {
16
+ newlineExtends: 'The \"extends\" clause should start on a new line.',
17
+ newlineImplements: 'The \"implements\" clause should start on a new line.'
18
+ }
19
+ },
20
+ defaultOptions: [],
21
+ create(context) {
22
+ return {
23
+ ClassDeclaration(node) {
24
+ const sourceCode = context.getSourceCode();
25
+ const classLine = node.loc.start.line;
26
+ if (node.superClass) {
27
+ const superClassToken = sourceCode.getTokenBefore(node.superClass);
28
+ if (superClassToken && superClassToken.loc.start.line === classLine) {
29
+ context.report({
30
+ node: superClassToken,
31
+ messageId: 'newlineExtends',
32
+ fix(fixer) {
33
+ return fixer.insertTextBefore(superClassToken, '\n ');
34
+ }
35
+ });
36
+ }
37
+ }
38
+ if (node.implements.length) {
39
+ const implementsToken = sourceCode.getTokenBefore(node.implements[0]);
40
+ if (implementsToken && implementsToken.loc.start.line === classLine) {
41
+ context.report({
42
+ node: implementsToken,
43
+ messageId: 'newlineImplements',
44
+ fix(fixer) {
45
+ return fixer.insertTextBefore(implementsToken, '\n ');
46
+ }
47
+ });
48
+ }
49
+ }
50
+ }
51
+ };
52
+ },
53
+ };
54
+ //# sourceMappingURL=ClassExtendsImplementsNewline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassExtendsImplementsNewline.js","sourceRoot":"","sources":["../../src/Rules/ClassExtendsImplementsNewline.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,aAAa;AAEA,QAAA,iCAAiC,GAAgE;IAC1G,IAAI,EAAE;QACF,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACF,WAAW,EAAE,0FAA0F;YACvG,GAAG,EAAE,+EAA+E;SACvF;QACD,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACN,cAAc,EAAE,oDAAoD;YACpE,iBAAiB,EAAE,uDAAuD;SAC7E;KACJ;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACV,OAAO;YACH,gBAAgB,CAAC,IAA+B;gBAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;gBAEtC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;oBAClB,MAAM,eAAe,GAAG,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACnE,IAAI,eAAe,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;wBAClE,OAAO,CAAC,MAAM,CAAC;4BACX,IAAI,EAAE,eAAe;4BACrB,SAAS,EAAE,gBAAgB;4BAC3B,GAAG,CAAC,KAAK;gCACL,OAAO,KAAK,CAAC,gBAAgB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;4BAC7D,CAAC;yBACJ,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC;gBAED,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;oBACzB,MAAM,eAAe,GAAG,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;oBACtE,IAAI,eAAe,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;wBAClE,OAAO,CAAC,MAAM,CAAC;4BACX,IAAI,EAAE,eAAe;4BACrB,SAAS,EAAE,mBAAmB;4BAC9B,GAAG,CAAC,KAAK;gCACL,OAAO,KAAK,CAAC,gBAAgB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;4BAC7D,CAAC;yBACJ,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;CAEJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const commandNamingRule: Rule.RuleModule;
3
+ //# sourceMappingURL=CommandNamingRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandNamingRule.d.ts","sourceRoot":"","sources":["../../src/Rules/CommandNamingRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAKnC,eAAO,MAAM,iBAAiB,EAAE,IAAI,CAAC,UAqEpC,CAAC"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.commandNamingRule = void 0;
5
+ // #endregion
6
+ exports.commandNamingRule = {
7
+ meta: {
8
+ type: 'suggestion',
9
+ docs: {
10
+ description: 'Enforces naming conventions for commands, ensuring they end with "Command".',
11
+ category: 'Stylistic Issues',
12
+ recommended: false,
13
+ url: 'https://github.com/your-repo/eslint-rules/command-naming-rule.md'
14
+ },
15
+ schema: {
16
+ type: 'array',
17
+ items: {
18
+ type: 'object',
19
+ properties: {
20
+ ignore: {
21
+ type: 'array',
22
+ items: {
23
+ type: 'string'
24
+ },
25
+ description: 'An array of variable or class names to ignore.'
26
+ }
27
+ },
28
+ additionalProperties: false
29
+ }
30
+ },
31
+ messages: {
32
+ invalidCommandName: 'The command name "{{ name }}" does not follow the naming convention. It should end with "Command".'
33
+ }
34
+ },
35
+ create(context) {
36
+ const options = context.options[0] ?? {};
37
+ const ignoreList = options.ignore ?? [];
38
+ function isIgnored(name) {
39
+ return ignoreList.includes(name);
40
+ }
41
+ function checkName(name, node) {
42
+ if (!isIgnored(name) && !name.endsWith('Command')) {
43
+ context.report({
44
+ node,
45
+ messageId: 'invalidCommandName',
46
+ data: { name }
47
+ });
48
+ }
49
+ }
50
+ return {
51
+ VariableDeclarator(node) {
52
+ if (node.id.type === 'Identifier') {
53
+ checkName(node.id.name, node);
54
+ }
55
+ },
56
+ ClassDeclaration(node) {
57
+ if (node.id.name) {
58
+ checkName(node.id.name, node);
59
+ }
60
+ },
61
+ FunctionDeclaration(node) {
62
+ if (node.id.name) {
63
+ checkName(node.id.name, node);
64
+ }
65
+ }
66
+ };
67
+ }
68
+ };
69
+ //# sourceMappingURL=CommandNamingRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandNamingRule.js","sourceRoot":"","sources":["../../src/Rules/CommandNamingRule.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAKlB,aAAa;AAEA,QAAA,iBAAiB,GAAoB;IAC9C,IAAI,EAAE;QACF,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACF,WAAW,EAAE,6EAA6E;YAC1F,QAAQ,EAAE,kBAAkB;YAC5B,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,kEAAkE;SAC1E;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACR,MAAM,EAAE;wBACJ,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE;4BACH,IAAI,EAAE,QAAQ;yBACjB;wBACD,WAAW,EAAE,gDAAgD;qBAChE;iBACJ;gBACD,oBAAoB,EAAE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C"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Interface representing a region in a class or interface.
3
+ * Defines the section name and the regex pattern used to find the region in the source code.
4
+ *
5
+ * @public
6
+ */
7
+ export interface IRegion {
8
+ /**
9
+ * The name of the section.
10
+ */
11
+ section: string;
12
+ /**
13
+ * The regex pattern to find the region in the source code.
14
+ */
15
+ regex: RegExp;
16
+ /**
17
+ * The text to insert when the region is missing.
18
+ */
19
+ insertText: string;
20
+ /**
21
+ * Determines if the region is required.
22
+ */
23
+ required: boolean;
24
+ }
25
+ //# sourceMappingURL=IRegion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRegion.d.ts","sourceRoot":"","sources":["../../../src/Rules/Interfaces/IRegion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IAIpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;CAIrB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IRegion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRegion.js","sourceRoot":"","sources":["../../../src/Rules/Interfaces/IRegion.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const regionInClassesRule: Rule.RuleModule;
3
+ //# sourceMappingURL=RegionInClassesRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegionInClassesRule.d.ts","sourceRoot":"","sources":["../../src/Rules/RegionInClassesRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAMnC,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,UA0GtC,CAAC"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.regionInClassesRule = void 0;
5
+ // #endregion
6
+ exports.regionInClassesRule = {
7
+ meta: {
8
+ type: 'suggestion',
9
+ docs: {
10
+ description: 'Require #region and #endregion tags in TypeScript classes for Fields, Ctor, Properties, and Methods.',
11
+ category: 'Stylistic Issues',
12
+ recommended: false,
13
+ url: 'https://github.com/RueDeRennes/mosaik/blob/master/infra/eslint-config/src/Rules/RegionInClassesRule.md'
14
+ },
15
+ schema: {
16
+ type: 'object',
17
+ properties: {
18
+ ignore: {
19
+ type: 'array',
20
+ items: {
21
+ type: 'string'
22
+ },
23
+ description: 'An array of interface names to ignore'
24
+ }
25
+ },
26
+ additionalProperties: false
27
+ },
28
+ // fixable: 'code',
29
+ messages: {
30
+ missingRegion: 'The class is missing #region tags for the {{ section }} section.'
31
+ }
32
+ },
33
+ create(context) {
34
+ const options = context.options[0] ?? {};
35
+ const ignoreList = options.ignore ?? [];
36
+ return {
37
+ ClassDeclaration(node) {
38
+ const className = node.id.name;
39
+ // If the interface name is in the ignore list, skip this interface
40
+ if (className && ignoreList.includes(className)) {
41
+ return;
42
+ }
43
+ // TODO: Get the class source code
44
+ const classSource = ''; // context.sourceCode.getText(node);
45
+ const classBodyStart = node.body.range?.[1] ?? 0; // Get the start of the class body
46
+ const members = node.body.body;
47
+ // Determine if the class contains fields, a constructor, properties, and methods
48
+ const hasFields = members.some((member) => member.type === 'PropertyDefinition');
49
+ const hasCtor = members.some((member) => member.type === 'MethodDefinition' && member.kind === 'constructor');
50
+ const hasProperties = members.some((member) => member.type === 'MethodDefinition' && ['get', 'set'].includes(member.kind));
51
+ const hasMethods = members.some((member) => member.type === 'MethodDefinition' && member.kind === 'method');
52
+ // Define regions based on the presence of each section
53
+ const regions = [
54
+ {
55
+ section: 'Fields',
56
+ required: hasFields,
57
+ regex: /\/\/\s*#region\s+Fields/i, // Loosened and case-insensitive
58
+ insertText: '\n//#region Fields\n//#endregion\n'
59
+ },
60
+ {
61
+ section: 'Ctor',
62
+ required: hasCtor,
63
+ regex: /\/\/\s*#region\s+Ctor/i,
64
+ insertText: '\n//#region Ctor\n//#endregion\n'
65
+ },
66
+ {
67
+ section: 'Properties',
68
+ required: hasProperties,
69
+ regex: /\/\/\s*#region\s+Properties/i,
70
+ insertText: '\n//#region Properties\n//#endregion\n'
71
+ },
72
+ {
73
+ section: 'Methods',
74
+ required: hasMethods,
75
+ regex: /\/\/\s*#region\s+Methods/i,
76
+ insertText: '\n//#region Methods\n//#endregion\n'
77
+ }
78
+ ];
79
+ regions.forEach((region) => {
80
+ if (region.required && !region.regex.test(classSource)) {
81
+ context.report({
82
+ node,
83
+ messageId: 'missingRegion',
84
+ data: { section: region.section },
85
+ fix(fixer) {
86
+ return fixer.insertTextAfterRange([classBodyStart, classBodyStart], region.insertText);
87
+ }
88
+ });
89
+ }
90
+ });
91
+ }
92
+ };
93
+ }
94
+ };
95
+ //# sourceMappingURL=RegionInClassesRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegionInClassesRule.js","sourceRoot":"","sources":["../../src/Rules/RegionInClassesRule.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAMlB,aAAa;AAEA,QAAA,mBAAmB,GAAoB;IAChD,IAAI,EAAE;QACF,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACF,WAAW,EAAE,sGAAsG;YACnH,QAAQ,EAAE,kBAAkB;YAC5B,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,wGAAwG;SAChH;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,MAAM,EAAE;oBACJ,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE;wBACH,IAAI,EAAE,QAAQ;qBACjB;oBACD,WAAW,EAAE,uCAAuC;iBACvD;aACJ;YACD,oBAAoB,EAAE,KAAK;SAC9B;QACD,mBAAmB;QACnB,QAAQ,EAA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+ export declare const regionInInterfacesRule: Rule.RuleModule;
3
+ //# sourceMappingURL=RegionInInterfacesRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegionInInterfacesRule.d.ts","sourceRoot":"","sources":["../../src/Rules/RegionInInterfacesRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAMnC,eAAO,MAAM,sBAAsB,EAAE,IAAI,CAAC,UAsFzC,CAAC"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.regionInInterfacesRule = void 0;
5
+ // #endregion
6
+ exports.regionInInterfacesRule = {
7
+ meta: {
8
+ type: 'suggestion',
9
+ docs: {
10
+ description: 'Require #region and #endregion tags in TypeScript interfaces for Properties and Methods.',
11
+ category: 'Stylistic Issues',
12
+ recommended: false,
13
+ url: 'https://github.com/RueDeRennes/mosaik/blob/master/infra/eslint-config/src/Rules/RegionInInterfacesRule.md'
14
+ },
15
+ schema: {
16
+ type: 'object',
17
+ properties: {
18
+ ignore: {
19
+ type: 'array',
20
+ items: {
21
+ type: 'string'
22
+ },
23
+ description: 'An array of class names to ignore'
24
+ }
25
+ },
26
+ additionalProperties: false
27
+ },
28
+ // fixable: 'code',
29
+ messages: {
30
+ missingRegion: 'The interface is missing #region tags for the {{ section }} section.'
31
+ }
32
+ },
33
+ create(context) {
34
+ const options = context.options[0] ?? {};
35
+ const ignoreList = options.ignore ?? [];
36
+ return {
37
+ TSInterfaceDeclaration(node) {
38
+ const interfaceName = node.id.name;
39
+ // If the interface name is in the ignore list, skip this interface
40
+ if (interfaceName && ignoreList.includes(interfaceName)) {
41
+ return;
42
+ }
43
+ // TODO: Get the class source code
44
+ const interfaceSource = ''; // context.sourceCode.getText(node);
45
+ const interfaceBodyStart = node.body.range?.[1] ?? 0; // Start of the interface body
46
+ const members = node.body.body;
47
+ const hasProperties = members.some((member) => member.type === 'TSPropertySignature');
48
+ const hasMethods = members.some((member) => member.type === 'TSMethodSignature');
49
+ const regions = [
50
+ {
51
+ section: 'Properties',
52
+ regex: /\/\/\s*#region\s+Properties/i,
53
+ insertText: '\n//#region Properties\n//#endregion\n',
54
+ required: hasProperties
55
+ },
56
+ {
57
+ section: 'Methods',
58
+ regex: /\/\/\s*#region\s+Methods/i,
59
+ insertText: '\n//#region Methods\n//#endregion\n',
60
+ required: hasMethods
61
+ }
62
+ ];
63
+ regions.forEach((region) => {
64
+ if (region.required && !region.regex.test(interfaceSource)) {
65
+ context.report({
66
+ node,
67
+ messageId: 'missingRegion',
68
+ data: { section: region.section },
69
+ fix(fixer) {
70
+ return fixer.insertTextAfterRange([interfaceBodyStart, interfaceBodyStart], region.insertText);
71
+ }
72
+ });
73
+ }
74
+ });
75
+ }
76
+ };
77
+ }
78
+ };
79
+ //# sourceMappingURL=RegionInInterfacesRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegionInInterfacesRule.js","sourceRoot":"","sources":["../../src/Rules/RegionInInterfacesRule.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAMlB,aAAa;AAEA,QAAA,sBAAsB,GAAoB;IACnD,IAAI,EAAE;QACF,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACF,WAAW,EAAE,0FAA0F;YACvG,QAAQ,EAAE,kBAAkB;YAC5B,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,2GAA2G;SACnH;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,MAAM,EAAE;oBACJ,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE;wBACH,IAAI,EAAE,QAAQ;qBACjB;oBACD,WAAW,EAAE,mCAAmC;iBACnD;aACJ;YACD,oBAAoB,EAAE,KAAK;SAC9B;QACD,mBAAmB;QACnB,QAAQ,EAAE;YACN,aAAa,EAAE,sEAAsE;SACxF;KACJ;IACD,MAAM,CAAC,OAAyB;QAK5B,MA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AAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;wBACzD,OAAO,CAAC,MAAM,CAAC;4BACX,IAAI;4BACJ,SAAS,EAAE,eAAe;4BAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;4BACjC,GAAG,CAAC,KAAqB;gCACrB,OAAO,KAAK,CAAC,oBAAoB,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;4BACnG,CAAC;yBACJ,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const duplicateKeysRule: Rule.RuleModule;
3
+ //# sourceMappingURL=DuplicateKeysRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DuplicateKeysRule.d.ts","sourceRoot":"","sources":["../../../src/Rules/Resources/DuplicateKeysRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AASnC,eAAO,MAAM,iBAAiB,EAAE,IAAI,CAAC,UAyCpC,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.duplicateKeysRule = void 0;
5
+ const localizator_core_1 = require("@breadstone-tools/localizator-core");
6
+ const utilities_1 = require("@breadstone-infrastructure/utilities");
7
+ const Utils_js_1 = require("./Utils.js");
8
+ // #endregion
9
+ exports.duplicateKeysRule = {
10
+ meta: {
11
+ type: 'problem',
12
+ docs: {
13
+ description: 'Detects duplicate translation keys in resource files.',
14
+ category: 'Best Practices',
15
+ recommended: true,
16
+ url: 'https://github.com/your-repo/eslint-rules/duplicate-keys-rule.md'
17
+ },
18
+ schema: [],
19
+ messages: {
20
+ duplicateKey: 'The translation key "{{ key }}" is duplicated in locale "{{ locale }}".'
21
+ }
22
+ },
23
+ create(context) {
24
+ const fileSystem = new utilities_1.FileSystem();
25
+ const resourceInfo = (0, Utils_js_1.createResourceFromContent)(context.sourceCode.text, localizator_core_1.ResourceType.formFile(context.filename), fileSystem.getLocale(context.filename));
26
+ return {
27
+ Program(node) {
28
+ const task = new localizator_core_1.DuplicateKeysTask();
29
+ const result = task.execute({
30
+ resource: resourceInfo,
31
+ parameters: {}
32
+ });
33
+ result.data.forEach((data) => {
34
+ data.duplicates.forEach((key) => {
35
+ context.report({
36
+ node,
37
+ messageId: 'duplicateKey',
38
+ data: {
39
+ key,
40
+ locale: data.locale
41
+ }
42
+ });
43
+ });
44
+ });
45
+ }
46
+ };
47
+ }
48
+ };
49
+ //# sourceMappingURL=DuplicateKeysRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DuplicateKeysRule.js","sourceRoot":"","sources":["../../../src/Rules/Resources/DuplicateKeysRule.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAGlB,yEAAqF;AACrF,oEAAkE;AAElE,yCAAuD;AAGvD,aAAa;AAEA,QAAA,iBAAiB,GAAoB;IAC9C,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,IAAI;YACjB,GAAG,EAAE,kEAAkE;SAC1E;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACN,YAAY,EAAE,yEAAyE;SAC1F;KACJ;IACD,MAAM,CAAC,OAAoB;QACvB,MAAM,UAAU,GAAG,IAAI,sBAAU,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,IAAA,oCAAyB,EAAE,OAAO,CAAC,UAA6B,CAAC,IAAI,EAAE,+BAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE7K,OAAO;YACH,OAAO,CAAC,IAAoB;gBACxB,MAAM,IAAI,GAAG,IAAI,oCAAiB,EAAE,CAAC;gBACrC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;oBACxB,QAAQ,EAAE,YAAY;oBACtB,UAAU,EAAE,EAAE;iBACjB,CAAC,CAAC;gBAEH,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBACzB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;wBAC5B,OAAO,CAAC,MAAM,CAAC;4BACX,IAAI;4BACJ,SAAS,EAAE,cAAc;4BACzB,IAAI,EAAE;gCACF,GAAG;gCACH,MAAM,EAAE,IAAI,CAAC,MAAM;6BACtB;yBACJ,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const emptyValuesRule: Rule.RuleModule;
3
+ //# sourceMappingURL=EmptyValuesRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyValuesRule.d.ts","sourceRoot":"","sources":["../../../src/Rules/Resources/EmptyValuesRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AASnC,eAAO,MAAM,eAAe,EAAE,IAAI,CAAC,UAyClC,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.emptyValuesRule = void 0;
5
+ const localizator_core_1 = require("@breadstone-tools/localizator-core");
6
+ const utilities_1 = require("@breadstone-infrastructure/utilities");
7
+ const Utils_js_1 = require("./Utils.js");
8
+ // #endregion
9
+ exports.emptyValuesRule = {
10
+ meta: {
11
+ type: 'problem',
12
+ docs: {
13
+ description: 'Detects translation keys with empty values in resource files.',
14
+ category: 'Best Practices',
15
+ recommended: true,
16
+ url: 'https://github.com/your-repo/eslint-rules/empty-values-rule.md'
17
+ },
18
+ schema: [],
19
+ messages: {
20
+ emptyValue: 'The translation key "{{ key }}" has an empty value in locale "{{ locale }}".'
21
+ }
22
+ },
23
+ create(context) {
24
+ const fileSystem = new utilities_1.FileSystem();
25
+ const resourceInfo = (0, Utils_js_1.createResourceFromContent)(context.sourceCode.text, localizator_core_1.ResourceType.formFile(context.filename), fileSystem.getLocale(context.filename));
26
+ return {
27
+ Program(node) {
28
+ const task = new localizator_core_1.EmptyValuesTask();
29
+ const result = task.execute({
30
+ resource: resourceInfo,
31
+ parameters: {}
32
+ });
33
+ result.data.forEach((data) => {
34
+ data.keys.forEach((key) => {
35
+ context.report({
36
+ node,
37
+ messageId: 'emptyValue',
38
+ data: {
39
+ key,
40
+ locale: data.locale
41
+ }
42
+ });
43
+ });
44
+ });
45
+ }
46
+ };
47
+ }
48
+ };
49
+ //# sourceMappingURL=EmptyValuesRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyValuesRule.js","sourceRoot":"","sources":["../../../src/Rules/Resources/EmptyValuesRule.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAGlB,yEAAmF;AACnF,oEAAkE;AAElE,yCAAuD;AAGvD,aAAa;AAEA,QAAA,eAAe,GAAoB;IAC5C,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,WAAW,EAAE,+DAA+D;YAC5E,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,IAAI;YACjB,GAAG,EAAE,gEAAgE;SACxE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACN,UAAU,EAAE,8EAA8E;SAC7F;KACJ;IACD,MAAM,CAAC,OAAoB;QACvB,MAAM,UAAU,GAAG,IAAI,sBAAU,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,IAAA,oCAAyB,EAAE,OAAO,CAAC,UAA6B,CAAC,IAAI,EAAE,+BAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE7K,OAAO;YACH,OAAO,CAAC,IAAoB;gBACxB,MAAM,IAAI,GAAG,IAAI,kCAAe,EAAE,CAAC;gBACnC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;oBACxB,QAAQ,EAAE,YAAY;oBACtB,UAAU,EAAE,EAAE;iBACjB,CAAC,CAAC;gBAEH,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBACzB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;wBACtB,OAAO,CAAC,MAAM,CAAC;4BACX,IAAI;4BACJ,SAAS,EAAE,YAAY;4BACvB,IAAI,EAAE;gCACF,GAAG;gCACH,MAAM,EAAE,IAAI,CAAC,MAAM;6BACtB;yBACJ,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const keyConsistencyRule: Rule.RuleModule;
3
+ //# sourceMappingURL=KeyConsistencyRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyConsistencyRule.d.ts","sourceRoot":"","sources":["../../../src/Rules/Resources/KeyConsistencyRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AASnC,eAAO,MAAM,kBAAkB,EAAE,IAAI,CAAC,UAwCrC,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.keyConsistencyRule = void 0;
5
+ const localizator_core_1 = require("@breadstone-tools/localizator-core");
6
+ const Utils_js_1 = require("./Utils.js");
7
+ const utilities_1 = require("@breadstone-infrastructure/utilities");
8
+ // #endregion
9
+ exports.keyConsistencyRule = {
10
+ meta: {
11
+ type: 'problem',
12
+ docs: {
13
+ description: 'Ensures that translation keys are consistent across locales.',
14
+ category: 'Best Practices',
15
+ recommended: true,
16
+ url: 'https://github.com/your-repo/eslint-rules/key-consistency-rule.md'
17
+ },
18
+ schema: [],
19
+ messages: {
20
+ inconsistentKey: 'The translation key "{{ key }}" is inconsistent across locales.'
21
+ }
22
+ },
23
+ create(context) {
24
+ const fileSystem = new utilities_1.FileSystem();
25
+ const resourceInfo = (0, Utils_js_1.createResourceFromContent)(context.sourceCode.text, localizator_core_1.ResourceType.formFile(context.filename), fileSystem.getLocale(context.filename));
26
+ return {
27
+ Program(node) {
28
+ const task = new localizator_core_1.KeyConsistencyTask();
29
+ const result = task.execute({
30
+ resource: resourceInfo,
31
+ parameters: {}
32
+ });
33
+ result.data.forEach((data) => {
34
+ data.missingKeys.forEach((key) => {
35
+ context.report({
36
+ node,
37
+ messageId: 'inconsistentKey',
38
+ data: {
39
+ key
40
+ }
41
+ });
42
+ });
43
+ });
44
+ }
45
+ };
46
+ }
47
+ };
48
+ //# sourceMappingURL=KeyConsistencyRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyConsistencyRule.js","sourceRoot":"","sources":["../../../src/Rules/Resources/KeyConsistencyRule.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAGlB,yEAAsF;AAEtF,yCAAuD;AACvD,oEAAkE;AAGlE,aAAa;AAEA,QAAA,kBAAkB,GAAoB;IAC/C,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,WAAW,EAAE,8DAA8D;YAC3E,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,IAAI;YACjB,GAAG,EAAE,mEAAmE;SAC3E;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACN,eAAe,EAAE,iEAAiE;SACrF;KACJ;IACD,MAAM,CAAC,OAAoB;QACvB,MAAM,UAAU,GAAG,IAAI,sBAAU,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,IAAA,oCAAyB,EAAE,OAAO,CAAC,UAA6B,CAAC,IAAI,EAAE,+BAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE7K,OAAO;YACH,OAAO,CAAC,IAAoB;gBACxB,MAAM,IAAI,GAAG,IAAI,qCAAkB,EAAE,CAAC;gBACtC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;oBACxB,QAAQ,EAAE,YAAY;oBACtB,UAAU,EAAE,EAAE;iBACjB,CAAC,CAAC;gBAEH,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBACzB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;wBAC7B,OAAO,CAAC,MAAM,CAAC;4BACX,IAAI;4BACJ,SAAS,EAAE,iBAAiB;4BAC5B,IAAI,EAAE;gCACF,GAAG;6BACN;yBACJ,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const missingTranslationsRule: Rule.RuleModule;
3
+ //# sourceMappingURL=MissingTranslationsRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MissingTranslationsRule.d.ts","sourceRoot":"","sources":["../../../src/Rules/Resources/MissingTranslationsRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AASnC,eAAO,MAAM,uBAAuB,EAAE,IAAI,CAAC,UAyC1C,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.missingTranslationsRule = void 0;
5
+ const localizator_core_1 = require("@breadstone-tools/localizator-core");
6
+ const utilities_1 = require("@breadstone-infrastructure/utilities");
7
+ const Utils_js_1 = require("./Utils.js");
8
+ // #endregion
9
+ exports.missingTranslationsRule = {
10
+ meta: {
11
+ type: 'problem',
12
+ docs: {
13
+ description: 'Detects missing translations in resource files.',
14
+ category: 'Best Practices',
15
+ recommended: true,
16
+ url: 'https://github.com/your-repo/eslint-rules/missing-translations-rule.md'
17
+ },
18
+ schema: [],
19
+ messages: {
20
+ missingTranslation: 'The translation key "{{ key }}" is missing in locale "{{ locale }}".'
21
+ }
22
+ },
23
+ create(context) {
24
+ const fileSystem = new utilities_1.FileSystem();
25
+ const resourceInfo = (0, Utils_js_1.createResourceFromContent)(context.sourceCode.text, localizator_core_1.ResourceType.formFile(context.filename), fileSystem.getLocale(context.filename));
26
+ return {
27
+ Program(node) {
28
+ const task = new localizator_core_1.MissingTranslationsTask();
29
+ const result = task.execute({
30
+ resource: resourceInfo,
31
+ parameters: {}
32
+ });
33
+ result.data.forEach((data) => {
34
+ data.missingKeys.forEach((key) => {
35
+ context.report({
36
+ node,
37
+ messageId: 'missingTranslation',
38
+ data: {
39
+ key,
40
+ locale: data.locale
41
+ }
42
+ });
43
+ });
44
+ });
45
+ }
46
+ };
47
+ }
48
+ };
49
+ //# sourceMappingURL=MissingTranslationsRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MissingTranslationsRule.js","sourceRoot":"","sources":["../../../src/Rules/Resources/MissingTranslationsRule.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAGlB,yEAA2F;AAE3F,oEAAkE;AAClE,yCAAuD;AAGvD,aAAa;AAEA,QAAA,uBAAuB,GAAoB;IACpD,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,IAAI;YACjB,GAAG,EAAE,wEAAwE;SAChF;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACN,kBAAkB,EAAE,sEAAsE;SAC7F;KACJ;IACD,MAAM,CAAC,OAAoB;QACvB,MAAM,UAAU,GAAG,IAAI,sBAAU,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,IAAA,oCAAyB,EAAE,OAAO,CAAC,UAA6B,CAAC,IAAI,EAAE,+BAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE7K,OAAO;YACH,OAAO,CAAC,IAAoB;gBACxB,MAAM,IAAI,GAAG,IAAI,0CAAuB,EAAE,CAAC;gBAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;oBACxB,QAAQ,EAAE,YAAY;oBACtB,UAAU,EAAE,EAAE;iBACjB,CAAC,CAAC;gBAEH,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBACzB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;wBAC7B,OAAO,CAAC,MAAM,CAAC;4BACX,IAAI;4BACJ,SAAS,EAAE,oBAAoB;4BAC/B,IAAI,EAAE;gCACF,GAAG;gCACH,MAAM,EAAE,IAAI,CAAC,MAAM;6BACtB;yBACJ,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const multipleKeyUsageRule: Rule.RuleModule;
3
+ //# sourceMappingURL=MultipleKeyUsageRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipleKeyUsageRule.d.ts","sourceRoot":"","sources":["../../../src/Rules/Resources/MultipleKeyUsageRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AASnC,eAAO,MAAM,oBAAoB,EAAE,IAAI,CAAC,UAwCvC,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.multipleKeyUsageRule = void 0;
5
+ const localizator_core_1 = require("@breadstone-tools/localizator-core");
6
+ const utilities_1 = require("@breadstone-infrastructure/utilities");
7
+ const Utils_js_1 = require("./Utils.js");
8
+ // #endregion
9
+ exports.multipleKeyUsageRule = {
10
+ meta: {
11
+ type: 'problem',
12
+ docs: {
13
+ description: 'Detects incorrect multiple usage of translation keys.',
14
+ category: 'Best Practices',
15
+ recommended: true,
16
+ url: 'https://github.com/your-repo/eslint-rules/multiple-key-usage-rule.md'
17
+ },
18
+ schema: [],
19
+ messages: {
20
+ multipleKeyUsage: 'The translation key "{{ key }}" is used inconsistently across contexts.'
21
+ }
22
+ },
23
+ create(context) {
24
+ const fileSystem = new utilities_1.FileSystem();
25
+ const resourceInfo = (0, Utils_js_1.createResourceFromContent)(context.sourceCode.text, localizator_core_1.ResourceType.formFile(context.filename), fileSystem.getLocale(context.filename));
26
+ return {
27
+ Program(node) {
28
+ const task = new localizator_core_1.MultipleKeyUsageTask();
29
+ const result = task.execute({
30
+ resource: resourceInfo,
31
+ parameters: {}
32
+ });
33
+ result.data.forEach((data) => {
34
+ data.multipleUsageKeys.forEach((key) => {
35
+ context.report({
36
+ node,
37
+ messageId: 'multipleKeyUsage',
38
+ data: {
39
+ key
40
+ }
41
+ });
42
+ });
43
+ });
44
+ }
45
+ };
46
+ }
47
+ };
48
+ //# sourceMappingURL=MultipleKeyUsageRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipleKeyUsageRule.js","sourceRoot":"","sources":["../../../src/Rules/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AC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const unusedKeysRule: Rule.RuleModule;
3
+ //# sourceMappingURL=UnusedKeysRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnusedKeysRule.d.ts","sourceRoot":"","sources":["../../../src/Rules/Resources/UnusedKeysRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AASnC,eAAO,MAAM,cAAc,EAAE,IAAI,CAAC,UAoEjC,CAAC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.unusedKeysRule = void 0;
5
+ const localizator_core_1 = require("@breadstone-tools/localizator-core");
6
+ const Utils_js_1 = require("./Utils.js");
7
+ const utilities_1 = require("@breadstone-infrastructure/utilities");
8
+ // #endregion
9
+ exports.unusedKeysRule = {
10
+ meta: {
11
+ type: 'problem',
12
+ docs: {
13
+ description: 'Detects unused translation keys in resource files.',
14
+ category: 'Best Practices',
15
+ recommended: false,
16
+ url: 'https://github.com/your-repo/eslint-rules/unused-keys-rule.md'
17
+ },
18
+ schema: [
19
+ {
20
+ type: 'object',
21
+ properties: {
22
+ usedKeys: {
23
+ type: 'array',
24
+ items: {
25
+ type: 'string'
26
+ },
27
+ description: 'A list of keys that are used in the application.'
28
+ },
29
+ mode: {
30
+ type: 'string',
31
+ description: 'The mode of the resource files.'
32
+ }
33
+ },
34
+ additionalProperties: false
35
+ }
36
+ ],
37
+ messages: {
38
+ unusedKey: 'The translation key "{{ key }}" in locale "{{ locale }}" is unused.'
39
+ }
40
+ },
41
+ create(context) {
42
+ const options = context.options[0] ?? {};
43
+ const usedKeys = options.usedKeys ?? [];
44
+ const fileSystem = new utilities_1.FileSystem();
45
+ const resourceInfo = (0, Utils_js_1.createResourceFromContent)(context.sourceCode.text, localizator_core_1.ResourceType.formFile(context.filename), fileSystem.getLocale(context.filename));
46
+ return {
47
+ Program(node) {
48
+ const task = new localizator_core_1.UnusedKeysTask();
49
+ const result = task.execute({
50
+ resource: resourceInfo,
51
+ parameters: {
52
+ usedKeys: usedKeys
53
+ }
54
+ });
55
+ result.data.forEach((data) => {
56
+ data.unusedKeys.forEach((key) => {
57
+ context.report({
58
+ node: node,
59
+ messageId: 'unusedKey',
60
+ data: {
61
+ key,
62
+ locale: data.locale
63
+ }
64
+ });
65
+ });
66
+ });
67
+ }
68
+ };
69
+ }
70
+ };
71
+ //# sourceMappingURL=UnusedKeysRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnusedKeysRule.js","sourceRoot":"","sources":["../../../src/Rules/Resources/UnusedKeysRule.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,yEAAkF;AAClF,yCAAuD;AACvD,oEAAkE;AAGlE,aAAa;AAEA,QAAA,cAAc,GAAoB;IAC3C,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,WAAW,EAAE,oDAAoD;YACjE,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,+DAA+D;SACvE;QACD,MAAM,EAAE;YACJ;gBACI,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACR,QAAQ,EAAE;wBACN,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE;4BACH,IAAI,EAAE,QAAQ;yBACjB;wBACD,WAAW,EAAE,kDAAkD;qBAClE;oBACD,IAAI,EAAE;wBACF,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iCAAiC;qBACjD;iBACJ;gBACD,oBAAoB,EAAE,KAAK;aAC9B;SACJ;QACD,QAAQ,EAAE;YACN,SAAS,EAAE,qEAAqE;SACnF;KACJ;IACD,MAAM,CAAC,OAAoB;QAMvB,MAAM,OAAO,GAAY,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAkB,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;QACvD,MAAM,UAAU,GAAG,IAAI,sBAAU,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,IAAA,oCAAyB,EAAE,OAAO,CAAC,UAA6B,CAAC,IAAI,EAAE,+BAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE7K,OAAO;YACH,OAAO,CAAC,IAAoB;gBACxB,MAAM,IAAI,GAAG,IAAI,iCAAc,EAAE,CAAC;gBAClC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;oBACxB,QAAQ,EAAE,YAAY;oBACtB,UAAU,EAAE;wBACR,QAAQ,EAAE,QAAQ;qBACrB;iBACJ,CAAC,CAAC;gBAEH,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBACzB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;wBAC5B,OAAO,CAAC,MAAM,CAAC;4BACX,IAAI,EAAE,IAAI;4BACV,SAAS,EAAE,WAAW;4BACtB,IAAI,EAAE;gCACF,GAAG;gCACH,MAAM,EAAE,IAAI,CAAC,MAAM;6BACtB;yBACJ,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type IResourceInfo, ResourceType } from '@breadstone-tools/localizator-core';
2
+ export declare function createResourceFromContent(content: string, type: ResourceType, locale: string): IResourceInfo;
3
+ //# sourceMappingURL=Utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/Rules/Resources/Utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAoB,YAAY,EAAoB,MAAM,oCAAoC,CAAC;AAK1H,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAwB5G"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.createResourceFromContent = createResourceFromContent;
5
+ const localizator_core_1 = require("@breadstone-tools/localizator-core");
6
+ const utilities_1 = require("@breadstone-infrastructure/utilities");
7
+ // #endregion
8
+ function createResourceFromContent(content, type, locale) {
9
+ switch (type) {
10
+ case localizator_core_1.ResourceType.Json:
11
+ return new localizator_core_1.JsonResourceInfo({
12
+ type: localizator_core_1.ResourceType.Json,
13
+ content: () => {
14
+ const p = utilities_1.Json.parse(content).entries;
15
+ return p;
16
+ },
17
+ locale: locale
18
+ });
19
+ case localizator_core_1.ResourceType.Resx:
20
+ return new localizator_core_1.ResxResourceInfo({
21
+ type: localizator_core_1.ResourceType.Resx,
22
+ content: () => {
23
+ const p = utilities_1.Resx.parse(content).entries;
24
+ return p;
25
+ },
26
+ locale: locale
27
+ });
28
+ case localizator_core_1.ResourceType.TypeScript:
29
+ default:
30
+ throw new Error(`Resource type not supported: ${type}`);
31
+ }
32
+ }
33
+ //# sourceMappingURL=Utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Rules/Resources/Utils.ts"],"names":[],"mappings":";AAAA,kBAAkB;;AAOlB,8DAwBC;AA7BD,yEAA0H;AAC1H,oEAAkE;AAElE,aAAa;AAEb,SAAgB,yBAAyB,CAAC,OAAe,EAAE,IAAkB,EAAE,MAAc;IACzF,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,+BAAY,CAAC,IAAI;YAClB,OAAO,IAAI,mCAAgB,CAAC;gBACxB,IAAI,EAAE,+BAAY,CAAC,IAAI;gBACvB,OAAO,EAAE,GAAG,EAAE;oBACV,MAAM,CAAC,GAAG,gBAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;oBACtC,OAAO,CAAC,CAAC;gBACb,CAAC;gBACD,MAAM,EAAE,MAAM;aACjB,CAAC,CAAC;QACP,KAAK,+BAAY,CAAC,IAAI;YAClB,OAAO,IAAI,mCAAgB,CAAC;gBACxB,IAAI,EAAE,+BAAY,CAAC,IAAI;gBACvB,OAAO,EAAE,GAAG,EAAE;oBACV,MAAM,CAAC,GAAG,gBAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;oBACtC,OAAO,CAAC,CAAC;gBACb,CAAC;gBACD,MAAM,EAAE,MAAM;aACjB,CAAC,CAAC;QACP,KAAK,+BAAY,CAAC,UAAU,CAAC;QAC7B;YACI,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;AACL,CAAC"}
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@breadstone-infrastructure/eslint-rules",
3
+ "description": "Custom eslint rules for mosaik projects",
4
+ "version": "0.0.12-beta.0",
5
+ "license": "MIT",
6
+ "author": "andre.wehlert <awehlert@breadstone.de> (https://www.breadstone.de)",
7
+ "repository": {
8
+ "url": "git+ssh://git@github.com/RueDeRennes/mosaik.git"
9
+ },
10
+ "type": "commonjs",
11
+ "main": "./Index.js",
12
+ "commonjs": "./Index.js",
13
+ "module": "./Index.js",
14
+ "types": "./Index.d.ts",
15
+ "dependencies": {
16
+ "@breadstone-infrastructure/utilities": "^0.0.12-beta.0",
17
+ "@breadstone-tools/localizator-core": "^0.0.12-beta.0"
18
+ },
19
+ "peerDependencies": {
20
+ "eslint": "^9.26.0",
21
+ "typescript-eslint": "^8.31.1"
22
+ }
23
+ }