eslint-plugin-gb 9.1.0 → 9.2.0-beta.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 +19 -25
- package/configs/base.js +10 -0
- package/configs/recommended.js +19 -0
- package/index.d.ts +12 -12
- package/index.js +22 -42
- package/{configs → lib}/member-order.js +1 -1
- package/package.json +32 -36
- package/configs/all.js +0 -0
- package/configs/flat/base.js +0 -22
- package/configs/flat/recommended.js +0 -6
- package/test.js +0 -25
package/README.md
CHANGED
|
@@ -17,18 +17,18 @@ npm add --save-dev eslint-plugin-gb
|
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
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
|
|
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
21
|
|
|
22
22
|
```cjs
|
|
23
23
|
// eslint.config.cjs
|
|
24
|
-
const js = require(
|
|
25
|
-
const gb = require(
|
|
24
|
+
const js = require("@eslint/js");
|
|
25
|
+
const gb = require("eslint-plugin-gb");
|
|
26
26
|
|
|
27
27
|
module.exports = [
|
|
28
28
|
...js.configs.recommended,
|
|
29
|
-
...gb.configs[
|
|
29
|
+
...gb.configs["recommended"],
|
|
30
30
|
{
|
|
31
|
-
files: [
|
|
31
|
+
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
|
|
32
32
|
// Override or add rules here
|
|
33
33
|
rules: {},
|
|
34
34
|
},
|
|
@@ -38,16 +38,20 @@ module.exports = [
|
|
|
38
38
|
```mjs
|
|
39
39
|
// eslint.config.mjs
|
|
40
40
|
import js from "@eslint/js";
|
|
41
|
-
import ts from "typescript-eslint";
|
|
42
41
|
import gb from "eslint-plugin-gb";
|
|
43
|
-
import
|
|
42
|
+
import tseslint from "typescript-eslint";
|
|
43
|
+
import { defineConfig } from "eslint/config";
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
]
|
|
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
|
+
]);
|
|
51
55
|
```
|
|
52
56
|
|
|
53
57
|
## `recommended` config
|
|
@@ -58,19 +62,9 @@ export default [
|
|
|
58
62
|
| [@typescript-eslint/consistent-type-imports](https://typescript-eslint.io/rules/consistent-type-imports) | warn |
|
|
59
63
|
| [@typescript-eslint/explicit-member-accessibility](https://typescript-eslint.io/rules/explicit-member-accessibility/) | warn |
|
|
60
64
|
| [@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](./
|
|
65
|
+
| [@typescript-eslint/member-ordering](https://typescript-eslint.io/rules/member-ordering/) | warn (with alphabetical ordering and [strict rules](./lib/member-order.js).) |
|
|
62
66
|
| [@typescript-eslint/no-unused-vars](https://typescript-eslint.io/rules/no-unused-vars/) | off |
|
|
63
67
|
|
|
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
68
|
## development
|
|
75
69
|
|
|
76
70
|
This is a bare-bones library. There are no npm scripts or monorepo plugins. `npx prettier . -w` works ok.
|
|
@@ -79,5 +73,5 @@ This is a bare-bones library. There are no npm scripts or monorepo plugins. `npx
|
|
|
79
73
|
|
|
80
74
|
| eslint-plugin-gb version | eslint version |
|
|
81
75
|
| ------------------------ | -------------- |
|
|
82
|
-
| ^9.
|
|
76
|
+
| ^9.2.0 | >=9.9.0 |
|
|
83
77
|
| ^2.0.0 | <9.0.0 |
|
package/configs/base.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { memberOrder } from "../lib/member-order.js";
|
|
2
|
+
import { base } from "./base.js";
|
|
3
|
+
|
|
4
|
+
export const recommended = {
|
|
5
|
+
...base,
|
|
6
|
+
rules: {
|
|
7
|
+
"@typescript-eslint/member-ordering": [
|
|
8
|
+
"warn",
|
|
9
|
+
{
|
|
10
|
+
default: {
|
|
11
|
+
memberTypes: memberOrder,
|
|
12
|
+
order: "alphabetically",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
17
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
18
|
+
},
|
|
19
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type { Linter } from "eslint";
|
|
2
|
+
|
|
3
|
+
declare const gb: {
|
|
4
|
+
readonly meta: {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly version: string;
|
|
7
|
+
readonly namespace: string;
|
|
8
8
|
};
|
|
9
|
-
configs: {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
readonly configs: {
|
|
10
|
+
readonly recommended: { readonly rules: Readonly<Linter.RulesRecord> };
|
|
11
|
+
readonly all: { readonly rules: Readonly<Linter.RulesRecord> };
|
|
12
12
|
};
|
|
13
|
-
rules: {};
|
|
14
|
-
processors: {};
|
|
15
13
|
};
|
|
14
|
+
|
|
15
|
+
export = gb;
|
package/index.js
CHANGED
|
@@ -1,42 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
meta
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
|
|
6
|
+
const pkg = JSON.parse(
|
|
7
|
+
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
|
+
namespace: "gb",
|
|
15
|
+
},
|
|
16
|
+
configs: {
|
|
17
|
+
base,
|
|
18
|
+
recommended,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default plugin;
|
package/package.json
CHANGED
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "eslint-plugin-gb",
|
|
3
|
-
"version": "9.
|
|
4
|
-
"description": "ESLint rules I like",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
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
|
-
"eslint": "^9.9.1",
|
|
34
|
-
"globals": "^15.9.0"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-plugin-gb",
|
|
3
|
+
"version": "9.2.0-beta.2",
|
|
4
|
+
"description": "ESLint rules I like",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"eslint": "^9.9.0"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/GaryB432/eslint-plugin-gb.git"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"eslint",
|
|
17
|
+
"eslint-plugin",
|
|
18
|
+
"eslintplugin"
|
|
19
|
+
],
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/GaryB432/eslint-plugin-gb/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/GaryB432/eslint-plugin-gb#readme",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@eslint/js": "^9.39.2"
|
|
30
|
+
},
|
|
31
|
+
"packageManager": "pnpm@10.25.0"
|
|
32
|
+
}
|
package/configs/all.js
DELETED
|
File without changes
|
package/configs/flat/base.js
DELETED
|
@@ -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
|
-
];
|
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
|
-
});
|