@playcanvas/eslint-config 1.0.12 → 1.0.16

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 +25 -2
  3. package/index.js +81 -30
  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,25 @@
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
+ ## Using this config in your own projects
10
+
11
+ Edit your project's `package.json` file:
12
+
13
+ 1. Add `eslint` and `@playcanvas/eslint-config` to your `devDependencies` section.
14
+ 2. Add an `eslintConfig` section. At a minimum, you will need:
15
+
16
+ ```json
17
+ "eslintConfig": {
18
+ "extends": "@playcanvas/eslint-config"
19
+ },
20
+ ```
21
+
22
+ [engine]: https://github.com/playcanvas/engine
23
+ [index]: https://github.com/playcanvas/playcanvas-eslint-config/blob/master/index.js
24
+ [rules]: https://eslint.org/docs/rules/
25
+ [jsdoc-plugin]: https://github.com/gajus/eslint-plugin-jsdoc
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
 
3
3
  "parserOptions": {
4
- "ecmaVersion": 2015,
4
+ "ecmaVersion": "latest",
5
5
  "sourceType": "module",
6
6
  "ecmaFeatures": {}
7
7
  },
@@ -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",
@@ -93,7 +97,7 @@ module.exports = {
93
97
  "func-name-matching": "error",
94
98
  "func-names": "off",
95
99
  "func-style": "off",
96
- "grouped-accessor-pairs": "error",
100
+ "grouped-accessor-pairs": ["error", "setBeforeGet"],
97
101
  "guard-for-in": "off",
98
102
  "id-denylist": "off",
99
103
  "id-length": "off",
@@ -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",
@@ -237,7 +245,12 @@ module.exports = {
237
245
  "block-spacing": "error",
238
246
  "brace-style": "error",
239
247
  "comma-dangle": ["error", "never"],
240
- "comma-spacing": ["error", { "before": false, "after": true }],
248
+ "comma-spacing": [
249
+ "error", {
250
+ "before": false,
251
+ "after": true
252
+ }
253
+ ],
241
254
  "comma-style": ["error", "last"],
242
255
  "computed-property-spacing": ["error", "never"],
243
256
  "dot-location": ["error", "property"],
@@ -257,8 +270,18 @@ module.exports = {
257
270
  }
258
271
  ],
259
272
  "jsx-quotes": "off",
260
- "key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
261
- "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
+ ],
262
285
  "line-comment-position": "off",
263
286
  "linebreak-style": "off",
264
287
  "lines-around-comment": "off",
@@ -284,26 +307,52 @@ module.exports = {
284
307
  }
285
308
  }
286
309
  ],
287
- "no-multiple-empty-lines": ["error", { "max": 2, "maxBOF": 0, "maxEOF": 0 }],
310
+ "no-multiple-empty-lines": [
311
+ "error", {
312
+ "max": 2,
313
+ "maxBOF": 0,
314
+ "maxEOF": 0
315
+ }
316
+ ],
288
317
  "no-tabs": "error",
289
318
  "no-trailing-spaces": "error",
290
319
  "no-whitespace-before-property": "error",
291
320
  "nonblock-statement-body-position": "off",
292
- "object-curly-newline": ["error", { "consistent": true }],
321
+ "object-curly-newline": [
322
+ "error", {
323
+ "consistent": true
324
+ }
325
+ ],
293
326
  "object-curly-spacing": ["error", "always"],
294
- "object-property-newline": ["error", { "allowAllPropertiesOnSameLine": true }],
327
+ "object-property-newline": [
328
+ "error", {
329
+ "allowAllPropertiesOnSameLine": true
330
+ }
331
+ ],
295
332
  "operator-linebreak": ["error", "after"],
296
- "padded-blocks": ["error", {
297
- "classes": "never"
298
- }],
333
+ "padded-blocks": [
334
+ "error", {
335
+ "classes": "never"
336
+ }
337
+ ],
299
338
  "padding-line-between-statements": "off",
300
339
  "quotes": ["off", "single"],
301
340
  "rest-spread-spacing": "error",
302
341
  "semi": ["error", "always"],
