eslint-plugin-gb 9.1.0 → 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
@@ -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.js` to the root of your project.
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('@eslint/js');
25
- const gb = require('eslint-plugin-gb');
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['flat/recommended'],
29
+ ...gb.configs["recommended"],
30
30
  {
31
- files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
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 globals from "globals";
42
+ import tseslint from "typescript-eslint";
43
+ import { defineConfig } from "eslint/config";
44
44
 
45
- /** @type {import('eslint').Linter.Config[]} */
46
- export default [
47
- js.configs.recommended,
48
- ...ts.configs.recommended,
49
- ...gb.configs["flat/recommended"],
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](./configs/member-order.js).) |
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.0.0 | >=9.0.0 |
76
+ | ^9.2.0 | >=9.9.0 |
83
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,4 +1,4 @@
1
- module.exports = [
1
+ export default [
2
2
  // Index signature
3
3
  "signature",
4
4
  "call-signature",
package/package.json CHANGED
@@ -1,36 +1,31 @@
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
- }
1
+ {
2
+ "name": "eslint-plugin-gb",
3
+ "version": "9.2.0-beta.1",
4
+ "description": "ESLint rules I like",
5
+ "main": "index.js",
6
+ "peerDependencies": {
7
+ "eslint": "^9.9.0"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/GaryB432/eslint-plugin-gb.git"
12
+ },
13
+ "type": "module",
14
+ "keywords": [
15
+ "eslint",
16
+ "eslint-plugin",
17
+ "eslintplugin"
18
+ ],
19
+ "license": "ISC",
20
+ "bugs": {
21
+ "url": "https://github.com/GaryB432/eslint-plugin-gb/issues"
22
+ },
23
+ "homepage": "https://github.com/GaryB432/eslint-plugin-gb#readme",
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "devDependencies": {
28
+ "@eslint/js": "^9.39.2"
29
+ },
30
+ "packageManager": "pnpm@10.25.0"
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/index.d.ts DELETED
@@ -1,15 +0,0 @@
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/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
- });