@bemoje/eslint 1.0.1 → 1.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 +76 -3
- package/lib/index.cjs +26 -0
- package/lib/index.d.cts +5 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +3 -0
- package/lib/lib/createRule.cjs +9 -0
- package/lib/lib/createRule.d.cts +18 -0
- package/lib/lib/createRule.d.ts +18 -0
- package/lib/lib/createRule.js +8 -0
- package/lib/lib/eslintPluginBemoje.cjs +34 -0
- package/lib/lib/eslintPluginBemoje.d.cts +38 -0
- package/lib/lib/eslintPluginBemoje.d.ts +38 -0
- package/lib/lib/eslintPluginBemoje.js +31 -0
- package/lib/rules/noBlankLineBetweenCommentAndDeclaration.cjs +67 -0
- package/lib/rules/noBlankLineBetweenCommentAndDeclaration.d.cts +14 -0
- package/lib/rules/noBlankLineBetweenCommentAndDeclaration.d.ts +14 -0
- package/{index.mjs → lib/rules/noBlankLineBetweenCommentAndDeclaration.js} +9 -44
- package/package.json +80 -18
- package/index.d.ts +0 -41
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bemoje/eslint
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Custom ESLint plugin and rule utilities for consistent code style in TypeScript projects.
|
|
4
4
|
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
[](https://nodejs.org/api/esm.html)
|
|
@@ -8,6 +8,79 @@ asdasd
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npm install --
|
|
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/lib/index.cjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var createRule = require('./lib/createRule');
|
|
4
|
+
var eslintPluginBemoje = require('./lib/eslintPluginBemoje');
|
|
5
|
+
var noBlankLineBetweenCommentAndDeclaration = require('./rules/noBlankLineBetweenCommentAndDeclaration');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.keys(createRule).forEach(function (k) {
|
|
10
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return createRule[k]; }
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
Object.keys(eslintPluginBemoje).forEach(function (k) {
|
|
16
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return eslintPluginBemoje[k]; }
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
Object.keys(noBlankLineBetweenCommentAndDeclaration).forEach(function (k) {
|
|
22
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return noBlankLineBetweenCommentAndDeclaration[k]; }
|
|
25
|
+
});
|
|
26
|
+
});
|
package/lib/index.d.cts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createRule } from './lib/createRule.cjs';
|
|
2
|
+
export { eslintPluginBemoje } from './lib/eslintPluginBemoje.cjs';
|
|
3
|
+
export { noBlankLineBetweenCommentAndDeclaration } from './rules/noBlankLineBetweenCommentAndDeclaration.cjs';
|
|
4
|
+
import '@typescript-eslint/utils';
|
|
5
|
+
import '@typescript-eslint/utils/ts-eslint';
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createRule } from './lib/createRule.js';
|
|
2
|
+
export { eslintPluginBemoje } from './lib/eslintPluginBemoje.js';
|
|
3
|
+
export { noBlankLineBetweenCommentAndDeclaration } from './rules/noBlankLineBetweenCommentAndDeclaration.js';
|
|
4
|
+
import '@typescript-eslint/utils';
|
|
5
|
+
import '@typescript-eslint/utils/ts-eslint';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper to create an ESLint rule with a consistent format.
|
|
5
|
+
*/
|
|
6
|
+
declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, {
|
|
7
|
+
description: string;
|
|
8
|
+
recommended?: boolean;
|
|
9
|
+
requiresTypeChecking?: boolean;
|
|
10
|
+
}>>) => ESLintUtils.RuleModule<MessageIds, Options, {
|
|
11
|
+
description: string;
|
|
12
|
+
recommended?: boolean;
|
|
13
|
+
requiresTypeChecking?: boolean;
|
|
14
|
+
}, ESLintUtils.RuleListener> & {
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { createRule };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper to create an ESLint rule with a consistent format.
|
|
5
|
+
*/
|
|
6
|
+
declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, {
|
|
7
|
+
description: string;
|
|
8
|
+
recommended?: boolean;
|
|
9
|
+
requiresTypeChecking?: boolean;
|
|
10
|
+
}>>) => ESLintUtils.RuleModule<MessageIds, Options, {
|
|
11
|
+
description: string;
|
|
12
|
+
recommended?: boolean;
|
|
13
|
+
requiresTypeChecking?: boolean;
|
|
14
|
+
}, ESLintUtils.RuleListener> & {
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { createRule };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var noBlankLineBetweenCommentAndDeclaration = require('../rules/noBlankLineBetweenCommentAndDeclaration');
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
function eslintPluginBemoje() {
|
|
8
|
+
const rules = {
|
|
9
|
+
"no-blank-line-between-comment-and-declaration": noBlankLineBetweenCommentAndDeclaration.noBlankLineBetweenCommentAndDeclaration
|
|
10
|
+
};
|
|
11
|
+
const plugins = {
|
|
12
|
+
get "eslint-plugin-bemoje"() {
|
|
13
|
+
return eslintPluginBemoje();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
configs: {
|
|
18
|
+
get recommended() {
|
|
19
|
+
return {
|
|
20
|
+
plugins,
|
|
21
|
+
rules
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
meta: {
|
|
26
|
+
name: "eslint-plugin-bemoje",
|
|
27
|
+
version: "1.0.1"
|
|
28
|
+
},
|
|
29
|
+
rules
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
__name(eslintPluginBemoje, "eslintPluginBemoje");
|
|
33
|
+
|
|
34
|
+
exports.eslintPluginBemoje = eslintPluginBemoje;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ESLint plugin for Bemoje projects.
|
|
5
|
+
*/
|
|
6
|
+
declare function eslintPluginBemoje(): {
|
|
7
|
+
configs: {
|
|
8
|
+
readonly recommended: {
|
|
9
|
+
plugins: {
|
|
10
|
+
readonly 'eslint-plugin-bemoje': any;
|
|
11
|
+
};
|
|
12
|
+
rules: {
|
|
13
|
+
'no-blank-line-between-comment-and-declaration': _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
|
|
14
|
+
description: string;
|
|
15
|
+
recommended?: boolean;
|
|
16
|
+
requiresTypeChecking?: boolean;
|
|
17
|
+
}, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
18
|
+
name: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
meta: {
|
|
24
|
+
name: string;
|
|
25
|
+
version: string;
|
|
26
|
+
};
|
|
27
|
+
rules: {
|
|
28
|
+
'no-blank-line-between-comment-and-declaration': _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
|
|
29
|
+
description: string;
|
|
30
|
+
recommended?: boolean;
|
|
31
|
+
requiresTypeChecking?: boolean;
|
|
32
|
+
}, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
33
|
+
name: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { eslintPluginBemoje };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ESLint plugin for Bemoje projects.
|
|
5
|
+
*/
|
|
6
|
+
declare function eslintPluginBemoje(): {
|
|
7
|
+
configs: {
|
|
8
|
+
readonly recommended: {
|
|
9
|
+
plugins: {
|
|
10
|
+
readonly 'eslint-plugin-bemoje': any;
|
|
11
|
+
};
|
|
12
|
+
rules: {
|
|
13
|
+
'no-blank-line-between-comment-and-declaration': _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
|
|
14
|
+
description: string;
|
|
15
|
+
recommended?: boolean;
|
|
16
|
+
requiresTypeChecking?: boolean;
|
|
17
|
+
}, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
18
|
+
name: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
meta: {
|
|
24
|
+
name: string;
|
|
25
|
+
version: string;
|
|
26
|
+
};
|
|
27
|
+
rules: {
|
|
28
|
+
'no-blank-line-between-comment-and-declaration': _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
|
|
29
|
+
description: string;
|
|
30
|
+
recommended?: boolean;
|
|
31
|
+
requiresTypeChecking?: boolean;
|
|
32
|
+
}, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
33
|
+
name: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { eslintPluginBemoje };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __name } from '../chunk-SHUYVCID.js';
|
|
2
|
+
import { noBlankLineBetweenCommentAndDeclaration } from '../rules/noBlankLineBetweenCommentAndDeclaration';
|
|
3
|
+
|
|
4
|
+
function eslintPluginBemoje() {
|
|
5
|
+
const rules = {
|
|
6
|
+
"no-blank-line-between-comment-and-declaration": noBlankLineBetweenCommentAndDeclaration
|
|
7
|
+
};
|
|
8
|
+
const plugins = {
|
|
9
|
+
get "eslint-plugin-bemoje"() {
|
|
10
|
+
return eslintPluginBemoje();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
configs: {
|
|
15
|
+
get recommended() {
|
|
16
|
+
return {
|
|
17
|
+
plugins,
|
|
18
|
+
rules
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
meta: {
|
|
23
|
+
name: "eslint-plugin-bemoje",
|
|
24
|
+
version: "1.0.1"
|
|
25
|
+
},
|
|
26
|
+
rules
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
__name(eslintPluginBemoje, "eslintPluginBemoje");
|
|
30
|
+
|
|
31
|
+
export { eslintPluginBemoje };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('@typescript-eslint/utils');
|
|
4
|
+
var createRule_js = require('../lib/createRule.js');
|
|
5
|
+
|
|
6
|
+
const noBlankLineBetweenCommentAndDeclaration = createRule_js.createRule({
|
|
7
|
+
name: "no-blank-line-between-comment-and-declaration",
|
|
8
|
+
meta: {
|
|
9
|
+
fixable: "whitespace",
|
|
10
|
+
docs: {
|
|
11
|
+
description: "Consistant whitespace ",
|
|
12
|
+
recommended: true
|
|
13
|
+
},
|
|
14
|
+
messages: {
|
|
15
|
+
"no-blank-line-between-comment-and-declaration": "Block comments for a declaration must not leave blank lines between them."
|
|
16
|
+
},
|
|
17
|
+
type: "problem",
|
|
18
|
+
schema: []
|
|
19
|
+
},
|
|
20
|
+
defaultOptions: [
|
|
21
|
+
"error"
|
|
22
|
+
],
|
|
23
|
+
create(context) {
|
|
24
|
+
return {
|
|
25
|
+
Program(program) {
|
|
26
|
+
program.comments?.forEach((comment) => {
|
|
27
|
+
if (comment.type !== utils.AST_TOKEN_TYPES.Block) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (Math.abs(comment.loc.start.line - comment.loc.end.line) < 2) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const nextToken = context.sourceCode.getTokenAfter(comment);
|
|
34
|
+
if (!nextToken) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const actualNextTokenStartLine = nextToken.loc.start.line;
|
|
38
|
+
const expectedTokenStartLine = comment.loc.end.line + 1;
|
|
39
|
+
if (!(actualNextTokenStartLine > expectedTokenStartLine)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const lineBeforeNextToken = context.sourceCode.lines[nextToken.loc.start.line - 1 - 1];
|
|
43
|
+
const hasLineCommentBetween = lineBeforeNextToken.trim().startsWith("//");
|
|
44
|
+
if (hasLineCommentBetween) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
return context.report({
|
|
48
|
+
node: program,
|
|
49
|
+
messageId: "no-blank-line-between-comment-and-declaration",
|
|
50
|
+
fix(fixer) {
|
|
51
|
+
const start = comment.range[0];
|
|
52
|
+
const end = nextToken.range[1];
|
|
53
|
+
const rangeCode = context.sourceCode.text.slice(start, end);
|
|
54
|
+
const rangeCodeFixed = rangeCode.replaceAll(/\*\/\n\n+/gi, "*/\n");
|
|
55
|
+
return fixer.replaceTextRange([
|
|
56
|
+
start,
|
|
57
|
+
end
|
|
58
|
+
], rangeCodeFixed);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
exports.noBlankLineBetweenCommentAndDeclaration = noBlankLineBetweenCommentAndDeclaration;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enforce no blank lines between block comments and the next declaration.
|
|
5
|
+
*/
|
|
6
|
+
declare const noBlankLineBetweenCommentAndDeclaration: _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
|
|
7
|
+
description: string;
|
|
8
|
+
recommended?: boolean;
|
|
9
|
+
requiresTypeChecking?: boolean;
|
|
10
|
+
}, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { noBlankLineBetweenCommentAndDeclaration };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enforce no blank lines between block comments and the next declaration.
|
|
5
|
+
*/
|
|
6
|
+
declare const noBlankLineBetweenCommentAndDeclaration: _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
|
|
7
|
+
description: string;
|
|
8
|
+
recommended?: boolean;
|
|
9
|
+
requiresTypeChecking?: boolean;
|
|
10
|
+
}, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { noBlankLineBetweenCommentAndDeclaration };
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../chunk-SHUYVCID.js';
|
|
2
|
+
import { AST_TOKEN_TYPES } from '@typescript-eslint/utils';
|
|
3
|
+
import { createRule } from '../lib/createRule.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
var createRule = ESLintUtils.RuleCreator((name) => {
|
|
6
|
-
return `https://github.com/bemoje/tsmono/libs/eslint-plugin-bemoje/docs/rules/${name}.md`;
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// src/rules/noBlankLineBetweenCommentAndDeclaration.ts
|
|
10
|
-
var noBlankLineBetweenCommentAndDeclaration = createRule({
|
|
5
|
+
const noBlankLineBetweenCommentAndDeclaration = createRule({
|
|
11
6
|
name: "no-blank-line-between-comment-and-declaration",
|
|
12
7
|
meta: {
|
|
13
8
|
fixable: "whitespace",
|
|
14
9
|
docs: {
|
|
15
|
-
description: "Consistant whitespace "
|
|
10
|
+
description: "Consistant whitespace ",
|
|
11
|
+
recommended: true
|
|
16
12
|
},
|
|
17
13
|
messages: {
|
|
18
14
|
"no-blank-line-between-comment-and-declaration": "Block comments for a declaration must not leave blank lines between them."
|
|
19
15
|
},
|
|
20
|
-
type: "
|
|
16
|
+
type: "problem",
|
|
21
17
|
schema: []
|
|
22
18
|
},
|
|
23
19
|
defaultOptions: [
|
|
@@ -26,10 +22,7 @@ var noBlankLineBetweenCommentAndDeclaration = createRule({
|
|
|
26
22
|
create(context) {
|
|
27
23
|
return {
|
|
28
24
|
Program(program) {
|
|
29
|
-
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
program.comments.forEach((comment) => {
|
|
25
|
+
program.comments?.forEach((comment) => {
|
|
33
26
|
if (comment.type !== AST_TOKEN_TYPES.Block) {
|
|
34
27
|
return;
|
|
35
28
|
}
|
|
@@ -70,32 +63,4 @@ var noBlankLineBetweenCommentAndDeclaration = createRule({
|
|
|
70
63
|
}
|
|
71
64
|
});
|
|
72
65
|
|
|
73
|
-
|
|
74
|
-
function eslintPluginBemoje() {
|
|
75
|
-
const rules = {
|
|
76
|
-
"no-blank-line-between-comment-and-declaration": noBlankLineBetweenCommentAndDeclaration
|
|
77
|
-
};
|
|
78
|
-
const plugins = {
|
|
79
|
-
get "eslint-plugin-bemoje"() {
|
|
80
|
-
return eslintPluginBemoje();
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
return {
|
|
84
|
-
configs: {
|
|
85
|
-
get recommended() {
|
|
86
|
-
return {
|
|
87
|
-
plugins,
|
|
88
|
-
rules
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
meta: {
|
|
93
|
-
name: "eslint-plugin-bemoje",
|
|
94
|
-
version: "1.0.1"
|
|
95
|
-
},
|
|
96
|
-
rules
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
__name(eslintPluginBemoje, "eslintPluginBemoje");
|
|
100
|
-
|
|
101
|
-
export { createRule, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration };
|
|
66
|
+
export { noBlankLineBetweenCommentAndDeclaration };
|
package/package.json
CHANGED
|
@@ -1,34 +1,96 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemoje/eslint",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "
|
|
5
|
-
"type": "module",
|
|
6
|
-
"sideEffects": false,
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Custom ESLint plugin and rule utilities for consistent code style in TypeScript projects.",
|
|
7
5
|
"keywords": [
|
|
8
|
-
"eslint"
|
|
6
|
+
"eslint",
|
|
7
|
+
"eslint-plugin",
|
|
8
|
+
"linting",
|
|
9
|
+
"rules",
|
|
10
|
+
"code-style",
|
|
11
|
+
"utilities",
|
|
12
|
+
"typescript"
|
|
9
13
|
],
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./index.d.ts",
|
|
13
|
-
"import": "./index.mjs",
|
|
14
|
-
"default": "./index.mjs"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
14
|
"dependencies": {
|
|
18
15
|
"@typescript-eslint/utils": "^8.56.1"
|
|
19
16
|
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"sideEffects": false,
|
|
20
19
|
"publishConfig": {
|
|
21
20
|
"access": "public"
|
|
22
21
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
22
|
+
"main": "./lib/index.cjs",
|
|
23
|
+
"module": "./lib/index.js",
|
|
24
|
+
"types": "./lib/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./lib/index.d.ts",
|
|
29
|
+
"default": "./lib/index.js"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./lib/index.d.cts",
|
|
33
|
+
"default": "./lib/index.cjs"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"./lib/createRule": {
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./lib/lib/createRule.d.ts",
|
|
39
|
+
"default": "./lib/lib/createRule.js"
|
|
40
|
+
},
|
|
41
|
+
"require": {
|
|
42
|
+
"types": "./lib/lib/createRule.d.cts",
|
|
43
|
+
"default": "./lib/lib/createRule.cjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"./lib/eslintPluginBemoje": {
|
|
47
|
+
"import": {
|
|
48
|
+
"types": "./lib/lib/eslintPluginBemoje.d.ts",
|
|
49
|
+
"default": "./lib/lib/eslintPluginBemoje.js"
|
|
50
|
+
},
|
|
51
|
+
"require": {
|
|
52
|
+
"types": "./lib/lib/eslintPluginBemoje.d.cts",
|
|
53
|
+
"default": "./lib/lib/eslintPluginBemoje.cjs"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"./rules/noBlankLineBetweenCommentAndDeclaration": {
|
|
57
|
+
"import": {
|
|
58
|
+
"types": "./lib/rules/noBlankLineBetweenCommentAndDeclaration.d.ts",
|
|
59
|
+
"default": "./lib/rules/noBlankLineBetweenCommentAndDeclaration.js"
|
|
60
|
+
},
|
|
61
|
+
"require": {
|
|
62
|
+
"types": "./lib/rules/noBlankLineBetweenCommentAndDeclaration.d.cts",
|
|
63
|
+
"default": "./lib/rules/noBlankLineBetweenCommentAndDeclaration.cjs"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
28
66
|
},
|
|
67
|
+
"files": [
|
|
68
|
+
"./lib/index.js",
|
|
69
|
+
"./lib/index.d.ts",
|
|
70
|
+
"./lib/index.cjs",
|
|
71
|
+
"./lib/index.d.cts",
|
|
72
|
+
"./lib/lib/createRule.js",
|
|
73
|
+
"./lib/lib/createRule.d.ts",
|
|
74
|
+
"./lib/lib/createRule.cjs",
|
|
75
|
+
"./lib/lib/createRule.d.cts",
|
|
76
|
+
"./lib/lib/eslintPluginBemoje.js",
|
|
77
|
+
"./lib/lib/eslintPluginBemoje.d.ts",
|
|
78
|
+
"./lib/lib/eslintPluginBemoje.cjs",
|
|
79
|
+
"./lib/lib/eslintPluginBemoje.d.cts",
|
|
80
|
+
"./lib/rules/noBlankLineBetweenCommentAndDeclaration.js",
|
|
81
|
+
"./lib/rules/noBlankLineBetweenCommentAndDeclaration.d.ts",
|
|
82
|
+
"./lib/rules/noBlankLineBetweenCommentAndDeclaration.cjs",
|
|
83
|
+
"./lib/rules/noBlankLineBetweenCommentAndDeclaration.d.cts"
|
|
84
|
+
],
|
|
29
85
|
"repository": {
|
|
30
86
|
"type": "git",
|
|
31
87
|
"url": "git+https://github.com/bemoje/mono.git",
|
|
32
88
|
"directory": "libs/eslint"
|
|
33
|
-
}
|
|
89
|
+
},
|
|
90
|
+
"author": {
|
|
91
|
+
"name": "Benjamin Møller Jensen",
|
|
92
|
+
"email": "bemoje@bemoje.net",
|
|
93
|
+
"url": "https://github.com/bemoje/"
|
|
94
|
+
},
|
|
95
|
+
"license": "MIT"
|
|
34
96
|
}
|
package/index.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
-
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
3
|
-
|
|
4
|
-
interface ExampleTypedLintingRuleDocs {
|
|
5
|
-
description: string;
|
|
6
|
-
recommended?: boolean;
|
|
7
|
-
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> & {
|
|
10
|
-
name: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
declare function eslintPluginBemoje(): {
|
|
14
|
-
configs: {
|
|
15
|
-
readonly recommended: {
|
|
16
|
-
plugins: {
|
|
17
|
-
readonly 'eslint-plugin-bemoje': any;
|
|
18
|
-
};
|
|
19
|
-
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> & {
|
|
21
|
-
name: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
meta: {
|
|
27
|
-
name: string;
|
|
28
|
-
version: string;
|
|
29
|
-
};
|
|
30
|
-
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> & {
|
|
32
|
-
name: string;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
|
|
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> & {
|
|
38
|
-
name: string;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export { type ExampleTypedLintingRuleDocs, createRule, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration };
|