eslint-config-typed 4.3.1 → 4.4.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/dist/plugins/immer-coding-style/rules/prefer-curried-produce.d.mts.map +1 -1
- package/dist/plugins/immer-coding-style/rules/prefer-curried-produce.mjs +1 -2
- package/dist/plugins/immer-coding-style/rules/prefer-curried-produce.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/import-style.mjs +2 -2
- package/dist/plugins/react-coding-style/rules/import-style.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/props-type-annotation-style.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/props-type-annotation-style.mjs +2 -4
- package/dist/plugins/react-coding-style/rules/props-type-annotation-style.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.mjs +1 -2
- package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/common.d.mts +3 -1
- package/dist/plugins/total-functions/rules/common.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-enums.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-enums.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-hidden-type-assertions.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-hidden-type-assertions.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-nested-fp-ts-effects.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-nested-fp-ts-effects.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-array-reduce.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-partial-array-reduce.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-division.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-partial-division.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-string-normalize.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-partial-string-normalize.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-url-constructor.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-partial-url-constructor.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-url-constructor.mjs +3 -6
- package/dist/plugins/total-functions/rules/no-partial-url-constructor.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-premature-fp-ts-effects.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-premature-fp-ts-effects.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-enum-assignment.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-unsafe-enum-assignment.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-mutable-readonly-assignment.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-unsafe-mutable-readonly-assignment.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-optional-property-assignment.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-unsafe-optional-property-assignment.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-readonly-mutable-assignment.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-unsafe-readonly-mutable-assignment.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-type-assertion.d.mts +3 -1
- package/dist/plugins/total-functions/rules/no-unsafe-type-assertion.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/require-strict-mode.d.mts +3 -1
- package/dist/plugins/total-functions/rules/require-strict-mode.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/rules.d.mts +42 -14
- package/dist/plugins/total-functions/rules/rules.d.mts.map +1 -1
- package/dist/plugins/ts-data-forge/rules/prefer-range-for-loop.d.mts.map +1 -1
- package/dist/plugins/ts-data-forge/rules/prefer-range-for-loop.mjs +2 -4
- package/dist/plugins/ts-data-forge/rules/prefer-range-for-loop.mjs.map +1 -1
- package/dist/rules/eslint-jest-rules.d.mts +1 -0
- package/dist/rules/eslint-jest-rules.d.mts.map +1 -1
- package/dist/rules/eslint-jest-rules.mjs +1 -0
- package/dist/rules/eslint-jest-rules.mjs.map +1 -1
- package/dist/rules/eslint-vitest-rules.d.mts +1 -0
- package/dist/rules/eslint-vitest-rules.d.mts.map +1 -1
- package/dist/rules/eslint-vitest-rules.mjs +1 -0
- package/dist/rules/eslint-vitest-rules.mjs.map +1 -1
- package/dist/types/rules/eslint-jest-rules.d.mts +87 -70
- package/dist/types/rules/eslint-jest-rules.d.mts.map +1 -1
- package/dist/types/rules/eslint-vitest-rules.d.mts +18 -0
- package/dist/types/rules/eslint-vitest-rules.d.mts.map +1 -1
- package/dist/types/rules/typescript-eslint-rules.d.mts +0 -1
- package/dist/types/rules/typescript-eslint-rules.d.mts.map +1 -1
- package/package.json +14 -14
- package/src/plugins/immer-coding-style/rules/prefer-curried-produce.mts +1 -2
- package/src/plugins/react-coding-style/rules/import-style.mts +2 -2
- package/src/plugins/react-coding-style/rules/props-type-annotation-style.mts +2 -8
- package/src/plugins/react-coding-style/rules/react-memo-props-argument-name.mts +1 -4
- package/src/plugins/strict-dependencies/rules/resolve-import-path.test.mts +3 -3
- package/src/plugins/total-functions/rules/no-partial-url-constructor.mts +3 -6
- package/src/plugins/ts-data-forge/rules/prefer-range-for-loop.mts +2 -4
- package/src/rules/eslint-jest-rules.mts +1 -0
- package/src/rules/eslint-vitest-rules.mts +1 -0
- package/src/types/rules/eslint-jest-rules.mts +88 -70
- package/src/types/rules/eslint-vitest-rules.mts +19 -0
- package/src/types/rules/typescript-eslint-rules.mts +0 -1
|
@@ -84,8 +84,8 @@ export const importStyleRule: TSESLint.RuleModule<MessageIds, Options> = {
|
|
|
84
84
|
const [firstSpecifier] = node.specifiers;
|
|
85
85
|
|
|
86
86
|
if (
|
|
87
|
-
firstSpecifier
|
|
88
|
-
|
|
87
|
+
firstSpecifier?.type !==
|
|
88
|
+
AST_NODE_TYPES.ImportNamespaceSpecifier ||
|
|
89
89
|
node.specifiers.length !== 1
|
|
90
90
|
) {
|
|
91
91
|
context.report({
|
|
@@ -31,19 +31,13 @@ export const propsTypeAnnotationStyleRule: TSESLint.RuleModule<MessageIds> = {
|
|
|
31
31
|
|
|
32
32
|
const arrowFunction = getReactMemoArrowFunction(node);
|
|
33
33
|
|
|
34
|
-
if (
|
|
35
|
-
arrowFunction === undefined ||
|
|
36
|
-
arrowFunction.body.type !== AST_NODE_TYPES.BlockStatement
|
|
37
|
-
) {
|
|
34
|
+
if (arrowFunction?.body.type !== AST_NODE_TYPES.BlockStatement) {
|
|
38
35
|
return;
|
|
39
36
|
}
|
|
40
37
|
|
|
41
38
|
const [firstParam] = arrowFunction.params;
|
|
42
39
|
|
|
43
|
-
if (
|
|
44
|
-
firstParam === undefined ||
|
|
45
|
-
firstParam.type !== AST_NODE_TYPES.Identifier
|
|
46
|
-
) {
|
|
40
|
+
if (firstParam?.type !== AST_NODE_TYPES.Identifier) {
|
|
47
41
|
return;
|
|
48
42
|
}
|
|
49
43
|
|
|
@@ -36,10 +36,7 @@ export const reactMemoPropsArgumentNameRule: TSESLint.RuleModule<MessageIds> = {
|
|
|
36
36
|
const arrowFunction = getReactMemoArrowFunction(node);
|
|
37
37
|
|
|
38
38
|
// Detect `React.memo<Props>(({ prop1, prop2 }) => { ... })`
|
|
39
|
-
if (
|
|
40
|
-
arrowFunction === undefined ||
|
|
41
|
-
arrowFunction.body.type !== AST_NODE_TYPES.BlockStatement
|
|
42
|
-
) {
|
|
39
|
+
if (arrowFunction?.body.type !== AST_NODE_TYPES.BlockStatement) {
|
|
43
40
|
return;
|
|
44
41
|
}
|
|
45
42
|
|
|
@@ -118,13 +118,13 @@ const useFixture = (fixtureName: FixtureName | undefined): void => {
|
|
|
118
118
|
|
|
119
119
|
const compilerOptions = compilerOptionsByFixture[fixtureName];
|
|
120
120
|
|
|
121
|
-
mockFindConfigFile.
|
|
121
|
+
mockFindConfigFile.mockReturnValue('tsconfig.json');
|
|
122
122
|
|
|
123
|
-
mockGetParsedCommandLine.
|
|
123
|
+
mockGetParsedCommandLine.mockReturnValue({
|
|
124
124
|
options: { ...compilerOptions },
|
|
125
125
|
fileNames: [],
|
|
126
126
|
errors: [],
|
|
127
|
-
})
|
|
127
|
+
});
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
const aliasCases = [
|
|
@@ -49,8 +49,7 @@ export const noPartialUrlConstructor = createRule({
|
|
|
49
49
|
) {
|
|
50
50
|
if (
|
|
51
51
|
node.arguments.length === 1 &&
|
|
52
|
-
node.arguments[0]
|
|
53
|
-
node.arguments[0].type === AST_NODE_TYPES.Literal &&
|
|
52
|
+
node.arguments[0]?.type === AST_NODE_TYPES.Literal &&
|
|
54
53
|
typeof node.arguments[0].value === 'string'
|
|
55
54
|
) {
|
|
56
55
|
if (!isValidUrl(node.arguments[0].value)) {
|
|
@@ -65,11 +64,9 @@ export const noPartialUrlConstructor = createRule({
|
|
|
65
64
|
|
|
66
65
|
if (
|
|
67
66
|
node.arguments.length === 2 &&
|
|
68
|
-
node.arguments[0]
|
|
69
|
-
node.arguments[0].type === AST_NODE_TYPES.Literal &&
|
|
67
|
+
node.arguments[0]?.type === AST_NODE_TYPES.Literal &&
|
|
70
68
|
typeof node.arguments[0].value === 'string' &&
|
|
71
|
-
node.arguments[1]
|
|
72
|
-
node.arguments[1].type === AST_NODE_TYPES.Literal &&
|
|
69
|
+
node.arguments[1]?.type === AST_NODE_TYPES.Literal &&
|
|
73
70
|
typeof node.arguments[1].value === 'string'
|
|
74
71
|
) {
|
|
75
72
|
if (!isValidUrl(node.arguments[0].value, node.arguments[1].value)) {
|
|
@@ -48,8 +48,7 @@ export const preferRangeForLoop: TSESLint.RuleModule<MessageIds, Options> = {
|
|
|
48
48
|
ForStatement: (node) => {
|
|
49
49
|
// Check init: let i = begin
|
|
50
50
|
if (
|
|
51
|
-
node.init
|
|
52
|
-
node.init.type !== AST_NODE_TYPES.VariableDeclaration ||
|
|
51
|
+
node.init?.type !== AST_NODE_TYPES.VariableDeclaration ||
|
|
53
52
|
node.init.kind !== 'let' ||
|
|
54
53
|
!Arr.isArrayOfLength(node.init.declarations, 1)
|
|
55
54
|
) {
|
|
@@ -71,8 +70,7 @@ export const preferRangeForLoop: TSESLint.RuleModule<MessageIds, Options> = {
|
|
|
71
70
|
|
|
72
71
|
// Check test: i < end
|
|
73
72
|
if (
|
|
74
|
-
node.test
|
|
75
|
-
node.test.type !== AST_NODE_TYPES.BinaryExpression ||
|
|
73
|
+
node.test?.type !== AST_NODE_TYPES.BinaryExpression ||
|
|
76
74
|
node.test.operator !== '<' ||
|
|
77
75
|
node.test.left.type !== AST_NODE_TYPES.Identifier ||
|
|
78
76
|
node.test.left.name !== varName
|
|
@@ -61,6 +61,7 @@ export const eslintVitestRules = {
|
|
|
61
61
|
'vitest/prefer-snapshot-hint': withDefaultOption('error'),
|
|
62
62
|
'vitest/prefer-spy-on': 'error',
|
|
63
63
|
'vitest/prefer-todo': 'error',
|
|
64
|
+
'vitest/prefer-mock-return-shorthand': 'error',
|
|
64
65
|
|
|
65
66
|
/* eslint-plugin-vitest specific rules */
|
|
66
67
|
|