@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 +19 -19
- package/README.md +80 -44
- package/dist/configs/legacy.js +566 -0
- package/dist/configs/legacy.js.map +1 -0
- package/dist/configs/react.js +16 -0
- package/dist/configs/react.js.map +1 -0
- package/dist/configs/typescript.js +78 -0
- package/dist/configs/typescript.js.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -38
- package/eslint.config.mjs +0 -550
package/LICENSE
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
Copyright (c) 2011-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
# PlayCanvas ESLint Config
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@playcanvas/eslint-config)
|
|
4
|
+
[](https://npmtrends.com/@playcanvas/eslint-config)
|
|
5
|
+
[](https://github.com/playcanvas/editor-api/blob/main/LICENSE)
|
|
6
|
+
[](https://discord.gg/RSaMRzg)
|
|
7
|
+
[](https://www.reddit.com/r/PlayCanvas)
|
|
8
|
+
[](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
|