eslint-plugin-gb 9.1.0-2 → 9.2.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/README.md CHANGED
@@ -1,67 +1,77 @@
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["recommended"],
30
+ {
31
+ files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
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 gb from "eslint-plugin-gb";
42
+ import tseslint from "typescript-eslint";
43
+ import { defineConfig } from "eslint/config";
44
+
45
+ export default defineConfig([
46
+ tseslint.configs.recommended,
47
+ {
48
+ files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
49
+ plugins: { js, gb },
50
+ extends: ["js/recommended", "gb/recommended"],
51
+ // Override or add rules here
52
+ rules: {},
53
+ },
54
+ ]);
55
+ ```
56
+
57
+ ## `recommended` config
58
+
59
+ <!-- prettier-ignore -->
60
+ | Rule | Setting |
61
+ | --- | --- |
62
+ | [@typescript-eslint/consistent-type-imports](https://typescript-eslint.io/rules/consistent-type-imports) | warn |
63
+ | [@typescript-eslint/explicit-member-accessibility](https://typescript-eslint.io/rules/explicit-member-accessibility/) | warn |
64
+ | [@typescript-eslint/explicit-module-boundary-types](https://typescript-eslint.io/rules/explicit-module-boundary-types/) | warn |
65
+ | [@typescript-eslint/member-ordering](https://typescript-eslint.io/rules/member-ordering/) | warn (with alphabetical ordering and [strict rules](./lib/member-order.js).) |
66
+ | [@typescript-eslint/no-unused-vars](https://typescript-eslint.io/rules/no-unused-vars/) | off |
67
+
68
+ ## development
69
+
70
+ This is a bare-bones library. There are no npm scripts or monorepo plugins. `npx prettier . -w` works ok.
71
+
72
+ ## eslint-plugin-gb & eslint Compatibility Chart
73
+
74
+ | eslint-plugin-gb version | eslint version |
75
+ | ------------------------ | -------------- |
76
+ | ^9.2.0 | >=9.9.0 |
77
+ | ^2.0.0 | <9.0.0 |
@@ -0,0 +1,10 @@
1
+ // @ts-check
2
+ import { ESLint } from "eslint";
3
+
4
+ /** @type {ESLint.ConfigData} */
5
+ export const base = {
6
+ rules: {
7
+ "@typescript-eslint/explicit-member-accessibility": "warn",
8
+ "@typescript-eslint/consistent-type-imports": "warn",
9
+ },
10
+ };
@@ -0,0 +1,21 @@
1
+ import { ESLint } from "eslint";
2
+ import memberOrder from "../member-order.js";
3
+ import { base } from "./base.js";
4
+
5
+ /** @type {ESLint.ConfigData} */
6
+ export const recommended = {
7
+ ...base,
8
+ rules: {
9
+ "@typescript-eslint/member-ordering": [
10
+ "warn",
11
+ {
12
+ default: {
13
+ memberTypes: memberOrder,
14
+ order: "alphabetically",
15
+ },
16
+ },
17
+ ],
18
+ "@typescript-eslint/explicit-module-boundary-types": "warn",
19
+ "@typescript-eslint/no-unused-vars": "off",
20
+ },
21
+ };
package/index.js CHANGED
@@ -1,42 +1,24 @@
1
- const flatBase = require("./configs/flat/base.js");
2
- const flatRecommended = require("./configs/flat/recommended.js");
3
-
4
- const pkg = require("./package.json");
5
-
6
- const plugin = {
7
- meta: {
8
- name: pkg.name,
9
- version: pkg.version,
10
- },
11
- configs: {
12
- "flat/base": flatBase,
13
- "flat/recommended": flatRecommended,
14
- },
15
- rules: {},
16
- processors: {},
17
- };
18
-
19
- // Object.assign(plugin.configs, {
20
- // recommended: [
21
- // {
22
- // plugins: {
23
- // gb: plugin,
24
- // },
25
- // rules: {
26
- // "example/dollar-sign": "error",
27
- // },
28
- // languageOptions: {
29
- // globals: {
30
- // myGlobal: "readonly",
31
- // },
32
- // parserOptions: {
33
- // ecmaFeatures: {
34
- // jsx: true,
35
- // },
36
- // },
37
- // },
38
- // },
39
- // ],
40
- // });
41
-
42
- module.exports = plugin;
1
+ // @ts-check
2
+ import { readFileSync } from "fs";
3
+ import { base } from "./configs/base.js";
4
+ import { recommended } from "./configs/recommended.js";
5
+ import { ESLint } from "eslint";
6
+
7
+ const pkg = JSON.parse(
8
+ readFileSync(new URL("./package.json", import.meta.url), "utf8"),
9
+ );
10
+
11
+ /** @type {ESLint.Plugin} */
12
+ const plugin = {
13
+ meta: {
14
+ name: pkg.name,
15
+ version: pkg.version,
16
+ namespace: "gb",
17
+ },
18
+ configs: {
19
+ base,
20
+ recommended,
21
+ },
22
+ };
23
+
24
+ export default plugin;
@@ -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
+ 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/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "eslint-plugin-gb",
3
- "version": "9.1.0-2",
3
+ "version": "9.2.0-beta.1",
4
4
  "description": "ESLint rules I like",
5
5
  "main": "index.js",
6
- "scripts": {
7
- "test": "npx jest"
8
- },
9
6
  "peerDependencies": {
10
7
  "eslint": "^9.9.0"
11
8
  },
@@ -13,7 +10,7 @@
13
10
  "type": "git",
14
11
  "url": "git+https://github.com/GaryB432/eslint-plugin-gb.git"
15
12
  },
16
- "type": "commonjs",
13
+ "type": "module",
17
14
  "keywords": [
18
15
  "eslint",
19
16
  "eslint-plugin",
@@ -28,8 +25,7 @@
28
25
  "access": "public"
29
26
  },
30
27
  "devDependencies": {
31
- "@eslint/js": "^9.9.1",
32
- "eslint": "^9.9.1",
33
- "globals": "^15.9.0"
34
- }
28
+ "@eslint/js": "^9.39.2"
29
+ },
30
+ "packageManager": "pnpm@10.25.0"
35
31
  }
package/configs/all.js DELETED
File without changes
@@ -1,22 +0,0 @@
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 +0,0 @@
1
- const basePlugins = require("./base.js");
2
-
3
- module.exports = basePlugins.map((p) => ({
4
- ...p,
5
- name: "gb/recommended/rules",
6
- }));
package/test.js DELETED
@@ -1,25 +0,0 @@
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
- });