eslint-plugin-gb 9.0.0-alpha.2 → 9.0.0-alpha.4
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 +67 -63
- 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 -7
- package/index.js +46 -46
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,63 +1,67 @@
|
|
|
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).
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
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
|
-
| [@typescript-eslint/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
##
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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). A 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
|
+
```shell
|
|
10
|
+
npm add --save-dev typescript
|
|
11
|
+
npm add --save-dev eslint
|
|
12
|
+
npm add --save-dev @typescript-eslint/parser
|
|
13
|
+
npm add --save-dev @typescript-eslint/eslint-plugin
|
|
14
|
+
npm add --save-dev eslint-plugin-gb
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
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.
|
|
21
|
+
|
|
22
|
+
```mjs
|
|
23
|
+
// eslint.config.mjs
|
|
24
|
+
import js from "@eslint/js";
|
|
25
|
+
import ts from "typescript-eslint";
|
|
26
|
+
import gb from "eslint-plugin-gb";
|
|
27
|
+
import globals from "globals";
|
|
28
|
+
|
|
29
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
30
|
+
export default [
|
|
31
|
+
js.configs.recommended,
|
|
32
|
+
...ts.configs.recommended,
|
|
33
|
+
...gb.configs["flat/recommended"],
|
|
34
|
+
];
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## `recommended` config
|
|
38
|
+
|
|
39
|
+
<!-- prettier-ignore -->
|
|
40
|
+
| Rule | Setting |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| [@typescript-eslint/consistent-type-imports](https://typescript-eslint.io/rules/consistent-type-imports) | warn |
|
|
43
|
+
| [@typescript-eslint/explicit-member-accessibility](https://typescript-eslint.io/rules/explicit-member-accessibility/) | warn |
|
|
44
|
+
| [@typescript-eslint/explicit-module-boundary-types](https://typescript-eslint.io/rules/explicit-module-boundary-types/) | warn |
|
|
45
|
+
| [@typescript-eslint/member-ordering](https://typescript-eslint.io/rules/member-ordering/) | warn (with alphabetical ordering and [strict rules](./configs/member-order.js).) |
|
|
46
|
+
| [@typescript-eslint/no-unused-vars](https://typescript-eslint.io/rules/no-unused-vars/) | off |
|
|
47
|
+
|
|
48
|
+
## `recommended-type-checked` config
|
|
49
|
+
|
|
50
|
+
all of the `recommended` rules and also the following.
|
|
51
|
+
|
|
52
|
+
<!-- prettier-ignore -->
|
|
53
|
+
| Rule | Setting |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| [@typescript-eslint/no-floating-promises](https://typescript-eslint.io/rules/no-floating-promises/) | warn |
|
|
56
|
+
| [@typescript-eslint/unbound-method](https://typescript-eslint.io/rules/unbound-method/) | error |
|
|
57
|
+
|
|
58
|
+
## development
|
|
59
|
+
|
|
60
|
+
This is a bare-bones library. There are no npm scripts or monorepo plugins. `npx prettier . -w` works ok.
|
|
61
|
+
|
|
62
|
+
## eslint-plugin-gb & eslint Compatibility Chart
|
|
63
|
+
|
|
64
|
+
| eslint-plugin-gb version | eslint version |
|
|
65
|
+
| ------------------------ | -------------- |
|
|
66
|
+
| ^9.0.0 | >=9.0.0 |
|
|
67
|
+
| ^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
|
-
"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
|
-
];
|
|
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import pluginJs from "@eslint/js";
|
|
2
|
-
import globals from "globals";
|
|
3
|
-
|
|
4
|
-
export default [
|
|
5
|
-
{ languageOptions: { globals: globals.browser } },
|
|
6
|
-
pluginJs.configs.recommended,
|
|
7
|
-
];
|
|
1
|
+
import pluginJs from "@eslint/js";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
{ languageOptions: { globals: globals.browser } },
|
|
6
|
+
pluginJs.configs.recommended,
|
|
7
|
+
];
|
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;
|