@playcanvas/eslint-config 2.1.0 → 3.0.0-beta.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 CHANGED
@@ -1,19 +1,19 @@
1
- Copyright (c) 2011-2021 PlayCanvas Ltd.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
1
+ Copyright (c) 2011-2026 PlayCanvas Ltd.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,44 +1,80 @@
1
- # PlayCanvas ESLint Config
2
-
3
- ESLint configuration developed by the PlayCanvas team and leveraged by many PlayCanvas-related projects, including the [PlayCanvas Engine](https://github.com/playcanvas/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 [`eslint.config.mjs`](https://github.com/playcanvas/eslint-config/blob/main/eslint.config.mjs). It configures ESLint's rules in a comprehensive manner, covering Possible Problems, Suggestions, and Formatting categories. It also includes additional plugins:
6
-
7
- - `eslint-plugin-jsdoc`: For JSDoc validation and enforcement
8
- - `eslint-plugin-import`: For import/export validation and ordering
9
- - `eslint-plugin-regexp`: For regular expression best practices
10
-
11
- The configuration attempts to enable as many rules as possible, particularly those categorized as 'recommended' by ESLint, while maintaining practicality for real-world development.
12
-
13
- ## Using this config in your own projects
14
-
15
- 1. Install the package:
16
-
17
- ```bash
18
- npm install --save-dev @playcanvas/eslint-config eslint
19
- ```
20
-
21
- 2. Create an `eslint.config.js` file in your project root:
22
-
23
- ```js
24
- import playcanvasConfig from '@playcanvas/eslint-config';
25
-
26
- export default [
27
- ...playcanvasConfig,
28
- // Your custom configurations here
29
- ];
30
- ```
31
-
32
- ## Features
33
-
34
- - Full flat config format support for ESLint 8+
35
- - Comprehensive rule configuration
36
- - Support for ESM Script JSDoc tags used in PlayCanvas
37
- - Import ordering and validation
38
- - Strict JSDoc validation
39
- - Regular expression pattern enforcement
40
-
41
- ## Requirements
42
-
43
- - ESLint 8 or later
44
- - Node.js 16 or later
1
+ # PlayCanvas ESLint Config
2
+
3
+ [![NPM Version](https://img.shields.io/npm/v/@playcanvas/eslint-config)](https://www.npmjs.com/package/@playcanvas/eslint-config)
4
+ [![NPM Downloads](https://img.shields.io/npm/dw/@playcanvas/eslint-config)](https://npmtrends.com/@playcanvas/eslint-config)
5
+ [![License](https://img.shields.io/npm/l/@playcanvas/eslint-config)](https://github.com/playcanvas/editor-api/blob/main/LICENSE)
6
+ [![Discord](https://img.shields.io/badge/Discord-5865F2?style=flat&logo=discord&logoColor=white&color=black)](https://discord.gg/RSaMRzg)
7
+ [![Reddit](https://img.shields.io/badge/Reddit-FF4500?style=flat&logo=reddit&logoColor=white&color=black)](https://www.reddit.com/r/PlayCanvas)
8
+ [![X](https://img.shields.io/badge/X-000000?style=flat&logo=x&logoColor=white&color=black)](https://x.com/intent/follow?screen_name=playcanvas)
9
+
10
+ | [User Manual](https://developer.playcanvas.com/user-manual/editor) | [API Reference](https://api.playcanvas.com/editor) | [Blog](https://blog.playcanvas.com) | [Forum](https://forum.playcanvas.com) |
11
+
12
+ ESLint configuration developed by the PlayCanvas team and leveraged by many PlayCanvas-related projects, including the [PlayCanvas Engine](https://github.com/playcanvas/engine). However, you can use it for any JavaScript-based project if you approve of the PlayCanvas coding style.
13
+
14
+ ## Usage
15
+
16
+ 1. Install the package:
17
+
18
+ ```bash
19
+ npm install -D @playcanvas/eslint-config eslint
20
+ ```
21
+
22
+ 2. Create an `eslint.config.js` file in your project root. Import the config for your project type from its subpath — this loads only that config's plugins:
23
+
24
+ ```js
25
+ // TypeScript projects (modern, strict rules)
26
+ import typescriptConfig from '@playcanvas/eslint-config/typescript';
27
+
28
+ export default [
29
+ ...typescriptConfig
30
+ // Your custom configurations here
31
+ ];
32
+ ```
33
+
34
+ The available entry points are:
35
+
36
+ - `@playcanvas/eslint-config/typescript` modern, strict rules for TypeScript (ESM) projects
37
+ - `@playcanvas/eslint-config/javascript` (alias: `/legacy`) — rules for JavaScript + JSDoc (ESM) projects, such as the PlayCanvas engine
38
+ - `@playcanvas/eslint-config/react` React rules, layered on top of one of the above
39
+
40
+ For example, a React + TypeScript project:
41
+
42
+ ```js
43
+ import reactConfig from '@playcanvas/eslint-config/react';
44
+ import typescriptConfig from '@playcanvas/eslint-config/typescript';
45
+
46
+ export default [
47
+ ...typescriptConfig,
48
+ ...reactConfig
49
+ // Your custom configurations here
50
+ ];
51
+ ```
52
+
53
+ Alternatively, the default export exposes every config as an object:
54
+
55
+ ```js
56
+ import playcanvasConfig from '@playcanvas/eslint-config';
57
+
58
+ export default [
59
+ ...playcanvasConfig.typescript
60
+ // ...playcanvasConfig.legacy, // JavaScript + JSDoc rules
61
+ // ...playcanvasConfig.react // React rules
62
+ ];
63
+ ```
64
+
65
+ ## Features
66
+
67
+ > [!WARNING]
68
+ > The typescript and react rules are incomplete and are still being developed based on current practises and existing legacy rules
69
+
70
+ - Full flat config format support for ESLint 9+
71
+ - Comprehensive rule configuration
72
+ - Support for ESM Script JSDoc tags used in PlayCanvas
73
+ - Import ordering and validation
74
+ - Strict JSDoc validation
75
+ - Regular expression pattern enforcement
76
+
77
+ ## Requirements
78
+
79
+ - ESLint 9 or later
80
+ - Node.js 18 or later