@daldalso/eslint-plugin 1.2.0 → 1.2.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/LICENSE +21 -21
- package/README.md +7 -13
- package/dist/configs/all.js +56 -40
- package/dist/index.js +3 -1
- package/dist/rules/iterator-name.js +1 -1
- package/dist/rules/parenthesis-spacing.js +2 -3
- package/dist/rules/prefer-const.js +3 -3
- package/dist/rules/semantic-quotes.js +18 -19
- package/package.json +12 -9
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 JJoriping
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 JJoriping
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,19 +4,13 @@ ESLint plugin for [Daldalso](https://daldal.so)-style programming.
|
|
|
4
4
|
|
|
5
5
|
## Getting Started
|
|
6
6
|
1. `yarn add @daldalso/eslint-plugin`
|
|
7
|
-
2. Add
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"plugin:@daldalso/eslint-plugin/all"
|
|
15
|
-
],
|
|
16
|
-
"parserOptions": {
|
|
17
|
-
"project": "./tsconfig.json"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
7
|
+
2. Add the plugin to your ESLint 9 configuration file like below:
|
|
8
|
+
```js
|
|
9
|
+
import daldalsoPlugin from "@daldalso/eslint-plugin";
|
|
10
|
+
|
|
11
|
+
export default [
|
|
12
|
+
daldalsoPlugin.configs.all
|
|
13
|
+
];
|
|
20
14
|
```
|
|
21
15
|
|
|
22
16
|
## Caveats
|
package/dist/configs/all.js
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var stylisticPlugin = require("@stylistic/eslint-plugin-ts");
|
|
4
|
+
var compat_1 = require("@eslint/compat");
|
|
5
|
+
var importPlugin = require("eslint-plugin-import");
|
|
6
|
+
var tsLintParser = require("@typescript-eslint/parser");
|
|
7
|
+
var tsLintPlugin = require("@typescript-eslint/eslint-plugin");
|
|
8
|
+
var reactPlugin = require("eslint-plugin-react");
|
|
9
|
+
var reactHooksPlugin = require("eslint-plugin-react-hooks");
|
|
10
|
+
var unicornPlugin = require("eslint-plugin-unicorn");
|
|
3
11
|
exports.default = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
sourceType: "module",
|
|
7
|
-
ecmaFeatures: {
|
|
8
|
-
"jsx": true
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
plugins: [
|
|
12
|
-
"@typescript-eslint",
|
|
13
|
-
"import",
|
|
14
|
-
"react",
|
|
15
|
-
"react-hooks",
|
|
16
|
-
"unicorn"
|
|
12
|
+
files: [
|
|
13
|
+
"**/*.{ts,tsx}"
|
|
17
14
|
],
|
|
15
|
+
languageOptions: {
|
|
16
|
+
parserOptions: {
|
|
17
|
+
project: "./tsconfig.json",
|
|
18
|
+
ecmaFeatures: {
|
|
19
|
+
"jsx": true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
parser: tsLintParser,
|
|
23
|
+
sourceType: "module"
|
|
24
|
+
},
|
|
25
|
+
plugins: {
|
|
26
|
+
'@stylistic': stylisticPlugin,
|
|
27
|
+
'@typescript-eslint': tsLintPlugin,
|
|
28
|
+
'import': (0, compat_1.fixupPluginRules)(importPlugin),
|
|
29
|
+
'react': reactPlugin,
|
|
30
|
+
'react-hooks': reactHooksPlugin,
|
|
31
|
+
'unicorn': unicornPlugin
|
|
32
|
+
},
|
|
18
33
|
settings: {
|
|
19
34
|
react: {
|
|
20
35
|
version: "detect"
|
|
@@ -106,16 +121,16 @@ exports.default = {
|
|
|
106
121
|
'template-curly-spacing': "warn",
|
|
107
122
|
'template-tag-spacing': "warn",
|
|
108
123
|
'yield-star-spacing': ["warn", "before"],
|
|
109
|
-
//
|
|
110
|
-
'@
|
|
111
|
-
'@
|
|
124
|
+
// Stylistic rules
|
|
125
|
+
'@stylistic/brace-style': "warn",
|
|
126
|
+
'@stylistic/comma-dangle': [
|
|
112
127
|
"warn",
|
|
113
128
|
// NOTE Problem with `<T,>() => ...`
|
|
114
129
|
{ generics: "ignore" }
|
|
115
130
|
],
|
|
116
|
-
'@
|
|
117
|
-
'@
|
|
118
|
-
'@
|
|
131
|
+
'@stylistic/comma-spacing': "warn",
|
|
132
|
+
'@stylistic/func-call-spacing': ["warn", "never"],
|
|
133
|
+
'@stylistic/indent': [
|
|
119
134
|
"warn",
|
|
120
135
|
2,
|
|
121
136
|
{
|
|
@@ -130,7 +145,7 @@ exports.default = {
|
|
|
130
145
|
]
|
|
131
146
|
}
|
|
132
147
|
],
|
|
133
|
-
'@
|
|
148
|
+
'@stylistic/keyword-spacing': ["warn", {
|
|
134
149
|
overrides: {
|
|
135
150
|
catch: { before: false, after: false },
|
|
136
151
|
do: { before: true, after: false },
|
|
@@ -146,20 +161,33 @@ exports.default = {
|
|
|
146
161
|
with: { before: true, after: false }
|
|
147
162
|
}
|
|
148
163
|
}],
|
|
149
|
-
'@
|
|
164
|
+
'@stylistic/member-delimiter-style': ["warn", {
|
|
165
|
+
overrides: {
|
|
166
|
+
interface: {
|
|
167
|
+
singleline: { delimiter: "semi", requireLast: true },
|
|
168
|
+
multiline: { delimiter: "semi", requireLast: true }
|
|
169
|
+
},
|
|
170
|
+
typeLiteral: {
|
|
171
|
+
singleline: { delimiter: "comma", requireLast: false },
|
|
172
|
+
multiline: { delimiter: "comma", requireLast: false }
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}],
|
|
176
|
+
'@stylistic/no-extra-parens': [
|
|
150
177
|
"warn",
|
|
151
178
|
"all",
|
|
152
179
|
{ ignoreJSX: "all", nestedBinaryExpressions: false }
|
|
153
180
|
],
|
|
154
|
-
'@
|
|
181
|
+
'@stylistic/no-extra-semi': "error",
|
|
182
|
+
'@stylistic/semi': "warn",
|
|
183
|
+
'@stylistic/space-before-blocks': ["warn", "never"],
|
|
184
|
+
'@stylistic/space-before-function-paren': ["warn", { anonymous: "never", named: "never", asyncArrow: "always" }],
|
|
185
|
+
// TSLint rules - extensions
|
|
155
186
|
'@typescript-eslint/no-shadow': ["warn", { allow: ["_"] }],
|
|
156
|
-
'@typescript-eslint/no-throw-literal': "error",
|
|
157
187
|
'@typescript-eslint/no-unused-expressions': ["error", { allowShortCircuit: true, enforceForJSX: true }],
|
|
158
188
|
'@typescript-eslint/no-useless-constructor': "warn",
|
|
189
|
+
'@typescript-eslint/only-throw-error': "error",
|
|
159
190
|
'@typescript-eslint/return-await': "error",
|
|
160
|
-
'@typescript-eslint/semi': "warn",
|
|
161
|
-
'@typescript-eslint/space-before-blocks': ["warn", "never"],
|
|
162
|
-
'@typescript-eslint/space-before-function-paren': ["warn", { anonymous: "never", named: "never", asyncArrow: "always" }],
|
|
163
191
|
// TSLint rules - errors
|
|
164
192
|
'@typescript-eslint/adjacent-overload-signatures': "error",
|
|
165
193
|
'@typescript-eslint/consistent-indexed-object-style': "error",
|
|
@@ -171,11 +199,11 @@ exports.default = {
|
|
|
171
199
|
'@typescript-eslint/no-extra-non-null-assertion': "error",
|
|
172
200
|
'@typescript-eslint/no-misused-new': "error",
|
|
173
201
|
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': "error",
|
|
174
|
-
'@typescript-eslint/no-parameter-properties': "error",
|
|
175
202
|
'@typescript-eslint/no-this-alias': "error",
|
|
176
203
|
'@typescript-eslint/no-unnecessary-type-constraint': "error",
|
|
177
204
|
'@typescript-eslint/no-unsafe-call': "error",
|
|
178
205
|
'@typescript-eslint/no-useless-empty-export': "error",
|
|
206
|
+
'@typescript-eslint/parameter-properties': "error",
|
|
179
207
|
'@typescript-eslint/prefer-literal-enum-member': "error",
|
|
180
208
|
'@typescript-eslint/restrict-plus-operands': "error",
|
|
181
209
|
// TSLint rules - warnings
|
|
@@ -186,18 +214,6 @@ exports.default = {
|
|
|
186
214
|
assertionStyle: "as",
|
|
187
215
|
objectLiteralTypeAssertions: "allow"
|
|
188
216
|
}],
|
|
189
|
-
'@typescript-eslint/member-delimiter-style': ["warn", {
|
|
190
|
-
overrides: {
|
|
191
|
-
interface: {
|
|
192
|
-
singleline: { delimiter: "semi", requireLast: true },
|
|
193
|
-
multiline: { delimiter: "semi", requireLast: true }
|
|
194
|
-
},
|
|
195
|
-
typeLiteral: {
|
|
196
|
-
singleline: { delimiter: "comma", requireLast: false },
|
|
197
|
-
multiline: { delimiter: "comma", requireLast: false }
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}],
|
|
201
217
|
'@typescript-eslint/no-base-to-string': "warn",
|
|
202
218
|
'@typescript-eslint/no-empty-interface': "warn",
|
|
203
219
|
'@typescript-eslint/no-misused-promises': ["warn", { checksVoidReturn: false }],
|
|
@@ -246,7 +262,7 @@ exports.default = {
|
|
|
246
262
|
'react/require-optimization': "warn",
|
|
247
263
|
'react/self-closing-comp': "warn",
|
|
248
264
|
'react/void-dom-elements-no-children': "error",
|
|
249
|
-
// Import rules
|
|
265
|
+
// Import rules (incompatible with eslint 9)
|
|
250
266
|
'import/first': "error",
|
|
251
267
|
'import/order': [
|
|
252
268
|
"warn",
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var path_1 = require("path");
|
|
|
4
4
|
var all_1 = require("./configs/all");
|
|
5
5
|
var rules = (0, fs_1.readdirSync)((0, path_1.resolve)(__dirname, "rules"));
|
|
6
6
|
var fileNamePattern = /^(.+)\.js$/;
|
|
7
|
-
|
|
7
|
+
var plugin = {
|
|
8
8
|
rules: rules.reduce(function (pv, v) {
|
|
9
9
|
var chunk = v.match(fileNamePattern);
|
|
10
10
|
if (!chunk)
|
|
@@ -16,3 +16,5 @@ module.exports = {
|
|
|
16
16
|
all: all_1.default
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
+
Object.assign(all_1.default.plugins, { '@daldalso': plugin });
|
|
20
|
+
module.exports = plugin;
|
|
@@ -159,7 +159,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
159
159
|
};
|
|
160
160
|
};
|
|
161
161
|
var getCurrentDepth = function (me) {
|
|
162
|
-
var ancestors =
|
|
162
|
+
var ancestors = sourceCode.getAncestors(me);
|
|
163
163
|
var R = 0;
|
|
164
164
|
for (var i = 0; i < ancestors.length; i++) {
|
|
165
165
|
var v = ancestors[i];
|
|
@@ -38,7 +38,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
var ast_spec_1 = require("@typescript-eslint/types/dist/generated/ast-spec");
|
|
42
41
|
var utils_1 = require("@typescript-eslint/utils");
|
|
43
42
|
var patterns_1 = require("../utils/patterns");
|
|
44
43
|
var OBJECT_OR_ARRAY_TYPES = [
|
|
@@ -89,7 +88,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
89
88
|
if (shouldBeSpaced === void 0) { shouldBeSpaced = false; }
|
|
90
89
|
var opener;
|
|
91
90
|
var payload;
|
|
92
|
-
if (from.type in
|
|
91
|
+
if (from.type in utils_1.AST_TOKEN_TYPES) {
|
|
93
92
|
_a = [from, sourceCode.getTokenAfter(from)], opener = _a[0], payload = _a[1];
|
|
94
93
|
}
|
|
95
94
|
else {
|
|
@@ -125,7 +124,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
125
124
|
if (shouldBeSpaced === void 0) { shouldBeSpaced = false; }
|
|
126
125
|
var payload;
|
|
127
126
|
var closer;
|
|
128
|
-
if (from.type in
|
|
127
|
+
if (from.type in utils_1.AST_TOKEN_TYPES) {
|
|
129
128
|
_a = [sourceCode.getTokenBefore(from), from], payload = _a[0], closer = _a[1];
|
|
130
129
|
}
|
|
131
130
|
else if ('typeAnnotation' in from && from.typeAnnotation) {
|
|
@@ -57,8 +57,8 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
57
57
|
return "".concat(scope.block.range[0], ",").concat(scope.block.range[1], "/").concat(name);
|
|
58
58
|
};
|
|
59
59
|
return {
|
|
60
|
-
Program: function () {
|
|
61
|
-
var variables = getReassignedVariables(
|
|
60
|
+
Program: function (node) {
|
|
61
|
+
var variables = getReassignedVariables(sourceCode.getScope(node));
|
|
62
62
|
for (var _i = 0, variables_1 = variables; _i < variables_1.length; _i++) {
|
|
63
63
|
var v = variables_1[_i];
|
|
64
64
|
reassignedIdentifierTable[getKey(v)] = true;
|
|
@@ -68,7 +68,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
68
68
|
if (node.kind !== "let") {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
var scope =
|
|
71
|
+
var scope = sourceCode.getScope(node);
|
|
72
72
|
var kindToken = sourceCode.getFirstToken(node);
|
|
73
73
|
for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) {
|
|
74
74
|
var v = _a[_i];
|
|
@@ -27,7 +27,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
var ast_spec_1 = require("@typescript-eslint/types/dist/generated/ast-spec");
|
|
31
30
|
var utils_1 = require("@typescript-eslint/utils");
|
|
32
31
|
var patterns_1 = require("../utils/patterns");
|
|
33
32
|
var type_1 = require("../utils/type");
|
|
@@ -66,7 +65,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
66
65
|
var valueishNamePattern = new RegExp(valueishNamePatternString);
|
|
67
66
|
var sourceCode = context.getSourceCode();
|
|
68
67
|
var assertStringLiteral = function (node, as, messageId) {
|
|
69
|
-
if (node.type !==
|
|
68
|
+
if (node.type !== utils_1.AST_NODE_TYPES.Literal) {
|
|
70
69
|
return;
|
|
71
70
|
}
|
|
72
71
|
if (!quotes.includes(node.raw[0])) {
|
|
@@ -127,18 +126,18 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
127
126
|
}, {});
|
|
128
127
|
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
|
|
129
128
|
var v = values_1[_i];
|
|
130
|
-
if (v.type !==
|
|
129
|
+
if (v.type !== utils_1.AST_NODE_TYPES.Property)
|
|
131
130
|
continue;
|
|
132
|
-
if (v.key.type !==
|
|
131
|
+
if (v.key.type !== utils_1.AST_NODE_TYPES.Literal)
|
|
133
132
|
continue;
|
|
134
133
|
if (typeof v.key.value !== "string")
|
|
135
134
|
continue;
|
|
136
135
|
var keySymbol = typeMap[v.key.value];
|
|
137
136
|
assertStringLiteral(v.key, 'key', 'from-keyish-usage');
|
|
138
|
-
if (keySymbol && v.value.type ===
|
|
137
|
+
if (keySymbol && v.value.type === utils_1.AST_NODE_TYPES.Literal) {
|
|
139
138
|
checkLiteral(keySymbol, v.value, true);
|
|
140
139
|
}
|
|
141
|
-
else if (v.value.type ===
|
|
140
|
+
else if (v.value.type === utils_1.AST_NODE_TYPES.ObjectExpression) {
|
|
142
141
|
checkObjectExpression((0, type_1.getTSTypeByNode)(context, v.value).getNonNullableType().getProperties(), v.value.properties);
|
|
143
142
|
}
|
|
144
143
|
}
|
|
@@ -158,7 +157,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
158
157
|
var argument = node.arguments[i];
|
|
159
158
|
var isRest = (0, type_1.isRestParameter)(context, parameter);
|
|
160
159
|
switch (argument.type) {
|
|
161
|
-
case
|
|
160
|
+
case utils_1.AST_NODE_TYPES.Literal:
|
|
162
161
|
if (!parameterIndex && isCallingEventMethod(node)) {
|
|
163
162
|
assertStringLiteral(argument, 'key', 'from-event');
|
|
164
163
|
}
|
|
@@ -166,15 +165,15 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
166
165
|
checkLiteral(parameter, argument, false, isRest);
|
|
167
166
|
}
|
|
168
167
|
break;
|
|
169
|
-
case
|
|
168
|
+
case utils_1.AST_NODE_TYPES.ConditionalExpression:
|
|
170
169
|
for (var _i = 0, _a = [argument.consequent, argument.alternate]; _i < _a.length; _i++) {
|
|
171
170
|
var w = _a[_i];
|
|
172
|
-
if (w.type !==
|
|
171
|
+
if (w.type !== utils_1.AST_NODE_TYPES.Literal)
|
|
173
172
|
continue;
|
|
174
173
|
checkLiteral(parameter, w);
|
|
175
174
|
}
|
|
176
175
|
break;
|
|
177
|
-
case
|
|
176
|
+
case utils_1.AST_NODE_TYPES.ObjectExpression:
|
|
178
177
|
checkObjectExpression((0, type_1.getTSTypeBySymbol)(context, parameter, node).getProperties(), argument.properties);
|
|
179
178
|
break;
|
|
180
179
|
}
|
|
@@ -189,17 +188,17 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
189
188
|
ObjectExpression: function (node) {
|
|
190
189
|
var _a;
|
|
191
190
|
switch ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) {
|
|
192
|
-
case
|
|
191
|
+
case utils_1.AST_NODE_TYPES.VariableDeclarator:
|
|
193
192
|
checkObjectExpression((0, type_1.getObjectProperties)(context, node.parent.id), node.properties);
|
|
194
193
|
break;
|
|
195
|
-
case
|
|
194
|
+
case utils_1.AST_NODE_TYPES.TSAsExpression:
|
|
196
195
|
checkObjectExpression((0, type_1.getObjectProperties)(context, node.parent.typeAnnotation), node.properties);
|
|
197
196
|
break;
|
|
198
197
|
}
|
|
199
198
|
},
|
|
200
199
|
TSLiteralType: function (node) {
|
|
201
200
|
var _a;
|
|
202
|
-
if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) ===
|
|
201
|
+
if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.AST_NODE_TYPES.TSIndexedAccessType) {
|
|
203
202
|
assertStringLiteral(node.literal, 'key', 'from-keyish-name');
|
|
204
203
|
return;
|
|
205
204
|
}
|
|
@@ -207,11 +206,11 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
207
206
|
v: for (var _i = 0, _b = context.getAncestors().reverse(); _i < _b.length; _i++) {
|
|
208
207
|
var v = _b[_i];
|
|
209
208
|
switch (v.type) {
|
|
210
|
-
case
|
|
209
|
+
case utils_1.AST_NODE_TYPES.TSPropertySignature:
|
|
211
210
|
fromGeneric = false;
|
|
212
211
|
break v;
|
|
213
|
-
case
|
|
214
|
-
case
|
|
212
|
+
case utils_1.AST_NODE_TYPES.TSTypeParameter:
|
|
213
|
+
case utils_1.AST_NODE_TYPES.TSTypeParameterInstantiation:
|
|
215
214
|
fromGeneric = true;
|
|
216
215
|
break v;
|
|
217
216
|
}
|
|
@@ -230,11 +229,11 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
230
229
|
}
|
|
231
230
|
});
|
|
232
231
|
function isCallingEventMethod(node) {
|
|
233
|
-
if (node.type !==
|
|
232
|
+
if (node.type !== utils_1.AST_NODE_TYPES.CallExpression)
|
|
234
233
|
return false;
|
|
235
|
-
if (node.callee.type !==
|
|
234
|
+
if (node.callee.type !== utils_1.AST_NODE_TYPES.MemberExpression)
|
|
236
235
|
return false;
|
|
237
|
-
if (node.callee.property.type !==
|
|
236
|
+
if (node.callee.property.type !== utils_1.AST_NODE_TYPES.Identifier)
|
|
238
237
|
return false;
|
|
239
238
|
return eventMethodNames.includes(node.callee.property.name);
|
|
240
239
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daldalso/eslint-plugin",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "git+https://github.com/JJoriping/eslint-plugin.git"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc -b",
|
|
12
12
|
"watch": "tsc --watch",
|
|
13
|
-
"test": "eslint --parser-options
|
|
13
|
+
"test": "eslint --parser-options project:./test.tsconfig.json"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"/LICENSE",
|
|
@@ -19,22 +19,25 @@
|
|
|
19
19
|
],
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@daldalso/eslint-plugin": "link:.",
|
|
22
|
+
"@types/eslint": "^9.6.0",
|
|
22
23
|
"@types/node": "^18.0.0",
|
|
23
24
|
"@types/react": "^18.0.0",
|
|
24
|
-
"eslint": "^
|
|
25
|
+
"eslint": "^9"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@typescript-eslint/
|
|
30
|
-
"@typescript-eslint/
|
|
28
|
+
"@eslint/compat": "^1.1.1",
|
|
29
|
+
"@stylistic/eslint-plugin-ts": "^2.6.2",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^8.1.0",
|
|
31
|
+
"@typescript-eslint/parser": "^8.1.0",
|
|
32
|
+
"@typescript-eslint/types": "^8.1.0",
|
|
33
|
+
"@typescript-eslint/utils": "^8.1.0",
|
|
31
34
|
"eslint-plugin-import": "^2",
|
|
32
35
|
"eslint-plugin-react": "^7",
|
|
33
|
-
"eslint-plugin-react-hooks": "
|
|
36
|
+
"eslint-plugin-react-hooks": "5.1.0-beta-26f2496093-20240514",
|
|
34
37
|
"eslint-plugin-unicorn": "*",
|
|
35
38
|
"typescript": "^5"
|
|
36
39
|
},
|
|
37
40
|
"peerDependencies": {
|
|
38
|
-
"eslint": "^
|
|
41
|
+
"eslint": "^9"
|
|
39
42
|
}
|
|
40
43
|
}
|