eslint-plugin-function 0.0.8 → 0.0.9
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/dist/index.d.ts +1 -0
- package/dist/index.js +30 -6
- package/package.json +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare const _default: {
|
|
|
7
7
|
};
|
|
8
8
|
readonly rules: {
|
|
9
9
|
readonly "function-definition": _typescript_eslint_utils_ts_eslint.RuleModule<"functionDefinition", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
10
|
+
readonly "function-name": _typescript_eslint_utils_ts_eslint.RuleModule<"functionName", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
10
11
|
readonly "function-return-boolean": _typescript_eslint_utils_ts_eslint.RuleModule<"functionReturnBoolean", readonly [{
|
|
11
12
|
readonly pattern?: string;
|
|
12
13
|
} | undefined], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
11
|
var name = "eslint-plugin-function";
|
|
12
|
-
var version = "0.0.
|
|
12
|
+
var version = "0.0.9";
|
|
13
13
|
function getDocsUrl() {
|
|
14
14
|
return "TODO: add docs for local ESLint rules";
|
|
15
15
|
}
|
|
@@ -125,8 +125,31 @@ var function_definition_default = createRule({
|
|
|
125
125
|
function create(context) {
|
|
126
126
|
return {};
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
|
|
129
|
+
// src/rules/function-name.ts
|
|
130
|
+
var RULE_NAME2 = "function-name";
|
|
129
131
|
var RULE_FEATURES2 = [];
|
|
132
|
+
var function_name_default = createRule({
|
|
133
|
+
meta: {
|
|
134
|
+
type: "problem",
|
|
135
|
+
docs: {
|
|
136
|
+
description: "Enforce a consistent function naming style.",
|
|
137
|
+
[Symbol.for("rule_features")]: RULE_FEATURES2
|
|
138
|
+
},
|
|
139
|
+
messages: {
|
|
140
|
+
functionName: ""
|
|
141
|
+
},
|
|
142
|
+
schema: []
|
|
143
|
+
},
|
|
144
|
+
name: RULE_NAME2,
|
|
145
|
+
create: create2,
|
|
146
|
+
defaultOptions: []
|
|
147
|
+
});
|
|
148
|
+
function create2(context) {
|
|
149
|
+
return {};
|
|
150
|
+
}
|
|
151
|
+
var RULE_NAME3 = "function-return-boolean";
|
|
152
|
+
var RULE_FEATURES3 = [];
|
|
130
153
|
var defaultPattern = "/^(is|should)/u";
|
|
131
154
|
var defaultOptions = [
|
|
132
155
|
{
|
|
@@ -143,7 +166,7 @@ var function_return_boolean_default = createRule({
|
|
|
143
166
|
type: "problem",
|
|
144
167
|
docs: {
|
|
145
168
|
description: "Enforce functions that match the pattern `/^(is|should)/u` return a boolean.",
|
|
146
|
-
[Symbol.for("rule_features")]:
|
|
169
|
+
[Symbol.for("rule_features")]: RULE_FEATURES3
|
|
147
170
|
},
|
|
148
171
|
messages: {
|
|
149
172
|
functionReturnBoolean: "The function '{{functionName}}' should return a boolean value (got {{variants}})."
|
|
@@ -159,11 +182,11 @@ var function_return_boolean_default = createRule({
|
|
|
159
182
|
}
|
|
160
183
|
}]
|
|
161
184
|
},
|
|
162
|
-
name:
|
|
163
|
-
create:
|
|
185
|
+
name: RULE_NAME3,
|
|
186
|
+
create: create3,
|
|
164
187
|
defaultOptions
|
|
165
188
|
});
|
|
166
|
-
function
|
|
189
|
+
function create3(context, [opts]) {
|
|
167
190
|
const services = ESLintUtils.getParserServices(context, false);
|
|
168
191
|
const pattern = toRegExp(opts?.pattern ?? defaultPattern);
|
|
169
192
|
const functionEntries = [];
|
|
@@ -230,6 +253,7 @@ var index_default = {
|
|
|
230
253
|
},
|
|
231
254
|
rules: {
|
|
232
255
|
"function-definition": function_definition_default,
|
|
256
|
+
"function-name": function_name_default,
|
|
233
257
|
"function-return-boolean": function_return_boolean_default
|
|
234
258
|
}
|
|
235
259
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-function",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"private": false,
|
|
4
5
|
"description": "(WIP) The ESLint plugin for function-related rules.",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"sideEffects": false,
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
"@typescript-eslint/type-utils": "^8.28.0",
|
|
25
26
|
"@typescript-eslint/types": "^8.28.0",
|
|
26
27
|
"@typescript-eslint/utils": "^8.28.0",
|
|
28
|
+
"string-ts": "^2.2.1",
|
|
27
29
|
"ts-pattern": "^5.6.2"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|