@bemoje/eslint 2.1.2 → 2.1.3
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/lib/index.cjs +25 -22
- package/lib/index.d.cts +45 -36
- package/lib/index.d.ts +45 -36
- package/lib/index.js +25 -23
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -5,6 +5,8 @@ var utils = require('@typescript-eslint/utils');
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
7
|
var createRule = utils.ESLintUtils.RuleCreator((name) => `https://github.com/bemoje/mono/blob/dev/libs/eslint/README.md#${name}`);
|
|
8
|
+
|
|
9
|
+
// src/rules/noBlankLineBetweenCommentAndDeclaration.ts
|
|
8
10
|
var noBlankLineBetweenCommentAndDeclaration = createRule({
|
|
9
11
|
name: "no-blank-line-between-comment-and-declaration",
|
|
10
12
|
meta: {
|
|
@@ -137,6 +139,28 @@ var bemojePlugin = {
|
|
|
137
139
|
}
|
|
138
140
|
};
|
|
139
141
|
|
|
142
|
+
// src/configs/enforceNoBlankLineBetweenCommentAndDeclaration.ts
|
|
143
|
+
var enforceNoBlankLineBetweenCommentAndDeclaration = {
|
|
144
|
+
name: "@bemoje/eslint/no-blank-line-between-comment-and-declaration",
|
|
145
|
+
plugins: {
|
|
146
|
+
bemoje: bemojePlugin
|
|
147
|
+
},
|
|
148
|
+
rules: {
|
|
149
|
+
"bemoje/no-blank-line-between-comment-and-declaration": "error"
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// src/configs/enforceSplitImports.ts
|
|
154
|
+
var enforceSplitImports = {
|
|
155
|
+
name: "@bemoje/eslint/split-imports",
|
|
156
|
+
plugins: {
|
|
157
|
+
bemoje: bemojePlugin
|
|
158
|
+
},
|
|
159
|
+
rules: {
|
|
160
|
+
"bemoje/split-imports": "error"
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
140
164
|
// src/lib/eslintPluginBemoje.ts
|
|
141
165
|
function eslintPluginBemoje() {
|
|
142
166
|
const rules = bemojePlugin.rules;
|
|
@@ -166,32 +190,11 @@ function eslintPluginBemoje() {
|
|
|
166
190
|
}
|
|
167
191
|
__name(eslintPluginBemoje, "eslintPluginBemoje");
|
|
168
192
|
|
|
169
|
-
// src/configs/enforceNoBlankLineBetweenCommentAndDeclaration.ts
|
|
170
|
-
var enforceNoBlankLineBetweenCommentAndDeclaration = {
|
|
171
|
-
name: "@bemoje/eslint/no-blank-line-between-comment-and-declaration",
|
|
172
|
-
plugins: {
|
|
173
|
-
bemoje: bemojePlugin
|
|
174
|
-
},
|
|
175
|
-
rules: {
|
|
176
|
-
"bemoje/no-blank-line-between-comment-and-declaration": "error"
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
// src/configs/enforceSplitImports.ts
|
|
181
|
-
var enforceSplitImports = {
|
|
182
|
-
name: "@bemoje/eslint/split-imports",
|
|
183
|
-
plugins: {
|
|
184
|
-
bemoje: bemojePlugin
|
|
185
|
-
},
|
|
186
|
-
rules: {
|
|
187
|
-
"bemoje/split-imports": "error"
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
193
|
exports.bemojePlugin = bemojePlugin;
|
|
192
194
|
exports.createRule = createRule;
|
|
193
195
|
exports.enforceNoBlankLineBetweenCommentAndDeclaration = enforceNoBlankLineBetweenCommentAndDeclaration;
|
|
194
196
|
exports.enforceSplitImports = enforceSplitImports;
|
|
195
197
|
exports.eslintPluginBemoje = eslintPluginBemoje;
|
|
196
198
|
exports.noBlankLineBetweenCommentAndDeclaration = noBlankLineBetweenCommentAndDeclaration;
|
|
199
|
+
exports.ruleForEslint = ruleForEslint;
|
|
197
200
|
exports.splitImports = splitImports;
|
package/lib/index.d.cts
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
2
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
3
3
|
|
|
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, {
|
|
12
|
-
description: string;
|
|
13
|
-
recommended?: boolean;
|
|
14
|
-
requiresTypeChecking?: boolean;
|
|
15
|
-
}, ESLintUtils.RuleListener> & {
|
|
16
|
-
name: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
4
|
/**
|
|
20
5
|
* The types this package's plugin and config entries are offered under. They say what ESLint's own config type
|
|
21
6
|
* (`Linter.Config`) asks for and nothing more, so an entry goes into a typed config with no cast. A rule keeps its
|
|
@@ -42,6 +27,50 @@ interface ConfigForEslint {
|
|
|
42
27
|
plugins: Record<string, PluginForEslint>;
|
|
43
28
|
rules: Record<string, 'error'>;
|
|
44
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* A rule written with typescript-eslint, as the type ESLint's config asks for. The one cast of this package: the two
|
|
32
|
+
* rule types differ only in the node types their listeners name (a listener of typescript-eslint takes its own node
|
|
33
|
+
* types, and in 8.57 its catch-all listener takes `never`), never in what runs.
|
|
34
|
+
*/
|
|
35
|
+
declare const ruleForEslint: (rule: {
|
|
36
|
+
meta?: object;
|
|
37
|
+
create: (context: never) => object;
|
|
38
|
+
}) => RuleForEslint;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A ready-made ESLint flat config entry that turns the rule `no-blank-line-between-comment-and-declaration` on as an
|
|
42
|
+
* error: a block comment over several lines has no blank line between it and the code right after it. Put it in the
|
|
43
|
+
* list a config file exports, with no plugin to register and no rule name to type.
|
|
44
|
+
*/
|
|
45
|
+
declare const enforceNoBlankLineBetweenCommentAndDeclaration: ConfigForEslint;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A ready-made ESLint flat config entry that turns the rule `split-imports` on as an error: one import declaration
|
|
49
|
+
* per imported name. Put it in the list a config file exports, with no plugin to register and no rule name to type.
|
|
50
|
+
*/
|
|
51
|
+
declare const enforceSplitImports: ConfigForEslint;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The one plugin object that every ready-made config entry of this package registers, under the name `bemoje`.
|
|
55
|
+
* ESLint accepts the same plugin name in several config entries only when it is the same object each time, so the
|
|
56
|
+
* entries share this one. A rule's full name is `bemoje/<rule>`, for an `eslint-disable` comment.
|
|
57
|
+
*/
|
|
58
|
+
declare const bemojePlugin: PluginForEslint;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Helper to create an ESLint rule with a consistent format.
|
|
62
|
+
*/
|
|
63
|
+
declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, {
|
|
64
|
+
description: string;
|
|
65
|
+
recommended?: boolean;
|
|
66
|
+
requiresTypeChecking?: boolean;
|
|
67
|
+
}>>) => ESLintUtils.RuleModule<MessageIds, Options, {
|
|
68
|
+
description: string;
|
|
69
|
+
recommended?: boolean;
|
|
70
|
+
requiresTypeChecking?: boolean;
|
|
71
|
+
}, ESLintUtils.RuleListener> & {
|
|
72
|
+
name: string;
|
|
73
|
+
};
|
|
45
74
|
|
|
46
75
|
/** What `eslintPluginBemoje()` returns: the plugin, and a config that registers it and turns every rule on. */
|
|
47
76
|
interface EslintPluginBemoje extends PluginForEslint {
|
|
@@ -82,24 +111,4 @@ declare const splitImports: _typescript_eslint_utils_ts_eslint.RuleModule<"split
|
|
|
82
111
|
name: string;
|
|
83
112
|
};
|
|
84
113
|
|
|
85
|
-
|
|
86
|
-
* The one plugin object that every ready-made config entry of this package registers, under the name `bemoje`.
|
|
87
|
-
* ESLint accepts the same plugin name in several config entries only when it is the same object each time, so the
|
|
88
|
-
* entries share this one. A rule's full name is `bemoje/<rule>`, for an `eslint-disable` comment.
|
|
89
|
-
*/
|
|
90
|
-
declare const bemojePlugin: PluginForEslint;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* A ready-made ESLint flat config entry that turns the rule `no-blank-line-between-comment-and-declaration` on as an
|
|
94
|
-
* error: a block comment over several lines has no blank line between it and the code right after it. Put it in the
|
|
95
|
-
* list a config file exports, with no plugin to register and no rule name to type.
|
|
96
|
-
*/
|
|
97
|
-
declare const enforceNoBlankLineBetweenCommentAndDeclaration: ConfigForEslint;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* A ready-made ESLint flat config entry that turns the rule `split-imports` on as an error: one import declaration
|
|
101
|
-
* per imported name. Put it in the list a config file exports, with no plugin to register and no rule name to type.
|
|
102
|
-
*/
|
|
103
|
-
declare const enforceSplitImports: ConfigForEslint;
|
|
104
|
-
|
|
105
|
-
export { bemojePlugin, createRule, enforceNoBlankLineBetweenCommentAndDeclaration, enforceSplitImports, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration, splitImports };
|
|
114
|
+
export { type ConfigForEslint, type EslintPluginBemoje, type PluginForEslint, type RuleForEslint, bemojePlugin, createRule, enforceNoBlankLineBetweenCommentAndDeclaration, enforceSplitImports, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration, ruleForEslint, splitImports };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
2
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
3
3
|
|
|
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, {
|
|
12
|
-
description: string;
|
|
13
|
-
recommended?: boolean;
|
|
14
|
-
requiresTypeChecking?: boolean;
|
|
15
|
-
}, ESLintUtils.RuleListener> & {
|
|
16
|
-
name: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
4
|
/**
|
|
20
5
|
* The types this package's plugin and config entries are offered under. They say what ESLint's own config type
|
|
21
6
|
* (`Linter.Config`) asks for and nothing more, so an entry goes into a typed config with no cast. A rule keeps its
|
|
@@ -42,6 +27,50 @@ interface ConfigForEslint {
|
|
|
42
27
|
plugins: Record<string, PluginForEslint>;
|
|
43
28
|
rules: Record<string, 'error'>;
|
|
44
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* A rule written with typescript-eslint, as the type ESLint's config asks for. The one cast of this package: the two
|
|
32
|
+
* rule types differ only in the node types their listeners name (a listener of typescript-eslint takes its own node
|
|
33
|
+
* types, and in 8.57 its catch-all listener takes `never`), never in what runs.
|
|
34
|
+
*/
|
|
35
|
+
declare const ruleForEslint: (rule: {
|
|
36
|
+
meta?: object;
|
|
37
|
+
create: (context: never) => object;
|
|
38
|
+
}) => RuleForEslint;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A ready-made ESLint flat config entry that turns the rule `no-blank-line-between-comment-and-declaration` on as an
|
|
42
|
+
* error: a block comment over several lines has no blank line between it and the code right after it. Put it in the
|
|
43
|
+
* list a config file exports, with no plugin to register and no rule name to type.
|
|
44
|
+
*/
|
|
45
|
+
declare const enforceNoBlankLineBetweenCommentAndDeclaration: ConfigForEslint;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A ready-made ESLint flat config entry that turns the rule `split-imports` on as an error: one import declaration
|
|
49
|
+
* per imported name. Put it in the list a config file exports, with no plugin to register and no rule name to type.
|
|
50
|
+
*/
|
|
51
|
+
declare const enforceSplitImports: ConfigForEslint;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The one plugin object that every ready-made config entry of this package registers, under the name `bemoje`.
|
|
55
|
+
* ESLint accepts the same plugin name in several config entries only when it is the same object each time, so the
|
|
56
|
+
* entries share this one. A rule's full name is `bemoje/<rule>`, for an `eslint-disable` comment.
|
|
57
|
+
*/
|
|
58
|
+
declare const bemojePlugin: PluginForEslint;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Helper to create an ESLint rule with a consistent format.
|
|
62
|
+
*/
|
|
63
|
+
declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, {
|
|
64
|
+
description: string;
|
|
65
|
+
recommended?: boolean;
|
|
66
|
+
requiresTypeChecking?: boolean;
|
|
67
|
+
}>>) => ESLintUtils.RuleModule<MessageIds, Options, {
|
|
68
|
+
description: string;
|
|
69
|
+
recommended?: boolean;
|
|
70
|
+
requiresTypeChecking?: boolean;
|
|
71
|
+
}, ESLintUtils.RuleListener> & {
|
|
72
|
+
name: string;
|
|
73
|
+
};
|
|
45
74
|
|
|
46
75
|
/** What `eslintPluginBemoje()` returns: the plugin, and a config that registers it and turns every rule on. */
|
|
47
76
|
interface EslintPluginBemoje extends PluginForEslint {
|
|
@@ -82,24 +111,4 @@ declare const splitImports: _typescript_eslint_utils_ts_eslint.RuleModule<"split
|
|
|
82
111
|
name: string;
|
|
83
112
|
};
|
|
84
113
|
|
|
85
|
-
|
|
86
|
-
* The one plugin object that every ready-made config entry of this package registers, under the name `bemoje`.
|
|
87
|
-
* ESLint accepts the same plugin name in several config entries only when it is the same object each time, so the
|
|
88
|
-
* entries share this one. A rule's full name is `bemoje/<rule>`, for an `eslint-disable` comment.
|
|
89
|
-
*/
|
|
90
|
-
declare const bemojePlugin: PluginForEslint;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* A ready-made ESLint flat config entry that turns the rule `no-blank-line-between-comment-and-declaration` on as an
|
|
94
|
-
* error: a block comment over several lines has no blank line between it and the code right after it. Put it in the
|
|
95
|
-
* list a config file exports, with no plugin to register and no rule name to type.
|
|
96
|
-
*/
|
|
97
|
-
declare const enforceNoBlankLineBetweenCommentAndDeclaration: ConfigForEslint;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* A ready-made ESLint flat config entry that turns the rule `split-imports` on as an error: one import declaration
|
|
101
|
-
* per imported name. Put it in the list a config file exports, with no plugin to register and no rule name to type.
|
|
102
|
-
*/
|
|
103
|
-
declare const enforceSplitImports: ConfigForEslint;
|
|
104
|
-
|
|
105
|
-
export { bemojePlugin, createRule, enforceNoBlankLineBetweenCommentAndDeclaration, enforceSplitImports, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration, splitImports };
|
|
114
|
+
export { type ConfigForEslint, type EslintPluginBemoje, type PluginForEslint, type RuleForEslint, bemojePlugin, createRule, enforceNoBlankLineBetweenCommentAndDeclaration, enforceSplitImports, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration, ruleForEslint, splitImports };
|
package/lib/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import { ESLintUtils, AST_TOKEN_TYPES, AST_NODE_TYPES } from '@typescript-eslint
|
|
|
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) => `https://github.com/bemoje/mono/blob/dev/libs/eslint/README.md#${name}`);
|
|
6
|
+
|
|
7
|
+
// src/rules/noBlankLineBetweenCommentAndDeclaration.ts
|
|
6
8
|
var noBlankLineBetweenCommentAndDeclaration = createRule({
|
|
7
9
|
name: "no-blank-line-between-comment-and-declaration",
|
|
8
10
|
meta: {
|
|
@@ -135,6 +137,28 @@ var bemojePlugin = {
|
|
|
135
137
|
}
|
|
136
138
|
};
|
|
137
139
|
|
|
140
|
+
// src/configs/enforceNoBlankLineBetweenCommentAndDeclaration.ts
|
|
141
|
+
var enforceNoBlankLineBetweenCommentAndDeclaration = {
|
|
142
|
+
name: "@bemoje/eslint/no-blank-line-between-comment-and-declaration",
|
|
143
|
+
plugins: {
|
|
144
|
+
bemoje: bemojePlugin
|
|
145
|
+
},
|
|
146
|
+
rules: {
|
|
147
|
+
"bemoje/no-blank-line-between-comment-and-declaration": "error"
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// src/configs/enforceSplitImports.ts
|
|
152
|
+
var enforceSplitImports = {
|
|
153
|
+
name: "@bemoje/eslint/split-imports",
|
|
154
|
+
plugins: {
|
|
155
|
+
bemoje: bemojePlugin
|
|
156
|
+
},
|
|
157
|
+
rules: {
|
|
158
|
+
"bemoje/split-imports": "error"
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
138
162
|
// src/lib/eslintPluginBemoje.ts
|
|
139
163
|
function eslintPluginBemoje() {
|
|
140
164
|
const rules = bemojePlugin.rules;
|
|
@@ -164,26 +188,4 @@ function eslintPluginBemoje() {
|
|
|
164
188
|
}
|
|
165
189
|
__name(eslintPluginBemoje, "eslintPluginBemoje");
|
|
166
190
|
|
|
167
|
-
|
|
168
|
-
var enforceNoBlankLineBetweenCommentAndDeclaration = {
|
|
169
|
-
name: "@bemoje/eslint/no-blank-line-between-comment-and-declaration",
|
|
170
|
-
plugins: {
|
|
171
|
-
bemoje: bemojePlugin
|
|
172
|
-
},
|
|
173
|
-
rules: {
|
|
174
|
-
"bemoje/no-blank-line-between-comment-and-declaration": "error"
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// src/configs/enforceSplitImports.ts
|
|
179
|
-
var enforceSplitImports = {
|
|
180
|
-
name: "@bemoje/eslint/split-imports",
|
|
181
|
-
plugins: {
|
|
182
|
-
bemoje: bemojePlugin
|
|
183
|
-
},
|
|
184
|
-
rules: {
|
|
185
|
-
"bemoje/split-imports": "error"
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export { bemojePlugin, createRule, enforceNoBlankLineBetweenCommentAndDeclaration, enforceSplitImports, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration, splitImports };
|
|
191
|
+
export { bemojePlugin, createRule, enforceNoBlankLineBetweenCommentAndDeclaration, enforceSplitImports, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration, ruleForEslint, splitImports };
|