@playcanvas/eslint-config 1.0.11 → 1.0.15

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 +79 -20
  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
@@ -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",
@@ -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", "as-needed"],
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",
@@ -280,26 +307,52 @@ module.exports = {
280
307
  }
281
308
  }
282
309
  ],
283
- "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
+ ],
284
317
  "no-tabs": "error",
285
318
  "no-trailing-spaces": "error",
286
319
  "no-whitespace-before-property": "error",
287
320
  "nonblock-statement-body-position": "off",
288
- "object-curly-newline": ["error", { "consistent": true }],
321
+ "object-curly-newline": [
322
+ "error", {
323
+ "consistent": true
324
+ }
325
+ ],
289
326
  "object-curly-spacing": ["error", "always"],
290
- "object-property-newline": ["error", { "allowAllPropertiesOnSameLine": true }],
327
+ "object-property-newline": [
328
+ "error", {
329
+ "allowAllPropertiesOnSameLine": true
330
+ }
331
+ ],
291
332
  "operator-linebreak": ["error", "after"],
292
- "padded-blocks": ["error", {
293
- "classes": "never"
294
- }],
333
+ "padded-blocks": [
334
+ "error", {
335
+ "classes": "never"
336
+ }
337
+ ],
295
338
  "padding-line-between-statements": "off",
296
339
  "quotes": ["off", "single"],
297
340
  "rest-spread-spacing": "error",
298
341
  "semi": ["error", "always"],
299
- "semi-spacing": [ "error", { "before": false, "after": true } ],
342
+ "semi-spacing": [
343
+ "error", {
344
+ "before": false,
345
+ "after": true
346
+ }
347
+ ],
300
348
  "semi-style": ["error", "last"],
301
349
  "space-before-blocks": "error",
302
- "space-before-function-paren": ["error", { "anonymous": "always", "named": "never" }],
350
+ "space-before-function-paren": [
351
+ "error", {
352
+ "anonymous": "always",
353
+ "named": "never"
354
+ }
355
+ ],
303
356
  "space-in-parens": ["error", "never"],
304
357
  "space-infix-ops": [
305
358
  "error", {
@@ -313,7 +366,12 @@ module.exports = {
313
366
  "overrides": {
314
367
  }
315
368
  }],
316
- "switch-colon-spacing": ["error", {"after": true, "before": false}],
369
+ "switch-colon-spacing": [
370
+ "error", {
371
+ "after": true,
372
+ "before": false
373
+ }
374
+ ],
317
375
  "template-curly-spacing": "error",
318
376
  "template-tag-spacing": "error",
319
377
  "unicode-bom": ["error", "never"],
@@ -360,7 +418,7 @@ module.exports = {
360
418
  "jsdoc/require-example": "off",
361
419
  "jsdoc/require-file-overview": "off",
362
420
  "jsdoc/require-hyphen-before-param-description": ["error", "always"],
363
- "jsdoc/require-jsdoc": "off", // Not everything needs to be documented
421
+ "jsdoc/require-jsdoc": "off",
364
422
  "jsdoc/require-param-description": "error",
365
423
  "jsdoc/require-param-name": "error",
366
424
  "jsdoc/require-param-type": "error",
@@ -386,6 +444,7 @@ module.exports = {
386
444
 
387
445
  "env": {
388
446
  "browser": true,
447
+ "es6": true,
389
448
  "node": true
390
449
  }
391
450
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcanvas/eslint-config",
3
- "version": "1.0.11",
3
+ "version": "1.0.15",
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.1.0"
30
30
  },
31
31
  "scripts": {
32
32
  "test": "echo \"Error: no test specified\" && exit 1"