303
- "semi-spacing": [ "error", { "before": false, "after": true } ],
342
+ "semi-spacing": [
343
+ "error", {
344
+ "before": false,
345
+ "after": true
346
+ }
347
+ ],
304
348
  "semi-style": ["error", "last"],
305
349
  "space-before-blocks": "error",
306
- "space-before-function-paren": ["error", { "anonymous": "always", "named": "never" }],
350
+ "space-before-function-paren": [
351
+ "error", {
352
+ "anonymous": "always",
353
+ "named": "never"
354
+ }
355
+ ],
307
356
  "space-in-parens": ["error", "never"],
308
357
  "space-infix-ops": [
309
358
  "error", {
@@ -317,7 +366,12 @@ module.exports = {
317
366
  "overrides": {
318
367
  }
319
368
  }],
320
- "switch-colon-spacing": ["error", {"after": true, "before": false}],
369
+ "switch-colon-spacing": [
370
+ "error", {
371
+ "after": true,
372
+ "before": false
373
+ }
374
+ ],
321
375
  "template-curly-spacing": "error",
322
376
  "template-tag-spacing": "error",
323
377
  "unicode-bom": ["error", "never"],
@@ -330,24 +384,20 @@ module.exports = {
330
384
  "jsdoc/check-alignment": "error",
331
385
  "jsdoc/check-examples": "off",
332
386
  "jsdoc/check-indentation": "off",
333
- "jsdoc/check-line-alignment": "off",
387
+ "jsdoc/check-line-alignment": "error",
334
388
  "jsdoc/check-param-names": "off",
335
389
  "jsdoc/check-property-names": "error",
336
390
  "jsdoc/check-syntax": "error",
337
- "jsdoc/check-tag-names": [
338
- "error", {
339
- "definedTags": ["component", "field"]
340
- }
341
- ],
391
+ "jsdoc/check-tag-names": "error",
342
392
  "jsdoc/check-types": "error",
343
393
  "jsdoc/check-values": "error",
344
394
  "jsdoc/empty-tags": "error",
345
395
  "jsdoc/implements-on-classes": "error",
346
396
  "jsdoc/match-description": "off",
347
397
  "jsdoc/match-name": "off",
348
- "jsdoc/multiline-blocks": "off",
398
+ "jsdoc/multiline-blocks": "error",
349
399
  "jsdoc/newline-after-description": "error",
350
- "jsdoc/no-bad-blocks": "off",
400
+ "jsdoc/no-bad-blocks": "error",
351
401
  "jsdoc/no-defaults": "off",
352
402
  "jsdoc/no-missing-syntax": "off",
353
403
  "jsdoc/no-multi-asterisks": "error",
@@ -364,7 +414,7 @@ module.exports = {
364
414
  "jsdoc/require-example": "off",
365
415
  "jsdoc/require-file-overview": "off",
366
416
  "jsdoc/require-hyphen-before-param-description": ["error", "always"],
367
- "jsdoc/require-jsdoc": "off", // Not everything needs to be documented
417
+ "jsdoc/require-jsdoc": "off",
368
418
  "jsdoc/require-param-description": "error",
369
419
  "jsdoc/require-param-name": "error",
370
420
  "jsdoc/require-param-type": "error",
@@ -378,8 +428,8 @@ module.exports = {
378
428
  "jsdoc/require-returns-type": "error",
379
429
  "jsdoc/require-returns": "error",
380
430
  "jsdoc/require-throws": "off",
381
- "jsdoc/require-yields": "off",
382
- "jsdoc/require-yields-check": "off",
431
+ "jsdoc/require-yields": "error",
432
+ "jsdoc/require-yields-check": "error",
383
433
  "jsdoc/tag-lines": "off",
384
434
  "jsdoc/valid-types": "off"
385
435
  },
@@ -390,6 +440,7 @@ module.exports = {
390
440
 
391
441
  "env": {
392
442
  "browser": true,
443
+ "es6": true,
393
444
  "node": true
394
445
  }
395
446
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcanvas/eslint-config",
3
- "version": "1.0.12",
3
+ "version": "1.0.16",
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.3"
29
+ "eslint-plugin-jsdoc": "^37.5.1"
30
30
  },
31
31
  "scripts": {
32
32
  "test": "echo \"Error: no test specified\" && exit 1"