eslint-plugin-gb 9.0.0-alpha.1 → 9.0.0-alpha.2
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/README.md +63 -0
- package/configs/flat/base.js +22 -22
- package/configs/flat/recommended.js +3 -3
- package/configs/member-order.js +104 -104
- package/eslint.config.js +7 -0
- package/index.js +46 -46
- package/package.json +7 -5
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# eslint-plugin-gb
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
My favorite eslint configurations for [ESLint >=9](https://eslint.org/docs/latest/use/migrate-to-9.0.0). An [earlier version] for earlier ESLint releases in available on [eslint-plugin-gb@2](https://www.npmjs.com/package/eslint-plugin-gb/v/2.0.0).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
$ npm add typescript eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-gb -D
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
see [Configuration Files - ESLint - Pluggable JavaScript Linter](https://eslint.org/docs/latest/use/configure/configuration-files) for detailed information. For the basics add the `eslint.config.mjs` to the root of your project.
|
|
17
|
+
|
|
18
|
+
```mjs
|
|
19
|
+
// eslint.config.mjs
|
|
20
|
+
import js from "@eslint/js";
|
|
21
|
+
import ts from "typescript-eslint";
|
|
22
|
+
import gb from "eslint-plugin-gb";
|
|
23
|
+
import globals from "globals";
|
|
24
|
+
|
|
25
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
26
|
+
export default [
|
|
27
|
+
js.configs.recommended,
|
|
28
|
+
...ts.configs.recommended,
|
|
29
|
+
...gb.configs["flat/recommended"],
|
|
30
|
+
];
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## `recommended` config
|
|
34
|
+
|
|
35
|
+
<!-- prettier-ignore -->
|
|
36
|
+
| Rule | Setting |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| [@typescript-eslint/consistent-type-imports](https://typescript-eslint.io/rules/consistent-type-imports) | warn |
|
|
39
|
+
| [@typescript-eslint/explicit-member-accessibility](https://typescript-eslint.io/rules/explicit-member-accessibility/) | warn |
|
|
40
|
+
| [@typescript-eslint/explicit-module-boundary-types](https://typescript-eslint.io/rules/explicit-module-boundary-types/) | warn |
|
|
41
|
+
| [@typescript-eslint/member-ordering](https://typescript-eslint.io/rules/member-ordering/) | warn (with alphabetical ordering and [strict rules](./configs/member-order.js).) |
|
|
42
|
+
| [@typescript-eslint/no-unused-vars](https://typescript-eslint.io/rules/no-unused-vars/) | off |
|
|
43
|
+
|
|
44
|
+
## `recommended-type-checked` config
|
|
45
|
+
|
|
46
|
+
all of the `recommended` rules and also the following.
|
|
47
|
+
|
|
48
|
+
<!-- prettier-ignore -->
|
|
49
|
+
| Rule | Setting |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| [@typescript-eslint/no-floating-promises](https://typescript-eslint.io/rules/no-floating-promises/) | warn |
|
|
52
|
+
| [@typescript-eslint/unbound-method](https://typescript-eslint.io/rules/unbound-method/) | error |
|
|
53
|
+
|
|
54
|
+
## development
|
|
55
|
+
|
|
56
|
+
This is a bare-bones library. There are no npm scripts or monorepo plugins. `npx prettier . -w` works ok.
|
|
57
|
+
|
|
58
|
+
## eslint-plugin-gb & eslint Compatibility Chart
|
|
59
|
+
|
|
60
|
+
| eslint-plugin-gb version | eslint version |
|
|
61
|
+
| ------------------------ | -------------- |
|
|
62
|
+
| ^9.0.0 | >=9.0.0 |
|
|
63
|
+
| ^2.0.0 | <9.0.0 |
|
package/configs/flat/base.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import memberOrder from "../member-order.js";
|
|
2
|
-
|
|
3
|
-
export default [
|
|
4
|
-
{
|
|
5
|
-
name: "gb/base/rules",
|
|
6
|
-
rules: {
|
|
7
|
-
"@typescript-eslint/explicit-member-accessibility": "warn",
|
|
8
|
-
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
9
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
10
|
-
"@typescript-eslint/member-ordering": [
|
|
11
|
-
"warn",
|
|
12
|
-
{
|
|
13
|
-
default: {
|
|
14
|
-
memberTypes: memberOrder,
|
|
15
|
-
order: "alphabetically",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
"@typescript-eslint/consistent-type-imports": "warn",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
];
|
|
1
|
+
import memberOrder from "../member-order.js";
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
name: "gb/base/rules",
|
|
6
|
+
rules: {
|
|
7
|
+
"@typescript-eslint/explicit-member-accessibility": "warn",
|
|
8
|
+
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
9
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
10
|
+
"@typescript-eslint/member-ordering": [
|
|
11
|
+
"warn",
|
|
12
|
+
{
|
|
13
|
+
default: {
|
|
14
|
+
memberTypes: memberOrder,
|
|
15
|
+
order: "alphabetically",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
"@typescript-eslint/consistent-type-imports": "warn",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import base from "./base.js";
|
|
2
|
-
|
|
3
|
-
export default [...base];
|
|
1
|
+
import base from "./base.js";
|
|
2
|
+
|
|
3
|
+
export default [...base];
|
package/configs/member-order.js
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
export default [
|
|
2
|
-
// Index signature
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// Fields
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// Static initialization
|
|
29
|
-
|
|
30
|
-
// Constructors
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Getters
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// Setters
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// Methods
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
];
|
|
1
|
+
export default [
|
|
2
|
+
// Index signature
|
|
3
|
+
"signature",
|
|
4
|
+
"call-signature",
|
|
5
|
+
// Fields
|
|
6
|
+
"public-static-field",
|
|
7
|
+
"protected-static-field",
|
|
8
|
+
"private-static-field",
|
|
9
|
+
"#private-static-field",
|
|
10
|
+
"public-decorated-field",
|
|
11
|
+
"protected-decorated-field",
|
|
12
|
+
"private-decorated-field",
|
|
13
|
+
"public-instance-field",
|
|
14
|
+
"protected-instance-field",
|
|
15
|
+
"private-instance-field",
|
|
16
|
+
"#private-instance-field",
|
|
17
|
+
"public-abstract-field",
|
|
18
|
+
"protected-abstract-field",
|
|
19
|
+
"public-field",
|
|
20
|
+
"protected-field",
|
|
21
|
+
"private-field",
|
|
22
|
+
"#private-field",
|
|
23
|
+
"static-field",
|
|
24
|
+
"instance-field",
|
|
25
|
+
"abstract-field",
|
|
26
|
+
"decorated-field",
|
|
27
|
+
"field",
|
|
28
|
+
// Static initialization
|
|
29
|
+
"static-initialization",
|
|
30
|
+
// Constructors
|
|
31
|
+
"public-constructor",
|
|
32
|
+
"protected-constructor",
|
|
33
|
+
"private-constructor",
|
|
34
|
+
"constructor",
|
|
35
|
+
// Getters
|
|
36
|
+
"public-static-get",
|
|
37
|
+
"protected-static-get",
|
|
38
|
+
"private-static-get",
|
|
39
|
+
"#private-static-get",
|
|
40
|
+
"public-decorated-get",
|
|
41
|
+
"protected-decorated-get",
|
|
42
|
+
"private-decorated-get",
|
|
43
|
+
"public-instance-get",
|
|
44
|
+
"protected-instance-get",
|
|
45
|
+
"private-instance-get",
|
|
46
|
+
"#private-instance-get",
|
|
47
|
+
"public-abstract-get",
|
|
48
|
+
"protected-abstract-get",
|
|
49
|
+
"public-get",
|
|
50
|
+
"protected-get",
|
|
51
|
+
"private-get",
|
|
52
|
+
"#private-get",
|
|
53
|
+
"static-get",
|
|
54
|
+
"instance-get",
|
|
55
|
+
"abstract-get",
|
|
56
|
+
"decorated-get",
|
|
57
|
+
"get",
|
|
58
|
+
// Setters
|
|
59
|
+
"public-static-set",
|
|
60
|
+
"protected-static-set",
|
|
61
|
+
"private-static-set",
|
|
62
|
+
"#private-static-set",
|
|
63
|
+
"public-decorated-set",
|
|
64
|
+
"protected-decorated-set",
|
|
65
|
+
"private-decorated-set",
|
|
66
|
+
"public-instance-set",
|
|
67
|
+
"protected-instance-set",
|
|
68
|
+
"private-instance-set",
|
|
69
|
+
"#private-instance-set",
|
|
70
|
+
"public-abstract-set",
|
|
71
|
+
"protected-abstract-set",
|
|
72
|
+
"public-set",
|
|
73
|
+
"protected-set",
|
|
74
|
+
"private-set",
|
|
75
|
+
"#private-set",
|
|
76
|
+
"static-set",
|
|
77
|
+
"instance-set",
|
|
78
|
+
"abstract-set",
|
|
79
|
+
"decorated-set",
|
|
80
|
+
"set",
|
|
81
|
+
// Methods
|
|
82
|
+
"public-static-method",
|
|
83
|
+
"protected-static-method",
|
|
84
|
+
"private-static-method",
|
|
85
|
+
"#private-static-method",
|
|
86
|
+
"public-decorated-method",
|
|
87
|
+
"protected-decorated-method",
|
|
88
|
+
"private-decorated-method",
|
|
89
|
+
"public-instance-method",
|
|
90
|
+
"protected-instance-method",
|
|
91
|
+
"private-instance-method",
|
|
92
|
+
"#private-instance-method",
|
|
93
|
+
"public-abstract-method",
|
|
94
|
+
"protected-abstract-method",
|
|
95
|
+
"public-method",
|
|
96
|
+
"protected-method",
|
|
97
|
+
"private-method",
|
|
98
|
+
"#private-method",
|
|
99
|
+
"static-method",
|
|
100
|
+
"instance-method",
|
|
101
|
+
"abstract-method",
|
|
102
|
+
"decorated-method",
|
|
103
|
+
"method",
|
|
104
|
+
];
|
package/eslint.config.js
ADDED
package/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
|
|
3
|
-
import flatRecommended from "./configs/flat/recommended.js";
|
|
4
|
-
import flatBase from "./configs/flat/base.js";
|
|
5
|
-
|
|
6
|
-
const pkg = JSON.parse(
|
|
7
|
-
fs.readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
const plugin = {
|
|
11
|
-
meta: {
|
|
12
|
-
name: pkg.name,
|
|
13
|
-
version: pkg.version,
|
|
14
|
-
},
|
|
15
|
-
configs: {
|
|
16
|
-
"flat/base": flatBase,
|
|
17
|
-
"flat/recommended": flatRecommended,
|
|
18
|
-
},
|
|
19
|
-
rules: {},
|
|
20
|
-
processors: {},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// Object.assign(plugin.configs, {
|
|
24
|
-
// recommended: [
|
|
25
|
-
// {
|
|
26
|
-
// plugins: {
|
|
27
|
-
// gb: plugin,
|
|
28
|
-
// },
|
|
29
|
-
// rules: {
|
|
30
|
-
// "example/dollar-sign": "error",
|
|
31
|
-
// },
|
|
32
|
-
// languageOptions: {
|
|
33
|
-
// globals: {
|
|
34
|
-
// myGlobal: "readonly",
|
|
35
|
-
// },
|
|
36
|
-
// parserOptions: {
|
|
37
|
-
// ecmaFeatures: {
|
|
38
|
-
// jsx: true,
|
|
39
|
-
// },
|
|
40
|
-
// },
|
|
41
|
-
// },
|
|
42
|
-
// },
|
|
43
|
-
// ],
|
|
44
|
-
// });
|
|
45
|
-
|
|
46
|
-
export default plugin;
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
import flatRecommended from "./configs/flat/recommended.js";
|
|
4
|
+
import flatBase from "./configs/flat/base.js";
|
|
5
|
+
|
|
6
|
+
const pkg = JSON.parse(
|
|
7
|
+
fs.readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const plugin = {
|
|
11
|
+
meta: {
|
|
12
|
+
name: pkg.name,
|
|
13
|
+
version: pkg.version,
|
|
14
|
+
},
|
|
15
|
+
configs: {
|
|
16
|
+
"flat/base": flatBase,
|
|
17
|
+
"flat/recommended": flatRecommended,
|
|
18
|
+
},
|
|
19
|
+
rules: {},
|
|
20
|
+
processors: {},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Object.assign(plugin.configs, {
|
|
24
|
+
// recommended: [
|
|
25
|
+
// {
|
|
26
|
+
// plugins: {
|
|
27
|
+
// gb: plugin,
|
|
28
|
+
// },
|
|
29
|
+
// rules: {
|
|
30
|
+
// "example/dollar-sign": "error",
|
|
31
|
+
// },
|
|
32
|
+
// languageOptions: {
|
|
33
|
+
// globals: {
|
|
34
|
+
// myGlobal: "readonly",
|
|
35
|
+
// },
|
|
36
|
+
// parserOptions: {
|
|
37
|
+
// ecmaFeatures: {
|
|
38
|
+
// jsx: true,
|
|
39
|
+
// },
|
|
40
|
+
// },
|
|
41
|
+
// },
|
|
42
|
+
// },
|
|
43
|
+
// ],
|
|
44
|
+
// });
|
|
45
|
+
|
|
46
|
+
export default plugin;
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-gb",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "9.0.0-alpha.2",
|
|
4
|
+
"description": "ESLint rules I like",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"globals": "^15.9.0"
|
|
8
|
-
},
|
|
9
6
|
"peerDependencies": {
|
|
10
7
|
"eslint": "^9.9.0"
|
|
11
8
|
},
|
|
@@ -26,5 +23,10 @@
|
|
|
26
23
|
"homepage": "https://github.com/GaryB432/eslint-plugin-gb#readme",
|
|
27
24
|
"publishConfig": {
|
|
28
25
|
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@eslint/js": "^9.9.1",
|
|
29
|
+
"eslint": "^9.9.1",
|
|
30
|
+
"globals": "^15.9.0"
|
|
29
31
|
}
|
|
30
32
|
}
|