eslint-plugin-raflint 1.5.2 → 1.5.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.
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
const MESSAGE = 'Conditional object spread is not allowed.';
|
|
1
2
|
const rule = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
message: 'Conditional object spread is not allowed.',
|
|
8
|
-
});
|
|
9
|
-
}
|
|
3
|
+
meta: {
|
|
4
|
+
type: 'suggestion',
|
|
5
|
+
docs: {
|
|
6
|
+
description: 'Disallow conditional object spread (`...(cond ? a : b)` / `...(cond && a)`) in favor of explicit branching',
|
|
7
|
+
recommended: true,
|
|
10
8
|
},
|
|
11
|
-
|
|
9
|
+
schema: [],
|
|
10
|
+
},
|
|
11
|
+
create(context) {
|
|
12
|
+
return {
|
|
13
|
+
SpreadElement(node) {
|
|
14
|
+
if (node.argument.type === 'ConditionalExpression' || node.argument.type === 'LogicalExpression') {
|
|
15
|
+
context.report({ node, message: MESSAGE });
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
},
|
|
12
20
|
};
|
|
13
21
|
export default rule;
|
package/dist/rules/noPathJoin.js
CHANGED
|
@@ -15,6 +15,7 @@ const rule = {
|
|
|
15
15
|
return {
|
|
16
16
|
CallExpression(node) {
|
|
17
17
|
if (!(node.callee.type === 'MemberExpression' &&
|
|
18
|
+
!node.callee.computed &&
|
|
18
19
|
node.callee.object.name === 'path' &&
|
|
19
20
|
node.callee.property.name === 'join' &&
|
|
20
21
|
node.arguments.length >= 2)) {
|
|
@@ -25,12 +26,11 @@ const rule = {
|
|
|
25
26
|
context.report({ node, message: MESSAGE });
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
|
-
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
29
29
|
const parts = node.arguments.map((argument) => {
|
|
30
30
|
if (argument.type === 'Literal' && typeof argument.value === 'string') {
|
|
31
31
|
return escapeTemplateLiteral(argument.value);
|
|
32
32
|
}
|
|
33
|
-
return `\${${sourceCode.getText(argument)}}`;
|
|
33
|
+
return `\${${context.sourceCode.getText(argument)}}`;
|
|
34
34
|
});
|
|
35
35
|
const replacement = `\`${parts.join('/')}\``;
|
|
36
36
|
context.report({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-raflint",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -26,30 +26,31 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@babel/eslint-parser": "^8.0.1",
|
|
29
|
-
"eslint-plugin-n": "^18.
|
|
29
|
+
"eslint-plugin-n": "^18.3.0",
|
|
30
30
|
"eslint-plugin-sonarjs": "^4.2.0",
|
|
31
|
-
"eslint-plugin-unicorn": "^
|
|
31
|
+
"eslint-plugin-unicorn": "^74.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@eslint/js": "^10.0.1",
|
|
35
|
-
"@stoplight/spectral-cli": "^6.16.
|
|
35
|
+
"@stoplight/spectral-cli": "^6.16.3",
|
|
36
36
|
"c8": "^12.0.0",
|
|
37
37
|
"eslint": "^10.5.0",
|
|
38
|
+
"eslint-config-prettier": "^10.1.8",
|
|
38
39
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
39
40
|
"eslint-plugin-import-x": "^4.17.1",
|
|
40
41
|
"eslint-plugin-promise": "^7.3.0",
|
|
41
|
-
"eslint-plugin-raflint": "^1.5.
|
|
42
|
+
"eslint-plugin-raflint": "^1.5.2",
|
|
42
43
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
43
|
-
"globals": "^17.
|
|
44
|
+
"globals": "^17.11.0",
|
|
44
45
|
"husky": "^9.1.7",
|
|
45
|
-
"lint-staged": "^17.
|
|
46
|
+
"lint-staged": "^17.4.1",
|
|
46
47
|
"markdownlint": "^0.41.1",
|
|
47
|
-
"mocha": "^11.
|
|
48
|
+
"mocha": "^11.8.0",
|
|
48
49
|
"prettier": "^3.9.6",
|
|
49
50
|
"ts-api-utils": "^2.5.0",
|
|
50
|
-
"tsx": "^4.23.
|
|
51
|
+
"tsx": "^4.23.13",
|
|
51
52
|
"typescript": "^6.0.3",
|
|
52
|
-
"typescript-eslint": "^8.
|
|
53
|
+
"typescript-eslint": "^8.68.0"
|
|
53
54
|
},
|
|
54
55
|
"engines": {
|
|
55
56
|
"node": ">=21.0.0"
|