eslint-plugin-gb 9.1.0-1 → 9.1.0

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 CHANGED
@@ -1,67 +1,83 @@
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 |
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.js` to the root of your project.
21
+
22
+ ```cjs
23
+ // eslint.config.cjs
24
+ const js = require('@eslint/js');
25
+ const gb = require('eslint-plugin-gb');
26
+
27
+ module.exports = [
28
+ ...js.configs.recommended,
29
+ ...gb.configs['flat/recommended'],
30
+ {
31
+ files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
32
+ // Override or add rules here
33
+ rules: {},
34
+ },
35
+ ];
36
+ ```
37
+
38
+ ```mjs
39
+ // eslint.config.mjs
40
+ import js from "@eslint/js";
41
+ import ts from "typescript-eslint";
42
+ import gb from "eslint-plugin-gb";
43
+ import globals from "globals";
44
+
45
+ /** @type {import('eslint').Linter.Config[]} */
46
+ export default [
47
+ js.configs.recommended,
48
+ ...ts.configs.recommended,
49
+ ...gb.configs["flat/recommended"],
50
+ ];
51
+ ```
52
+
53
+ ## `recommended` config
54
+
55
+ <!-- prettier-ignore -->
56
+ | Rule | Setting |
57
+ | --- | --- |
58
+ | [@typescript-eslint/consistent-type-imports](https://typescript-eslint.io/rules/consistent-type-imports) | warn |
59
+ | [@typescript-eslint/explicit-member-accessibility](https://typescript-eslint.io/rules/explicit-member-accessibility/) | warn |
60
+ | [@typescript-eslint/explicit-module-boundary-types](https://typescript-eslint.io/rules/explicit-module-boundary-types/) | warn |
61
+ | [@typescript-eslint/member-ordering](https://typescript-eslint.io/rules/member-ordering/) | warn (with alphabetical ordering and [strict rules](./configs/member-order.js).) |
62
+ | [@typescript-eslint/no-unused-vars](https://typescript-eslint.io/rules/no-unused-vars/) | off |
63
+
64
+ ## `recommended-type-checked` config
65
+
66
+ all of the `recommended` rules and also the following.
67
+
68
+ <!-- prettier-ignore -->
69
+ | Rule | Setting |
70
+ | --- | --- |
71
+ | [@typescript-eslint/no-floating-promises](https://typescript-eslint.io/rules/no-floating-promises/) | warn |
72
+ | [@typescript-eslint/unbound-method](https://typescript-eslint.io/rules/unbound-method/) | error |
73
+
74
+ ## development
75
+
76
+ This is a bare-bones library. There are no npm scripts or monorepo plugins. `npx prettier . -w` works ok.
77
+
78
+ ## eslint-plugin-gb & eslint Compatibility Chart
79
+
80
+ | eslint-plugin-gb version | eslint version |
81
+ | ------------------------ | -------------- |
82
+ | ^9.0.0 | >=9.0.0 |
83
+ | ^2.0.0 | <9.0.0 |
@@ -1,22 +1,22 @@
1
- const memberOrder = require("../member-order.js");
2
-
3
- module.exports = [
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
+ const memberOrder = require("../member-order.js");
2
+
3
+ module.exports = [
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,6 +1,6 @@
1
- const basePlugins = require("./base.js");
2
-
3
- module.exports = basePlugins.map((p) => ({
4
- ...p,
5
- name: "gb/recommended/rules",
6
- }));
1
+ const basePlugins = require("./base.js");
2
+
3
+ module.exports = basePlugins.map((p) => ({
4
+ ...p,
5
+ name: "gb/recommended/rules",
6
+ }));
@@ -1,104 +1,104 @@
1
- module.exports = [
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
+ module.exports = [
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/index.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ declare const flatBase: any;
2
+ declare const flatRecommended: any;
3
+ declare const pkg: any;
4
+ declare const plugin: {
5
+ meta: {
6
+ name: string;
7
+ version: string;
8
+ };
9
+ configs: {
10
+ "flat/base": any;
11
+ "flat/recommended": any;
12
+ };
13
+ rules: {};
14
+ processors: {};
15
+ };
package/index.js CHANGED
@@ -1,8 +1,7 @@
1
- const fs = require("fs");
2
1
  const flatBase = require("./configs/flat/base.js");
3
2
  const flatRecommended = require("./configs/flat/recommended.js");
4
3
 
5
- const pkg = JSON.parse(fs.readFileSync("./package.json", "utf8"));
4
+ const pkg = require("./package.json");
6
5
 
7
6
  const plugin = {
8
7
  meta: {
package/package.json CHANGED
@@ -1,35 +1,36 @@
1
- {
2
- "name": "eslint-plugin-gb",
3
- "version": "9.1.0-1",
4
- "description": "ESLint rules I like",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "npx jest"
8
- },
9
- "peerDependencies": {
10
- "eslint": "^9.9.0"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/GaryB432/eslint-plugin-gb.git"
15
- },
16
- "type": "commonjs",
17
- "keywords": [
18
- "eslint",
19
- "eslint-plugin",
20
- "eslintplugin"
21
- ],
22
- "license": "ISC",
23
- "bugs": {
24
- "url": "https://github.com/GaryB432/eslint-plugin-gb/issues"
25
- },
26
- "homepage": "https://github.com/GaryB432/eslint-plugin-gb#readme",
27
- "publishConfig": {
28
- "access": "public"
29
- },
30
- "devDependencies": {
31
- "@eslint/js": "^9.9.1",
32
- "eslint": "^9.9.1",
33
- "globals": "^15.9.0"
34
- }
35
- }
1
+ {
2
+ "name": "eslint-plugin-gb",
3
+ "version": "9.1.0",
4
+ "description": "ESLint rules I like",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "scripts": {
8
+ "test": "npx jest"
9
+ },
10
+ "peerDependencies": {
11
+ "eslint": "^9.9.0"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/GaryB432/eslint-plugin-gb.git"
16
+ },
17
+ "type": "commonjs",
18
+ "keywords": [
19
+ "eslint",
20
+ "eslint-plugin",
21
+ "eslintplugin"
22
+ ],
23
+ "license": "ISC",
24
+ "bugs": {
25
+ "url": "https://github.com/GaryB432/eslint-plugin-gb/issues"
26
+ },
27
+ "homepage": "https://github.com/GaryB432/eslint-plugin-gb#readme",
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "devDependencies": {
32
+ "@eslint/js": "^9.9.1",
33
+ "eslint": "^9.9.1",
34
+ "globals": "^15.9.0"
35
+ }
36
+ }
package/test.js CHANGED
@@ -1,18 +1,25 @@
1
- const plugin = require("./index");
2
-
3
- describe("plugin", () => {
4
- it("has correct plugin names", () => {
5
- expect(Object.keys(plugin.configs).sort()).toEqual([
6
- "flat/base",
7
- "flat/recommended",
8
- ]);
9
- });
10
-
11
- it("has correct plugin names", () => {
12
- const rec = plugin.configs["flat/recommended"];
13
- expect(rec[0]).toEqual({
14
- name: "gb/recommended/rules",
15
- rules: expect.any(Object),
16
- });
17
- });
18
- });
1
+ const plugin = require("./index");
2
+
3
+ describe("plugin", () => {
4
+ it("has correct plugin names", () => {
5
+ expect(Object.keys(plugin.configs).sort()).toEqual([
6
+ "flat/base",
7
+ "flat/recommended",
8
+ ]);
9
+ });
10
+
11
+ it("has correct config name", () => {
12
+ const rec = plugin.configs["flat/recommended"];
13
+ expect(rec[0]).toEqual({
14
+ name: "gb/recommended/rules",
15
+ rules: expect.any(Object),
16
+ });
17
+ });
18
+
19
+ it("has correct plugin meta", () => {
20
+ expect(plugin.meta).toEqual({
21
+ name: "eslint-plugin-gb",
22
+ version: expect.any(String),
23
+ });
24
+ });
25
+ });