ilib-lint 1.0.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 (89) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +231 -0
  3. package/docs/AnsiConsoleFormatter.html +467 -0
  4. package/docs/Formatter.html +577 -0
  5. package/docs/Formatter.js.html +135 -0
  6. package/docs/FormatterFactory.html +191 -0
  7. package/docs/FormatterFactory.js.html +109 -0
  8. package/docs/Parser.html +483 -0
  9. package/docs/Parser.js.html +122 -0
  10. package/docs/ParserFactory.js.html +109 -0
  11. package/docs/Plugin.html +847 -0
  12. package/docs/Plugin.js.html +168 -0
  13. package/docs/PluginManager.html +541 -0
  14. package/docs/PluginManager.js.html +125 -0
  15. package/docs/ResourceICUPlurals.html +278 -0
  16. package/docs/ResourceQuoteStyle.html +278 -0
  17. package/docs/ResourceRegExpChecker.html +295 -0
  18. package/docs/ResourceUniqueKeys.html +278 -0
  19. package/docs/Result.html +263 -0
  20. package/docs/Result.js.html +130 -0
  21. package/docs/Rule.html +774 -0
  22. package/docs/Rule.js.html +230 -0
  23. package/docs/RuleSet.html +760 -0
  24. package/docs/RuleSet.js.html +153 -0
  25. package/docs/SourceFile.html +826 -0
  26. package/docs/SourceFile.js.html +232 -0
  27. package/docs/XliffParser.html +396 -0
  28. package/docs/XliffPlugin.html +472 -0
  29. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  30. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  31. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  32. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  33. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  34. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  35. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  36. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  37. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  38. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  39. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  40. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  41. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  42. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  43. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  44. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  45. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  46. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  47. package/docs/formatters_AnsiConsoleFormatter.js.html +147 -0
  48. package/docs/global.html +448 -0
  49. package/docs/ilibLint.md +1013 -0
  50. package/docs/index.html +81 -0
  51. package/docs/plugins_XliffParser.js.html +129 -0
  52. package/docs/plugins_XliffPlugin.js.html +129 -0
  53. package/docs/rules_ResourceICUPlurals.js.html +297 -0
  54. package/docs/rules_ResourceQuoteStyle.js.html +238 -0
  55. package/docs/rules_ResourceRegExpChecker.js.html +248 -0
  56. package/docs/rules_ResourceUniqueKeys.js.html +144 -0
  57. package/docs/scripts/collapse.js +20 -0
  58. package/docs/scripts/linenumber.js +25 -0
  59. package/docs/scripts/nav.js +12 -0
  60. package/docs/scripts/polyfill.js +4 -0
  61. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  62. package/docs/scripts/prettify/lang-css.js +2 -0
  63. package/docs/scripts/prettify/prettify.js +28 -0
  64. package/docs/scripts/search.js +83 -0
  65. package/docs/styles/jsdoc.css +765 -0
  66. package/docs/styles/prettify.css +79 -0
  67. package/docs/walk.js.html +214 -0
  68. package/log4js.json +21 -0
  69. package/package.json +83 -0
  70. package/src/Formatter.js +66 -0
  71. package/src/FormatterFactory.js +41 -0
  72. package/src/Parser.js +53 -0
  73. package/src/ParserFactory.js +41 -0
  74. package/src/Plugin.js +99 -0
  75. package/src/PluginManager.js +56 -0
  76. package/src/Result.js +62 -0
  77. package/src/Rule.js +162 -0
  78. package/src/RuleSet.js +84 -0
  79. package/src/SourceFile.js +163 -0
  80. package/src/formatters/AnsiConsoleFormatter.js +78 -0
  81. package/src/index.js +213 -0
  82. package/src/plugins/XliffParser.js +60 -0
  83. package/src/plugins/XliffPlugin.js +60 -0
  84. package/src/rules/ResourceICUPlurals.js +229 -0
  85. package/src/rules/ResourceQuoteStyle.js +170 -0
  86. package/src/rules/ResourceRegExpChecker.js +179 -0
  87. package/src/rules/ResourceUniqueKeys.js +76 -0
  88. package/src/rules/utils.js +78 -0
  89. package/src/walk.js +146 -0
