@playcanvas/eslint-config 1.0.10 → 1.0.14

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 (4) hide show
  1. package/LICENSE +5 -7
  2. package/README.md +12 -2
  3. package/index.js +99 -23
  4. package/package.json +2 -2
package/LICENSE CHANGED
@@ -1,6 +1,4 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 PlayCanvas
1
+ Copyright (c) 2011-2021 PlayCanvas Ltd.
4
2
 
5
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +7,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
7
  copies of the Software, and to permit persons to whom the Software is
10
8
  furnished to do so, subject to the following conditions:
11
9
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
14
12
 
15
13
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
14
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
15
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
16
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
17
  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.
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,2 +1,12 @@
1
- # eslint-config-playcanvas
2
- ESLint configuration used by PlayCanvas
1
+ # PlayCanvas ESLint Config
2
+
3
+ ESLint configuration developed by the PlayCanvas team and leveraged by many PlayCanvas-related projects, including the [PlayCanvas Engine][engine]. However, you can use it for any JavaScript-based project if you approve of the PlayCanvas coding style.
4
+
5
+ The configuration is defined in [`index.js`][index]. It configures ESLint's rules in the same order as they are enumerated [here][rules]. It also configures rules for checking JSDoc comments using the ESLint plugin [`eslint-plugin-jsdoc-rules`][jsdoc-plugin].
6
+
7
+ The configuration attempts to enable as many rules as possible, particularly those categorized as 'recommended' by ESLint.
8
+
9
+ [engine]: https://github.com/playcanvas/engine
10
+ [index]: https://github.com/playcanvas/playcanvas-eslint-config/blob/master/index.js
11
+ [rules]: https://eslint.org/docs/rules/
12
+ [jsdoc-plugin]: https://github.com/gajus/eslint-plugin-jsdoc
package/index.js CHANGED
@@ -54,7 +54,7 @@ module.exports = {
54
54
  "no-sparse-arrays": "error",
55
55
  "no-template-curly-in-string": "error",
56
56
  "no-this-before-super": "error",
57
- "no-undef": "off",
57
+ "no-undef": "error",
58
58
  "no-unexpected-multiline": "error",
59
59
  "no-unmodified-loop-condition": "error",
60
60
  "no-unreachable": "error",
@@ -62,13 +62,17 @@ module.exports = {
62
62
  "no-unsafe-finally": "error",
63
63
  "no-unsafe-negation": "error",
64
64
  "no-unsafe-optional-chaining": "error",
65
- "no-unused-private-class-members": "off", // update to error (requires eslint 8.1.0)
65
+ "no-unused-private-class-members": "error",
66
66
  "no-unused-vars": [
67
- "warn", {
67
+ "error", {
68
68
  "args": "none"
69
69
  }
70
70
  ],
71
- "no-use-before-define": ["error", { "functions": false }],
71
+ "no-use-before-define": [
72
+ "error", {
73
+ "functions": false
74
+ }
75
+ ],
72
76
  "no-useless-backreference": "error",
73
77
  "require-atomic-updates": "error",
74
78
  "use-isnan": "error",
@@ -218,7 +222,11 @@ module.exports = {
218
222
  "sort-imports": "off",
219
223
  "sort-keys": "off",
220
224
  "sort-vars": "off",
221
- "spaced-comment": ["error", "always", { "exceptions": ["/"] }],
225
+ "spaced-comment": [
226
+ "error", "always", {
227
+ "exceptions": ["/"]
228
+ }
229
+ ],
222
230
  "strict": "error",
223
231
  "symbol-description": "error",
224
232
  "vars-on-top": "off",
@@ -228,12 +236,21 @@ module.exports = {
228
236
  "array-bracket-newline": ["error", "consistent"],
229
237
  "array-bracket-spacing": ["error", "never"],
230
238
  "array-element-newline": "off",
231
- "arrow-parens": ["error", "always"],
239
+ "arrow-parens": [
240
+ "error", "as-needed", {
241
+ "requireForBlockBody": true
242
+ }
243
+ ],
232
244
  "arrow-spacing": "error",
233
245
  "block-spacing": "error",
234
246
  "brace-style": "error",
235
247
  "comma-dangle": ["error", "never"],
236
- "comma-spacing": ["error", { "before": false, "after": true }],
248
+ "comma-spacing": [
249
+ "error", {
250
+ "before": false,
251
+ "after": true
252
+ }
253
+ ],
237
254
  "comma-style": ["error", "last"],
238
255
  "computed-property-spacing": ["error", "never"],
239
256
  "dot-location": ["error", "property"],
@@ -253,8 +270,18 @@ module.exports = {
253
270
  }
254
271
  ],
255
272
  "jsx-quotes": "off",
256
- "key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
257
- "keyword-spacing": ["error", { "before": true, "after": true }],
273
+ "key-spacing": [
274
+ "error", {
275
+ "beforeColon": false,
276
+ "afterColon": true
277
+ }
278
+ ],
279
+ "keyword-spacing": [
280
+ "error", {
281
+ "before": true,
282
+ "after": true
283
+ }
284
+ ],
258
285
  "line-comment-position": "off",
259
286
  "linebreak-style": "off",
260
287
  "lines-around-comment": "off",
@@ -266,27 +293,66 @@ module.exports = {
266
293
  "newline-per-chained-call": "off",
267
294
  "no-extra-parens": ["error", "functions"],
268
295
  "no-mixed-spaces-and-tabs": "error",
269
- "no-multi-spaces": "off",
270
- "no-multiple-empty-lines": ["error", { "max": 2, "maxBOF": 0, "maxEOF": 0 }],
296
+ "no-multi-spaces": [
297
+ "error", {
298
+ "ignoreEOLComments": true,
299
+ "exceptions": {
300
+ "ArrayExpression": true,
301
+ "AssignmentExpression": true,
302
+ "BinaryExpression": true,
303
+ "IfStatement": true,
304
+ "LogicalExpression": true,
305
+ "SwitchCase": true,
306
+ "VariableDeclarator": true
307
+ }
308
+ }
309
+ ],
310
+ "no-multiple-empty-lines": [
311
+ "error", {
312
+ "max": 2,
313
+ "maxBOF": 0,
314
+ "maxEOF": 0
315
+ }
316
+ ],
271
317
  "no-tabs": "error",
272
318
  "no-trailing-spaces": "error",
273
319
  "no-whitespace-before-property": "error",
274
320
  "nonblock-statement-body-position": "off",
275
- "object-curly-newline": ["error", { "consistent": true }],
321
+ "object-curly-newline": [
322
+ "error", {
323
+ "consistent": true
324
+ }
325
+ ],
276
326
  "object-curly-spacing": ["error", "always"],
277
- "object-property-newline": ["error", { "allowAllPropertiesOnSameLine": true }],
327
+ "object-property-newline": [
328
+ "error", {
329
+ "allowAllPropertiesOnSameLine": true
330
+ }
331
+ ],
278
332
  "operator-linebreak": ["error", "after"],
279
- "padded-blocks": ["error", {
280
- "classes": "never"
281
- }],
333
+ "padded-blocks": [
334
+ "error", {
335
+ "classes": "never"
336
+ }
337
+ ],
282
338
  "padding-line-between-statements": "off",
283
339
  "quotes": ["off", "single"],
284
340
  "rest-spread-spacing": "error",
285
341
  "semi": ["error", "always"],
286
- "semi-spacing": [ "error", { "before": false, "after": true } ],
342
+ "semi-spacing": [
343
+ "error", {
344
+ "before": false,
345
+ "after": true
346
+ }
347
+ ],
287
348
  "semi-style": ["error", "last"],
288
349
  "space-before-blocks": "error",
289
- "space-before-function-paren": ["error", { "anonymous": "always", "named": "never" }],
350
+ "space-before-function-paren": [
351
+ "error", {
352
+ "anonymous": "always",
353
+ "named": "never"
354
+ }
355
+ ],
290
356
  "space-in-parens": ["error", "never"],
291
357
  "space-infix-ops": [
292
358
  "error", {
@@ -300,7 +366,12 @@ module.exports = {
300
366
  "overrides": {
301
367
  }
302
368
  }],
303
- "switch-colon-spacing": ["error", {"after": true, "before": false}],
369
+ "switch-colon-spacing": [
370
+ "error", {
371
+ "after": true,
372
+ "before": false
373
+ }
374
+ ],
304
375
  "template-curly-spacing": "error",
305
376
  "template-tag-spacing": "error",
306
377
  "unicode-bom": ["error", "never"],
@@ -333,17 +404,21 @@ module.exports = {
333
404
  "jsdoc/no-bad-blocks": "off",
334
405
  "jsdoc/no-defaults": "off",
335
406
  "jsdoc/no-missing-syntax": "off",
336
- "jsdoc/no-multi-asterisks": "off",
407
+ "jsdoc/no-multi-asterisks": "error",
337
408
  "jsdoc/no-restricted-syntax": "off",
338
409
  "jsdoc/no-types": "off",
339
410
  "jsdoc/no-undefined-types": "off",
340
- "jsdoc/require-asterisk-prefix": "off",
341
- "jsdoc/require-description-complete-sentence": "off",
411
+ "jsdoc/require-asterisk-prefix": "error",
412
+ "jsdoc/require-description-complete-sentence": [
413
+ "off", {
414
+ "abbreviations": ["e.g."]
415
+ }
416
+ ],
342
417
  "jsdoc/require-description": "off",
343
418
  "jsdoc/require-example": "off",
344
419
  "jsdoc/require-file-overview": "off",
345
420
  "jsdoc/require-hyphen-before-param-description": ["error", "always"],
346
- "jsdoc/require-jsdoc": "off", // Not everything needs to be documented
421
+ "jsdoc/require-jsdoc": "off",
347
422
  "jsdoc/require-param-description": "error",
348
423
  "jsdoc/require-param-name": "error",
349
424
  "jsdoc/require-param-type": "error",
@@ -369,6 +444,7 @@ module.exports = {
369
444
 
370
445
  "env": {
371
446
  "browser": true,
447
+ "es6": true,
372
448
  "node": true
373
449
  }
374
450
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcanvas/eslint-config",
3
- "version": "1.0.10",
3
+ "version": "1.0.14",
4
4
  "author": "PlayCanvas <support@playcanvas.com>",
5
5
  "homepage": "https://playcanvas.com",
6
6
  "description": "ESLint configuration used by PlayCanvas",
@@ -26,7 +26,7 @@
26
26
  "README.md"
27
27
  ],
28
28
  "dependencies": {
29
- "eslint-plugin-jsdoc": "^37.0.0"
29
+ "eslint-plugin-jsdoc": "^37.1.0"
30
30
  },
31
31
  "scripts": {
32
32
  "test": "echo \"Error: no test specified\" && exit 1"