eslint-plugin-raflint 1.0.4 → 1.2.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/bundle.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
rules: {
|
|
3
|
+
'no-conditional-object-spread': {
|
|
4
|
+
create(context) {
|
|
5
|
+
return {
|
|
6
|
+
SpreadElement(node) {
|
|
7
|
+
if (node.argument.type === 'ConditionalExpression' || node.argument.type === 'LogicalExpression') {
|
|
8
|
+
context.report({
|
|
9
|
+
node,
|
|
10
|
+
message: 'Conditional object spread is not allowed.',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import noConditionalObjectSpread from './rules/noConditionalObjectSpread.js';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
3
4
|
rules: {
|
|
4
|
-
'no-conditional-object-spread':
|
|
5
|
+
'no-conditional-object-spread': noConditionalObjectSpread,
|
|
5
6
|
},
|
|
6
7
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-raflint",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "",
|
|
5
|
-
"
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"require": "./dist/bundle.cjs",
|
|
8
|
+
"import": "./index.js"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
6
11
|
"scripts": {
|
|
7
12
|
"prepare": "husky install",
|
|
8
13
|
"jest": "SILENT=1 node --no-warnings --experimental-vm-modules ./node_modules/.bin/jest",
|
|
@@ -18,14 +23,14 @@
|
|
|
18
23
|
},
|
|
19
24
|
"dependencies": {
|
|
20
25
|
"@babel/eslint-parser": "^7.22.5",
|
|
21
|
-
"c8": "^
|
|
22
|
-
"eslint": "^8.
|
|
26
|
+
"c8": "^8.0.0",
|
|
27
|
+
"eslint": "^8.43.0",
|
|
23
28
|
"eslint-plugin-import": "^2.27.5",
|
|
24
29
|
"eslint-plugin-n": "^16.0.0",
|
|
25
30
|
"eslint-plugin-promise": "^6.1.1",
|
|
26
31
|
"eslint-plugin-sonarjs": "^0.19.0",
|
|
27
32
|
"eslint-plugin-unicorn": "^47.0.0",
|
|
28
|
-
"html-validate": "^8.0.
|
|
33
|
+
"html-validate": "^8.0.5",
|
|
29
34
|
"husky": "^8.0.3",
|
|
30
35
|
"jest": "^29.5.0",
|
|
31
36
|
"lint-staged": "^13.2.2",
|
|
@@ -33,6 +38,10 @@
|
|
|
33
38
|
"prettier": "^2.8.8"
|
|
34
39
|
},
|
|
35
40
|
"devDependencies": {
|
|
36
|
-
"eslint-plugin-raflint": "^1.0.
|
|
37
|
-
}
|
|
41
|
+
"eslint-plugin-raflint": "^1.0.5"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=17.0.0"
|
|
45
|
+
},
|
|
46
|
+
"type": "module"
|
|
38
47
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { RuleTester } from 'eslint';
|
|
2
|
+
import noConditionalObjectSpread from '../rules/noConditionalObjectSpread.js';
|
|
3
|
+
import path, { dirname } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
3
6
|
|
|
4
7
|
const ruleTester = new RuleTester({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
8
|
+
parser: `${__dirname}/../node_modules/@babel/eslint-parser`,
|
|
9
|
+
parserOptions: {
|
|
10
|
+
ecmaVersion: 'latest',
|
|
11
|
+
sourceType: 'module',
|
|
12
|
+
requireConfigFile: false,
|
|
13
|
+
},
|
|
11
14
|
});
|
|
12
15
|
|
|
13
16
|
ruleTester.run('no-conditional-object-spread', noConditionalObjectSpread, {
|
|
@@ -18,7 +21,7 @@ ruleTester.run('no-conditional-object-spread', noConditionalObjectSpread, {
|
|
|
18
21
|
const obj = {};
|
|
19
22
|
if (condition) obj.prop = value;
|
|
20
23
|
`,
|
|
21
|
-
}
|
|
24
|
+
},
|
|
22
25
|
],
|
|
23
26
|
invalid: [
|
|
24
27
|
{
|
|
@@ -36,6 +39,6 @@ ruleTester.run('no-conditional-object-spread', noConditionalObjectSpread, {
|
|
|
36
39
|
};
|
|
37
40
|
`,
|
|
38
41
|
errors: [{ message: 'Conditional object spread is not allowed.' }],
|
|
39
|
-
}
|
|
40
|
-
]
|
|
42
|
+
},
|
|
43
|
+
],
|
|
41
44
|
});
|