@plugjs/eslint-plugin 0.0.1

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/LICENSE.md ADDED
@@ -0,0 +1,211 @@
1
+ # Apache License
2
+
3
+ Version 2.0, January 2004
4
+
5
+ [http://www.apache.org/licenses/](http://www.apache.org/licenses/)
6
+
7
+ ##### TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ ### 1. Definitions.
10
+
11
+ "**License**" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "**Licensor**" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "**Legal Entity**" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "**control**" means **(i)** the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, _or_ **(ii)** ownership of fifty percent (50%) or more of
23
+ the outstanding shares, _or_ **(iii)** beneficial ownership of such
24
+ entity.
25
+
26
+ "**You**" (or "**Your**") shall mean an individual or Legal Entity
27
+ exercising permissions granted by this License.
28
+
29
+ "**Source**" form shall mean the preferred form for making
30
+ modifications, including but not limited to software source code,
31
+ documentation source, and configuration files.
32
+
33
+ "**Object**" form shall mean any form resulting from mechanical
34
+ transformation or translation of a Source form, including but not
35
+ limited to compiled object code, generated documentation, and
36
+ conversions to other media types.
37
+
38
+ "**Work**" shall mean the work of authorship, whether in Source or
39
+ Object form, made available under the License, as indicated by a
40
+ copyright notice that is included in or attached to the work (an example
41
+ is provided in the Appendix below).
42
+
43
+ "**Derivative Works**" shall mean any work, whether in Source or Object
44
+ form, that is based on (or derived from) the Work and for which the
45
+ editorial revisions, annotations, elaborations, or other modifications
46
+ represent, as a whole, an original work of authorship. For the purposes
47
+ of this License, Derivative Works shall not include works that remain
48
+ separable from, or merely link (or bind by name) to the interfaces of,
49
+ the Work and Derivative Works thereof.
50
+
51
+ "**Contribution**" shall mean any work of authorship, including the
52
+ original version of the Work and any modifications or additions to that
53
+ Work or Derivative Works thereof, that is intentionally submitted to
54
+ Licensor for inclusion in the Work by the copyright owner or by an
55
+ individual or Legal Entity authorized to submit on behalf of the
56
+ copyright owner. For the purposes of this definition, "**submitted**"
57
+ means any form of electronic, verbal, or written communication sent to
58
+ the Licensor or its representatives, including but not limited to
59
+ communication on electronic mailing lists, source code control systems,
60
+ and issue tracking systems that are managed by, or on behalf of, the
61
+ Licensor for the purpose of discussing and improving the Work, but
62
+ excluding communication that is conspicuously marked or otherwise
63
+ designated in writing by the copyright owner as "**Not a
64
+ Contribution**".
65
+
66
+ "**Contributor**" shall mean Licensor and any individual or Legal Entity
67
+ on behalf of whom a Contribution has been received by Licensor and
68
+ subsequently incorporated within the Work.
69
+
70
+ ### 2. Grant of Copyright License.
71
+
72
+ Subject to the terms and conditions of this License, each Contributor
73
+ hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
74
+ royalty-free, irrevocable copyright license to reproduce, prepare
75
+ Derivative Works of, publicly display, publicly perform, sublicense,
76
+ and distribute the Work and such Derivative Works in Source or Object
77
+ form.
78
+
79
+ ### 3. Grant of Patent License.
80
+
81
+ Subject to the terms and conditions of this License, each Contributor
82
+ hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
83
+ royalty-free, irrevocable (except as stated in this section) patent
84
+ license to make, have made, use, offer to sell, sell, import, and
85
+ otherwise transfer the Work, where such license applies only to those
86
+ patent claims licensable by such Contributor that are necessarily
87
+ infringed by their Contribution(s) alone or by combination of their
88
+ Contribution(s) with the Work to which such Contribution(s) was
89
+ submitted. If You institute patent litigation against any entity
90
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
91
+ the Work or a Contribution incorporated within the Work constitutes
92
+ direct or contributory patent infringement, then any patent licenses
93
+ granted to You under this License for that Work shall terminate as of
94
+ the date such litigation is filed.
95
+
96
+ ### 4. Redistribution.
97
+
98
+ You may reproduce and distribute copies of the Work or Derivative Works
99
+ thereof in any medium, with or without modifications, and in Source or
100
+ Object form, provided that You meet the following conditions:
101
+
102
+ <ol type="a">
103
+ <li>You must give any other recipients of the Work or Derivative Works
104
+ a copy of this License; and
105
+ <li>You must cause any modified files to carry prominent notices
106
+ stating that You changed the files; and
107
+ <li>You must retain, in the Source form of any Derivative Works that
108
+ You distribute, all copyright, patent, trademark, and attribution
109
+ notices from the Source form of the Work, excluding those notices
110
+ that do not pertain to any part of the Derivative Works; and
111
+ <li>If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained within
114
+ such NOTICE file, excluding those notices that do not pertain to any
115
+ part of the Derivative Works, in at least one of the following
116
+ places: within a NOTICE text file distributed as part of the
117
+ Derivative Works; within the Source form or documentation, if
118
+ provided along with the Derivative Works; or, within a display
119
+ generated by the Derivative Works, if and wherever such third-party
120
+ notices normally appear. The contents of the NOTICE file are for
121
+ informational purposes only and do not modify the License. You may
122
+ add Your own attribution notices within Derivative Works that You
123
+ distribute, alongside or as an addendum to the NOTICE text from the
124
+ Work, provided that such additional attribution notices cannot be
125
+ construed as modifying the License.
126
+ </ol>
127
+
128
+ You may add Your own copyright statement to Your modifications and may
129
+ provide additional or different license terms and conditions for use,
130
+ reproduction, or distribution of Your modifications, or for any such
131
+ Derivative Works as a whole, provided Your use, reproduction, and
132
+ distribution of the Work otherwise complies with the conditions stated
133
+ in this License.
134
+
135
+ ### 5. Submission of Contributions.
136
+
137
+ Unless You explicitly state otherwise, any Contribution intentionally
138
+ submitted for inclusion in the Work by You to the Licensor shall be
139
+ under the terms and conditions of this License, without any additional
140
+ terms or conditions. Notwithstanding the above, nothing herein shall
141
+ supersede or modify the terms of any separate license agreement you may
142
+ have executed with Licensor regarding such Contributions.
143
+
144
+ ### 6. Trademarks.
145
+
146
+ This License does not grant permission to use the trade names,
147
+ trademarks, service marks, or product names of the Licensor, except as
148
+ required for reasonable and customary use in describing the origin of
149
+ the Work and reproducing the content of the NOTICE file.
150
+
151
+ ### 7. Disclaimer of Warranty.
152
+
153
+ Unless required by applicable law or agreed to in writing, Licensor
154
+ provides the Work (and each Contributor provides its Contributions) on
155
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
156
+ express or implied, including, without limitation, any warranties or
157
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR
158
+ A PARTICULAR PURPOSE. You are solely responsible for determining the
159
+ appropriateness of using or redistributing the Work and assume any risks
160
+ associated with Your exercise of permissions under this License.
161
+
162
+ ### 8. Limitation of Liability.
163
+
164
+ In no event and under no legal theory, whether in tort (including
165
+ negligence), contract, or otherwise, unless required by applicable law
166
+ (such as deliberate and grossly negligent acts) or agreed to in writing,
167
+ shall any Contributor be liable to You for damages, including any
168
+ direct, indirect, special, incidental, or consequential damages of any
169
+ character arising as a result of this License or out of the use or
170
+ inability to use the Work (including but not limited to damages for loss
171
+ of goodwill, work stoppage, computer failure or malfunction, or any and
172
+ all other commercial damages or losses), even if such Contributor has
173
+ been advised of the possibility of such damages.
174
+
175
+ ### 9. Accepting Warranty or Additional Liability.
176
+
177
+ While redistributing the Work or Derivative Works thereof, You may
178
+ choose to offer, and charge a fee for, acceptance of support, warranty,
179
+ indemnity, or other liability obligations and/or rights consistent with
180
+ this License. However, in accepting such obligations, You may act only
181
+ on Your own behalf and on Your sole responsibility, not on behalf of any
182
+ other Contributor, and only if You agree to indemnify, defend, and hold
183
+ each Contributor harmless for any liability incurred by, or claims
184
+ asserted against, such Contributor by reason of your accepting any
185
+ such warranty or additional liability.
186
+
187
+ ##### END OF TERMS AND CONDITIONS
188
+
189
+ ## APPENDIX: How to apply the Apache License to your work.
190
+
191
+ To apply the Apache License to your work, attach the following
192
+ boilerplate notice, with the fields enclosed by brackets "[]"
193
+ replaced with your own identifying information. (Don't include the
194
+ brackets!) The text should be enclosed in the appropriate comment
195
+ syntax for the file format. We also recommend that a file or class name
196
+ and description of purpose be included on the same "printed page" as the
197
+ copyright notice for easier identification within third-party archives.
198
+
199
+ > #### Copyright [yyyy] [name of copyright owner]
200
+ >
201
+ > Licensed under the Apache License, Version 2.0 (the "License");
202
+ > you may not use this file except in compliance with the License.
203
+ > You may obtain a copy of the License at
204
+ >
205
+ > [http://www.apache.org/licenses/](http://www.apache.org/licenses/)
206
+ >
207
+ > Unless required by applicable law or agreed to in writing, software
208
+ > distributed under the License is distributed on an "AS IS" BASIS,
209
+ > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
210
+ > See the License for the specific language governing permissions and
211
+ > limitations under the License.
package/NOTICE.md ADDED
@@ -0,0 +1,13 @@
1
+ # Copyright 2022 Juit GmbH
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ [http://www.apache.org/licenses/](http://www.apache.org/licenses/)
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ PlugJS ESLint Shared Configuration
2
+ ==================================
3
+
4
+ This package exports simple configurations for linting our project. It's the
5
+ easiest way to actually share some configs and plugins.
6
+
7
+ Just add in your `.eslintrc.cjs` something similar to:
8
+
9
+ ```javascript
10
+ module.exports = {
11
+ root: true,
12
+ extends: [
13
+ 'plugin:@plugjs/typescript',
14
+ ],
15
+ }
16
+ ```
17
+
18
+ * [Copyright Notice](NOTICE.md)
19
+ * [License](LICENSE.md)
@@ -0,0 +1,135 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ env: {
5
+ es2020: true,
6
+ },
7
+ parser: '@typescript-eslint/parser',
8
+ parserOptions: {
9
+ ecmaVersion: 2020,
10
+ createDefaultProgram: false,
11
+ project: [
12
+ './tsconfig.json',
13
+ ],
14
+ },
15
+ plugins: [
16
+ '@typescript-eslint',
17
+ ],
18
+ extends: [
19
+ 'google',
20
+ 'eslint:recommended',
21
+ 'plugin:@typescript-eslint/eslint-recommended',
22
+ ],
23
+ rules: {
24
+ // No logging / no debugging
25
+ 'no-console': 'warn',
26
+ 'no-debugger': 'warn',
27
+
28
+ // Indenting, but for TypeScript
29
+ 'indent': [ 'off' ],
30
+ '@typescript-eslint/indent': [ 'error', 2, {
31
+ 'CallExpression': {
32
+ 'arguments': 2,
33
+ },
34
+ 'FunctionDeclaration': {
35
+ 'body': 1,
36
+ 'parameters': 2,
37
+ },
38
+ 'FunctionExpression': {
39
+ 'body': 1,
40
+ 'parameters': 2,
41
+ },
42
+ 'MemberExpression': 2,
43
+ 'ObjectExpression': 1,
44
+ 'SwitchCase': 1,
45
+ 'ignoredNodes': [
46
+ 'ConditionalExpression',
47
+ ],
48
+ } ],
49
+
50
+ // Spaces before function parenthesis, for TypeScript
51
+ 'space-before-function-paren': [ 'off' ],
52
+ '@typescript-eslint/space-before-function-paren': [ 'error', {
53
+ asyncArrow: 'always',
54
+ anonymous: 'never',
55
+ named: 'never',
56
+ } ],
57
+
58
+ // Always have spaces around arrays and objects
59
+ 'array-bracket-spacing': [ 'error', 'always' ],
60
+ 'object-curly-spacing': [ 'error', 'always' ],
61
+
62
+ // Always have newline character at the end of the file
63
+ 'eol-last': [ 'error', 'always' ],
64
+
65
+ // Constraints for the max line length
66
+ // 'max-len': [ 'error', { 'code': 120, 'comments': 80 } ],
67
+ 'max-len': [ 'off' ],
68
+
69
+ // No more than 2 blank lines
70
+ 'no-multiple-empty-lines': [ 'error', { 'max': 2, 'maxBOF': 0, 'maxEOF': 1 } ],
71
+
72
+ // Srings: either '...' or `... ${...} ...`, and no 'ab' + 'cd'
73
+ 'no-template-curly-in-string': [ 'error' ],
74
+ 'quotes': [ 'error', 'single', { 'allowTemplateLiterals': false } ],
75
+ 'no-useless-concat': [ 'error' ],
76
+
77
+ // One variable per declaration, no "const x, y, ..."
78
+ 'one-var': [ 'error', 'never' ],
79
+
80
+ // No semicolons
81
+ 'semi': [ 'error', 'never' ],
82
+
83
+ // Allow TypeScript triple-slash comments
84
+ 'spaced-comment': [ 'error', 'always', { 'markers': [ '/ <reference' ] } ],
85
+
86
+ // Remember our TODOs and FIXMEs
87
+ 'no-warning-comments': [ 'warn' ],
88
+
89
+ // No "proper" JSDoc
90
+ 'require-jsdoc': [ 'off' ], // nope!
91
+ 'valid-jsdoc': [ 'off' ], // nope as well!
92
+
93
+ // TypeScript sanity
94
+ '@typescript-eslint/no-unused-vars': [ 'error' ],
95
+ '@typescript-eslint/no-dupe-class-members': [ 'error' ],
96
+ '@typescript-eslint/no-invalid-this': [ 'error' ],
97
+ '@typescript-eslint/no-floating-promises': [ 'error' ],
98
+ '@typescript-eslint/explicit-function-return-type': [ 'error', {
99
+ 'allowDirectConstAssertionInArrowFunctions': true,
100
+ 'allowConciseArrowFunctionExpressionsStartingWithVoid': true,
101
+ } ],
102
+
103
+ // Turn off specific JavaScript rules
104
+ 'guard-for-in': [ 'off' ], // no errors on for ... in
105
+ 'no-undef': [ 'off' ], // it'll mark global types as undefs
106
+ 'no-redeclare': [ 'off' ], // use @typescript/no-redeclare
107
+ 'no-unused-vars': [ 'off' ], // use @typescript/no-unused-vars
108
+ 'no-dupe-class-members': [ 'off' ], // use @typescript/no-dupe-class-members
109
+ 'no-invalid-this': [ 'off' ], // use @typescript/no-invalid-this
110
+ },
111
+ overrides: [ {
112
+ files: [ '*.js' ],
113
+ parser: 'espree',
114
+ env: {
115
+ node: true,
116
+ },
117
+ rules: {
118
+ 'strict': [ 'error', 'global' ],
119
+
120
+ // JavaScript sanity
121
+ 'no-undef': [ 'error' ],
122
+ 'no-redeclare': [ 'error' ],
123
+ 'no-unused-vars': [ 'error' ],
124
+ 'no-dupe-class-members': [ 'error' ],
125
+ 'no-invalid-this': [ 'error' ],
126
+
127
+ // Turn off specific TypeScript rules
128
+ '@typescript-eslint/no-unused-vars': [ 'off' ],
129
+ '@typescript-eslint/no-dupe-class-members': [ 'off' ],
130
+ '@typescript-eslint/no-invalid-this': [ 'off' ],
131
+ '@typescript-eslint/no-floating-promises': [ 'off' ],
132
+ '@typescript-eslint/explicit-function-return-type': [ 'off' ],
133
+ },
134
+ } ],
135
+ }
package/index.cjs ADDED
@@ -0,0 +1,5 @@
1
+ 'use strict'
2
+
3
+ const typescript = require('./configs/typescript.cjs')
4
+
5
+ module.exports.configs = { typescript }
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@plugjs/eslint-plugin",
3
+ "version": "0.0.1",
4
+ "description": "Shared ESLint configurations and extras",
5
+ "main": "./index.cjs",
6
+ "author": "Team Juit <developers@juit.com>",
7
+ "license": "Apache-2.0",
8
+ "peerDependencies": {
9
+ "@typescript-eslint/eslint-plugin": ">=5",
10
+ "@typescript-eslint/parser": ">=5"
11
+ },
12
+ "dependencies": {
13
+ "eslint-config-google": "^0.14.0"
14
+ }
15
+ }