@bemoje/eslint 1.0.1 → 1.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @bemoje/eslint
2
2
 
3
- asdasd
3
+ Custom ESLint plugin and rule utilities for consistent code style in TypeScript projects.
4
4
 
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue)](https://www.typescriptlang.org/)
6
6
  [![Module](https://img.shields.io/badge/Module-ESM-yellow)](https://nodejs.org/api/esm.html)
@@ -8,6 +8,79 @@ asdasd
8
8
  ## Installation
9
9
 
10
10
  ```bash
11
- npm install --D @bemoje/eslint
12
- yarn add --D @bemoje/eslint
11
+ npm install --save-dev @bemoje/eslint
13
12
  ```
13
+
14
+ ## Features
15
+
16
+ - Custom ESLint plugin with a recommended config
17
+ - Auto-fixable rules for consistent whitespace formatting
18
+ - Built on `@typescript-eslint/utils` for TypeScript-aware linting
19
+ - ESM flat config compatible
20
+
21
+ ## Usage
22
+
23
+ ### Plugin Setup (Flat Config)
24
+
25
+ ```js
26
+ // eslint.config.mjs
27
+ import { eslintPluginBemoje } from '@bemoje/eslint'
28
+
29
+ export default [
30
+ {
31
+ plugins: { 'eslint-plugin-bemoje': eslintPluginBemoje() },
32
+ rules: { 'eslint-plugin-bemoje/no-blank-line-between-comment-and-declaration': 'error' },
33
+ },
34
+ ]
35
+ ```
36
+
37
+ ### Using the Recommended Config
38
+
39
+ ```js
40
+ import { eslintPluginBemoje } from '@bemoje/eslint'
41
+
42
+ const plugin = eslintPluginBemoje()
43
+ const { plugins, rules } = plugin.configs.recommended
44
+
45
+ export default [{ plugins, rules }]
46
+ ```
47
+
48
+ ## Rules
49
+
50
+ ### no-blank-line-between-comment-and-declaration
51
+
52
+ Enforces that there are no blank lines between a block comment (JSDoc or multi-line) and the declaration it
53
+ documents. Auto-fixable.
54
+
55
+ **Incorrect:**
56
+
57
+ ```ts
58
+ /**
59
+ * Adds two numbers.
60
+ */
61
+
62
+ export function add(a: number, b: number) {
63
+ return a + b
64
+ }
65
+ ```
66
+
67
+ **Correct:**
68
+
69
+ ```ts
70
+ /**
71
+ * Adds two numbers.
72
+ */
73
+ export function add(a: number, b: number) {
74
+ return a + b
75
+ }
76
+ ```
77
+
78
+ Single-line block comments and line comments between the block comment and the declaration are ignored.
79
+
80
+ ## API Reference
81
+
82
+ | Export | Description |
83
+ | ----------------------------------------- | ------------------------------------------------------------ |
84
+ | `eslintPluginBemoje` | Returns the ESLint plugin object with rules and configs |
85
+ | `createRule` | Helper for creating ESLint rules with consistent metadata |
86
+ | `noBlankLineBetweenCommentAndDeclaration` | Rule: no blank lines between block comments and declarations |
package/index.d.ts CHANGED
@@ -1,15 +1,24 @@
1
- import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
1
  import { ESLintUtils } from '@typescript-eslint/utils';
2
+ import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
3
3
 
4
- interface ExampleTypedLintingRuleDocs {
4
+ /**
5
+ * Helper to create an ESLint rule with a consistent format.
6
+ */
7
+ declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, {
8
+ description: string;
9
+ recommended?: boolean;
10
+ requiresTypeChecking?: boolean;
11
+ }>>) => ESLintUtils.RuleModule<MessageIds, Options, {
5
12
  description: string;
6
13
  recommended?: boolean;
7
14
  requiresTypeChecking?: boolean;
8
- }
9
- declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, ExampleTypedLintingRuleDocs>>) => ESLintUtils.RuleModule<MessageIds, Options, ExampleTypedLintingRuleDocs, ESLintUtils.RuleListener> & {
15
+ }, ESLintUtils.RuleListener> & {
10
16
  name: string;
11
17
  };
12
18
 
19
+ /**
20
+ * ESLint plugin for Bemoje projects.
21
+ */
13
22
  declare function eslintPluginBemoje(): {
14
23
  configs: {
15
24
  readonly recommended: {
@@ -17,7 +26,11 @@ declare function eslintPluginBemoje(): {
17
26
  readonly 'eslint-plugin-bemoje': any;
18
27
  };
19
28
  rules: {
20
- 'no-blank-line-between-comment-and-declaration': _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], ExampleTypedLintingRuleDocs, _typescript_eslint_utils_ts_eslint.RuleListener> & {
29
+ 'no-blank-line-between-comment-and-declaration': _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
30
+ description: string;
31
+ recommended?: boolean;
32
+ requiresTypeChecking?: boolean;
33
+ }, _typescript_eslint_utils_ts_eslint.RuleListener> & {
21
34
  name: string;
22
35
  };
23
36
  };
@@ -28,14 +41,25 @@ declare function eslintPluginBemoje(): {
28
41
  version: string;
29
42
  };
30
43
  rules: {
31
- 'no-blank-line-between-comment-and-declaration': _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], ExampleTypedLintingRuleDocs, _typescript_eslint_utils_ts_eslint.RuleListener> & {
44
+ 'no-blank-line-between-comment-and-declaration': _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
45
+ description: string;
46
+ recommended?: boolean;
47
+ requiresTypeChecking?: boolean;
48
+ }, _typescript_eslint_utils_ts_eslint.RuleListener> & {
32
49
  name: string;
33
50
  };
34
51
  };
35
52
  };
36
53
 
37
- declare const noBlankLineBetweenCommentAndDeclaration: _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], ExampleTypedLintingRuleDocs, _typescript_eslint_utils_ts_eslint.RuleListener> & {
54
+ /**
55
+ * Enforce no blank lines between block comments and the next declaration.
56
+ */
57
+ declare const noBlankLineBetweenCommentAndDeclaration: _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
58
+ description: string;
59
+ recommended?: boolean;
60
+ requiresTypeChecking?: boolean;
61
+ }, _typescript_eslint_utils_ts_eslint.RuleListener> & {
38
62
  name: string;
39
63
  };
40
64
 
41
- export { type ExampleTypedLintingRuleDocs, createRule, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration };
65
+ export { createRule, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration };
package/index.mjs CHANGED
@@ -3,21 +3,20 @@ import { ESLintUtils, AST_TOKEN_TYPES } from '@typescript-eslint/utils';
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
5
  var createRule = ESLintUtils.RuleCreator((name) => {
6
- return `https://github.com/bemoje/tsmono/libs/eslint-plugin-bemoje/docs/rules/${name}.md`;
6
+ return `https://github.com/bemoje/mono/blob/dev/libs/eslint/README.md#${name}`;
7
7
  });
8
-
9
- // src/rules/noBlankLineBetweenCommentAndDeclaration.ts
10
8
  var noBlankLineBetweenCommentAndDeclaration = createRule({
11
9
  name: "no-blank-line-between-comment-and-declaration",
12
10
  meta: {
13
11
  fixable: "whitespace",
14
12
  docs: {
15
- description: "Consistant whitespace "
13
+ description: "Consistant whitespace ",
14
+ recommended: true
16
15
  },
17
16
  messages: {
18
17
  "no-blank-line-between-comment-and-declaration": "Block comments for a declaration must not leave blank lines between them."
19
18
  },
20
- type: "suggestion",
19
+ type: "problem",
21
20
  schema: []
22
21
  },
23
22
  defaultOptions: [
@@ -26,10 +25,7 @@ var noBlankLineBetweenCommentAndDeclaration = createRule({
26
25
  create(context) {
27
26
  return {
28
27
  Program(program) {
29
- if (!program.comments) {
30
- return;
31
- }
32
- program.comments.forEach((comment) => {
28
+ program.comments?.forEach((comment) => {
33
29
  if (comment.type !== AST_TOKEN_TYPES.Block) {
34
30
  return;
35
31
  }
@@ -70,7 +66,7 @@ var noBlankLineBetweenCommentAndDeclaration = createRule({
70
66
  }
71
67
  });
72
68
 
73
- // src/plugin.ts
69
+ // src/lib/eslintPluginBemoje.ts
74
70
  function eslintPluginBemoje() {
75
71
  const rules = {
76
72
  "no-blank-line-between-comment-and-declaration": noBlankLineBetweenCommentAndDeclaration
package/package.json CHANGED
@@ -1,17 +1,28 @@
1
1
  {
2
2
  "name": "@bemoje/eslint",
3
- "version": "1.0.1",
4
- "description": "eslint",
3
+ "version": "1.1.2",
4
+ "description": "Custom ESLint plugin and rule utilities for consistent code style in TypeScript projects.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "keywords": [
8
- "eslint"
8
+ "eslint",
9
+ "eslint-plugin",
10
+ "linting",
11
+ "rules",
12
+ "code-style",
13
+ "utilities",
14
+ "typescript"
9
15
  ],
10
16
  "exports": {
11
17
  ".": {
12
18
  "types": "./index.d.ts",
13
19
  "import": "./index.mjs",
14
20
  "default": "./index.mjs"
21
+ },
22
+ "./*": {
23
+ "types": "./index.d.ts",
24
+ "import": "./index.mjs",
25
+ "default": "./index.mjs"
15
26
  }
16
27
  },
17
28
  "dependencies": {