eslint-plugin-absolute 0.2.6 → 0.2.8
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.js +20 -0
- package/package.json +6 -1
- package/.absolutejs/eslint.cache.json +0 -45
- package/.absolutejs/prettier.cache.json +0 -49
- package/.absolutejs/tsconfig.tsbuildinfo +0 -1
- package/.claude/settings.local.json +0 -10
- package/.codex +0 -0
- package/.prettierignore +0 -4
- package/.prettierrc.json +0 -8
- package/eslint.config.mjs +0 -107
- package/src/index.ts +0 -45
- package/src/rules/explicit-object-types.ts +0 -75
- package/src/rules/inline-style-limit.ts +0 -88
- package/src/rules/localize-react-props.ts +0 -454
- package/src/rules/max-depth-extended.ts +0 -153
- package/src/rules/max-jsx-nesting.ts +0 -59
- package/src/rules/min-var-length.ts +0 -360
- package/src/rules/no-button-navigation.ts +0 -270
- package/src/rules/no-explicit-return-types.ts +0 -83
- package/src/rules/no-inline-prop-types.ts +0 -68
- package/src/rules/no-multi-style-objects.ts +0 -80
- package/src/rules/no-nested-jsx-return.ts +0 -205
- package/src/rules/no-or-none-component.ts +0 -63
- package/src/rules/no-transition-cssproperties.ts +0 -131
- package/src/rules/no-unnecessary-div.ts +0 -65
- package/src/rules/no-unnecessary-key.ts +0 -111
- package/src/rules/no-useless-function.ts +0 -56
- package/src/rules/seperate-style-files.ts +0 -79
- package/src/rules/sort-exports.ts +0 -581
- package/src/rules/sort-keys-fixable.ts +0 -1244
- package/src/rules/spring-naming-convention.ts +0 -160
- package/tsconfig.json +0 -17
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { TSESLint, TSESTree } from "@typescript-eslint/utils";
|
|
2
|
-
|
|
3
|
-
type Options = [];
|
|
4
|
-
type MessageIds =
|
|
5
|
-
| "firstMustEndWithSprings"
|
|
6
|
-
| "firstMustHaveBase"
|
|
7
|
-
| "secondMustMatch"
|
|
8
|
-
| "pluralRequired";
|
|
9
|
-
|
|
10
|
-
const SPRINGS_SUFFIX = "Springs";
|
|
11
|
-
|
|
12
|
-
const checkUseSpring = (
|
|
13
|
-
context: TSESLint.RuleContext<MessageIds, Options>,
|
|
14
|
-
firstElem: TSESTree.Identifier,
|
|
15
|
-
secondElem: TSESTree.Identifier
|
|
16
|
-
) => {
|
|
17
|
-
const firstName = firstElem.name;
|
|
18
|
-
const secondName = secondElem.name;
|
|
19
|
-
|
|
20
|
-
if (!firstName.endsWith(SPRINGS_SUFFIX)) {
|
|
21
|
-
context.report({
|
|
22
|
-
messageId: "firstMustEndWithSprings",
|
|
23
|
-
node: firstElem
|
|
24
|
-
});
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const base = firstName.slice(0, -SPRINGS_SUFFIX.length);
|
|
29
|
-
if (!base) {
|
|
30
|
-
context.report({
|
|
31
|
-
messageId: "firstMustHaveBase",
|
|
32
|
-
node: firstElem
|
|
33
|
-
});
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const expectedSecond = `${base}Api`;
|
|
38
|
-
if (secondName !== expectedSecond) {
|
|
39
|
-
context.report({
|
|
40
|
-
data: { expected: expectedSecond },
|
|
41
|
-
messageId: "secondMustMatch",
|
|
42
|
-
node: secondElem
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const checkUseSprings = (
|
|
48
|
-
context: TSESLint.RuleContext<MessageIds, Options>,
|
|
49
|
-
firstElem: TSESTree.Identifier,
|
|
50
|
-
secondElem: TSESTree.Identifier
|
|
51
|
-
) => {
|
|
52
|
-
const firstName = firstElem.name;
|
|
53
|
-
const secondName = secondElem.name;
|
|
54
|
-
|
|
55
|
-
if (!firstName.endsWith(SPRINGS_SUFFIX)) {
|
|
56
|
-
context.report({
|
|
57
|
-
messageId: "firstMustEndWithSprings",
|
|
58
|
-
node: firstElem
|
|
59
|
-
});
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const basePlural = firstName.slice(0, -SPRINGS_SUFFIX.length);
|
|
64
|
-
if (!basePlural) {
|
|
65
|
-
context.report({
|
|
66
|
-
messageId: "firstMustHaveBase",
|
|
67
|
-
node: firstElem
|
|
68
|
-
});
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (!basePlural.endsWith("s")) {
|
|
73
|
-
context.report({
|
|
74
|
-
messageId: "pluralRequired",
|
|
75
|
-
node: firstElem
|
|
76
|
-
});
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const expectedSecond = `${basePlural}Api`;
|
|
81
|
-
if (secondName !== expectedSecond) {
|
|
82
|
-
context.report({
|
|
83
|
-
data: { expected: expectedSecond },
|
|
84
|
-
messageId: "secondMustMatch",
|
|
85
|
-
node: secondElem
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export const springNamingConvention: TSESLint.RuleModule<MessageIds, Options> =
|
|
91
|
-
{
|
|
92
|
-
create(context) {
|
|
93
|
-
return {
|
|
94
|
-
VariableDeclarator(node: TSESTree.VariableDeclarator) {
|
|
95
|
-
const { init } = node;
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
!init ||
|
|
99
|
-
init.type !== "CallExpression" ||
|
|
100
|
-
init.callee.type !== "Identifier"
|
|
101
|
-
) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const hookName = init.callee.name;
|
|
106
|
-
if (hookName !== "useSpring" && hookName !== "useSprings") {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (node.id.type !== "ArrayPattern") {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const { elements } = node.id;
|
|
115
|
-
if (elements.length < 2) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const [firstElem, secondElem] = elements;
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
!firstElem ||
|
|
123
|
-
firstElem.type !== "Identifier" ||
|
|
124
|
-
!secondElem ||
|
|
125
|
-
secondElem.type !== "Identifier"
|
|
126
|
-
) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (hookName === "useSpring") {
|
|
131
|
-
checkUseSpring(context, firstElem, secondElem);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (hookName === "useSprings") {
|
|
136
|
-
checkUseSprings(context, firstElem, secondElem);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
defaultOptions: [],
|
|
142
|
-
meta: {
|
|
143
|
-
docs: {
|
|
144
|
-
description:
|
|
145
|
-
"Enforce correct naming for useSpring and useSprings hook destructuring"
|
|
146
|
-
},
|
|
147
|
-
messages: {
|
|
148
|
-
firstMustEndWithSprings:
|
|
149
|
-
"The first variable must end with 'Springs'.",
|
|
150
|
-
firstMustHaveBase:
|
|
151
|
-
"The first variable must have a non-empty name before 'Springs'.",
|
|
152
|
-
pluralRequired:
|
|
153
|
-
"The first variable for useSprings should be plural (ending with 's') before 'Springs'.",
|
|
154
|
-
secondMustMatch:
|
|
155
|
-
"The second variable must be named '{{expected}}'."
|
|
156
|
-
},
|
|
157
|
-
schema: [],
|
|
158
|
-
type: "problem"
|
|
159
|
-
}
|
|
160
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"esModuleInterop": true,
|
|
4
|
-
"forceConsistentCasingInFileNames": true,
|
|
5
|
-
"incremental": true,
|
|
6
|
-
"jsx": "react-jsx",
|
|
7
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
8
|
-
"module": "ESNext",
|
|
9
|
-
"moduleResolution": "bundler",
|
|
10
|
-
"noUncheckedIndexedAccess": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"strict": true,
|
|
13
|
-
"target": "ESNext",
|
|
14
|
-
"tsBuildInfoFile": ".absolutejs/tsconfig.tsbuildinfo",
|
|
15
|
-
"types": ["bun-types"]
|
|
16
|
-
}
|
|
17
|
-
}
|