@@ -0,0 +1,153 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="utf-8">
6
+ <title>RuleSet.js - Documentation</title>
7
+
8
+
9
+ <script src="scripts/prettify/prettify.js"></script>
10
+ <script src="scripts/prettify/lang-css.js"></script>
11
+ <!--[if lt IE 9]>
12
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
+ <![endif]-->
14
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
+ <script src="scripts/nav.js" defer></script>
17
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
18
+ </head>
19
+ <body>
20
+
21
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
22
+ <label for="nav-trigger" class="navicon-button x">
23
+ <div class="navicon"></div>
24
+ </label>
25
+
26
+ <label for="nav-trigger" class="overlay"></label>
27
+
28
+ <nav >
29
+
30
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnsiConsoleFormatter.html">AnsiConsoleFormatter</a><ul class='methods'><li data-type='method'><a href="AnsiConsoleFormatter.html#format">format</a></li><li data-type='method'><a href="AnsiConsoleFormatter.html#getDescription">getDescription</a></li></ul></li><li><a href="Formatter.html">Formatter</a><ul class='methods'><li data-type='method'><a href="Formatter.html#format">format</a></li><li data-type='method'><a href="Formatter.html#getDescription">getDescription</a></li><li data-type='method'><a href="Formatter.html#getName">getName</a></li></ul></li><li><a href="FormatterFactory.html">FormatterFactory</a></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getResources">getResources</a></li><li data-type='method'><a href="Parser.html#init">init</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li></ul></li><li><a href="Plugin.html">Plugin</a><ul class='methods'><li data-type='method'><a href="Plugin.html#getExtensions">getExtensions</a></li><li data-type='method'><a href="Plugin.html#getFormatters">getFormatters</a></li><li data-type='method'><a href="Plugin.html#getParsers">getParsers</a></li><li data-type='method'><a href="Plugin.html#getRules">getRules</a></li><li data-type='method'><a href="Plugin.html#getType">getType</a></li><li data-type='method'><a href="Plugin.html#init">init</a></li></ul></li><li><a href="PluginManager.html">PluginManager</a><ul class='methods'><li data-type='method'><a href="PluginManager.html#getHandlers">getHandlers</a></li><li data-type='method'><a href="PluginManager.html#load">load</a></li></ul></li><li><a href="ResourceICUPlurals.html">ResourceICUPlurals</a><ul class='methods'><li data-type='method'><a href="ResourceICUPlurals.html#match">match</a></li></ul></li><li><a href="ResourceQuoteStyle.html">ResourceQuoteStyle</a><ul class='methods'><li data-type='method'><a href="ResourceQuoteStyle.html#match">match</a></li></ul></li><li><a href="ResourceRegExpChecker.html">ResourceRegExpChecker</a><ul class='methods'><li data-type='method'><a href="ResourceRegExpChecker.html#match">match</a></li></ul></li><li><a href="ResourceUniqueKeys.html">ResourceUniqueKeys</a><ul class='methods'><li data-type='method'><a href="ResourceUniqueKeys.html#match">match</a></li></ul></li><li><a href="Result.html">Result</a></li><li><a href="Rule.html">Rule</a><ul class='methods'><li data-type='method'><a href="Rule.html#getDescription">getDescription</a></li><li data-type='method'><a href="Rule.html#getName">getName</a></li><li data-type='method'><a href="Rule.html#getRuleType">getRuleType</a></li><li data-type='method'><a href="Rule.html#match">match</a></li></ul></li><li><a href="RuleSet.html">RuleSet</a><ul class='methods'><li data-type='method'><a href="RuleSet.html#addRule">addRule</a></li><li data-type='method'><a href="RuleSet.html#getRule">getRule</a></li><li data-type='method'><a href="RuleSet.html#getRules">getRules</a></li><li data-type='method'><a href="RuleSet.html#getSize">getSize</a></li></ul></li><li><a href="SourceFile.html">SourceFile</a><ul class='methods'><li data-type='method'><a href="SourceFile.html#findIssues">findIssues</a></li><li data-type='method'><a href="SourceFile.html#getFilePath">getFilePath</a></li><li data-type='method'><a href="SourceFile.html#getLocaleFromPath">getLocaleFromPath</a></li><li data-type='method'><a href="SourceFile.html#getType">getType</a></li><li data-type='method'><a href="SourceFile.html#parse">parse</a></li></ul></li><li><a href="XliffParser.html">XliffParser</a><ul class='methods'><li data-type='method'><a href="XliffParser.html#getResources">getResources</a></li><li data-type='method'><a href="XliffParser.html#parse">parse</a></li></ul></li><li><a href="XliffPlugin.html">XliffPlugin</a><ul class='methods'><li data-type='method'><a href="XliffPlugin.html#getExtensions">getExtensions</a></li><li data-type='method'><a href="XliffPlugin.html#getParsers">getParsers</a></li><li data-type='method'><a href="XliffPlugin.html#getType">getType</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#ParserFactory">ParserFactory</a></li><li><a href="global.html#walk">walk</a></li></ul>
31
+ </nav>
32
+
33
+ <div id="main">
34
+
35
+ <h1 class="page-title">RuleSet.js</h1>
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+ <section>
44
+ <article>
45
+ <pre class="prettyprint source linenums"><code>/*
46
+ * RuleSet.js - Represent a set of ilib-lint rules
47
+ *
48
+ * Copyright © 2022 JEDLSoft
49
+ *
50
+ * Licensed under the Apache License, Version 2.0 (the "License");
51
+ * you may not use this file except in compliance with the License.
52
+ * You may obtain a copy of the License at
53
+ *
54
+ * http://www.apache.org/licenses/LICENSE-2.0
55
+ *
56
+ * Unless required by applicable law or agreed to in writing, software
57
+ * distributed under the License is distributed on an "AS IS" BASIS,
58
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59
+ *
60
+ * See the License for the specific language governing permissions and
61
+ * limitations under the License.
62
+ */
63
+
64
+ import Rule from './Rule.js';
65
+
66
+ /**
67
+ * @class Represent a set of ilib-lint rules.
68
+ */
69
+ class RuleSet {
70
+ /**
71
+ * Construct an ilib-lint rule set.
72
+ */
73
+ constructor(rules) {
74
+ this.rules = {};
75
+ this.byname = {};
76
+ if (rules) {
77
+ rules.forEach(rule => {
78
+ this.addRule(rule);
79
+ });
80
+ }
81
+ }
82
+
83
+ /**
84
+ * @param {Rule} rule
85
+ */
86
+ addRule(rule) {
87
+ if (!rule || !(rule instanceof Rule)) return;
88
+ const name = rule.getName();
89
+ if (this.byname[name]) return; // already added
90
+ this.byname[name] = rule;
91
+ const type = rule.getRuleType();
92
+ if (!this.rules[type]) {
93
+ this.rules[type] = [rule];
94
+ } else {
95
+ this.rules[type].push(rule);
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Return the rule with the given name.
101
+ *
102
+ * @param {String} name name to search for
103
+ * @returns {Rule|undefined} the rule with the given name or
104
+ * undefined if the rule is not known
105
+ */
106
+ getRule(name) {
107
+ return this.byname[name];
108
+ }
109
+
110
+ /**
111
+ * Return all the rules of the given type in this set.
112
+ * @param {String} type to search for
113
+ * @returns {Array.&lt;Rule>} the list of rules of the requested type
114
+ */
115
+ getRules(type) {
116
+ return this.rules[type] || [];
117
+ }
118
+
119
+ /**
120
+ * Return the number of rules in this set.
121
+ * @returns {Number} the number of rules in this set
122
+ */
123
+ getSize() {
124
+ return Object.keys(this.byname).length;
125
+ }
126
+ };
127
+
128
+ export default RuleSet;
129
+ </code></pre>
130
+ </article>
131
+ </section>
132
+
133
+
134
+
135
+
136
+
137
+
138
+ </div>
139
+
140
+ <br class="clear">
141
+
142
+ <footer>
143
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Mon Dec 19 2022 15:00:46 GMT-0800 (Pacific Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
144
+ </footer>
145
+
146
+ <script>prettyPrint();</script>
147
+ <script src="scripts/polyfill.js"></script>
148
+ <script src="scripts/linenumber.js"></script>
149
+
150
+
151
+
152
+ </body>
153
+ </html>