eslint-plugin-raflint 1.5.6 → 1.5.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.
@@ -1,4 +1,3 @@
1
- const MESSAGE = 'Conditional object spread is not allowed.';
2
1
  const rule = {
3
2
  meta: {
4
3
  type: 'suggestion',
@@ -6,13 +5,16 @@ const rule = {
6
5
  description: 'Disallow conditional object spread (`...(cond ? a : b)` / `...(cond && a)`) in favor of explicit branching',
7
6
  recommended: true,
8
7
  },
8
+ messages: {
9
+ noConditionalObjectSpread: 'Conditional object spread is not allowed.',
10
+ },
9
11
  schema: [],
10
12
  },
11
13
  create(context) {
12
14
  return {
13
15
  SpreadElement(node) {
14
16
  if (node.argument.type === 'ConditionalExpression' || node.argument.type === 'LogicalExpression') {
15
- context.report({ node, message: MESSAGE });
17
+ context.report({ node, messageId: 'noConditionalObjectSpread' });
16
18
  }
17
19
  },
18
20
  };
@@ -1,6 +1,6 @@
1
- // Le backslash doit etre echappe en premier, sinon il redouble ceux ajoutes ensuite.
2
- const escapeTemplateLiteral = (value) => value.replaceAll('\\', '\\\\').replaceAll('`', '\\`').replaceAll('${', '\\${');
3
- const MESSAGE = 'Use a template string instead of path.join() for simple path concatenation';
1
+ // Le backslash doit etre echappe en premier, sinon il redouble ceux ajoutes ensuite. Un CR brut dans un
2
+ // template litteral est normalise en LF par le moteur : il doit repartir en sequence `\r` pour garder sa valeur.
3
+ const escapeTemplateLiteral = (value) => value.replaceAll('\\', '\\\\').replaceAll('`', '\\`').replaceAll('${', '\\${').replaceAll('\r', '\\r');
4
4
  const isPathJoinCall = (node) => node.callee.type === 'MemberExpression' &&
5
5
  !node.callee.computed &&
6
6
  node.callee.object.type === 'Identifier' &&
@@ -16,6 +16,9 @@ const rule = {
16
16
  recommended: true,
17
17
  },
18
18
  fixable: 'code',
19
+ messages: {
20
+ noPathJoin: 'Use a template string instead of path.join() for simple path concatenation',
21
+ },
19
22
  schema: [],
20
23
  },
21
24
  create(context) {
@@ -26,7 +29,7 @@ const rule = {
26
29
  }
27
30
  // Un spread ne peut pas être interpolé (`${...parts}` est une erreur de syntaxe) : on signale sans corriger.
28
31
  if (node.arguments.some((argument) => argument.type === 'SpreadElement')) {
29
- context.report({ node, message: MESSAGE });
32
+ context.report({ node, messageId: 'noPathJoin' });
30
33
  return;
31
34
  }
32
35
  const parts = node.arguments.map((argument) => {
@@ -38,7 +41,7 @@ const rule = {
38
41
  const replacement = `\`${parts.join('/')}\``;
39
42
  context.report({
40
43
  node,
41
- message: MESSAGE,
44
+ messageId: 'noPathJoin',
42
45
  fix: (fixer) => fixer.replaceText(node, replacement),
43
46
  });
44
47
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-raflint",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -24,13 +24,8 @@
24
24
  "prepublishOnly": "npm run build",
25
25
  "test": "SILENT=1 mocha --timeout 60000 {,lib/**/,src/lib/**/,test/**/}*.test.ts"
26
26
  },
27
- "dependencies": {
28
- "@babel/eslint-parser": "^8.0.1",
29
- "eslint-plugin-n": "^18.3.0",
30
- "eslint-plugin-sonarjs": "^4.2.0",
31
- "eslint-plugin-unicorn": "^74.0.0"
32
- },
33
27
  "devDependencies": {
28
+ "@babel/eslint-parser": "^8.0.1",
34
29
  "@eslint/js": "^10.0.1",
35
30
  "@stoplight/spectral-cli": "^6.16.3",
36
31
  "c8": "^12.0.0",
@@ -38,19 +33,22 @@
38
33
  "eslint-config-prettier": "^10.1.8",
39
34
  "eslint-import-resolver-typescript": "^4.4.5",
40
35
  "eslint-plugin-import-x": "^4.17.1",
36
+ "eslint-plugin-n": "^18.3.0",
41
37
  "eslint-plugin-promise": "^7.3.0",
42
- "eslint-plugin-raflint": "^1.5.2",
38
+ "eslint-plugin-raflint": "^1.5.7",
43
39
  "eslint-plugin-react-hooks": "^7.1.1",
44
- "globals": "^17.11.0",
40
+ "eslint-plugin-sonarjs": "^4.2.0",
41
+ "eslint-plugin-unicorn": "^74.0.0",
42
+ "globals": "^17.12.0",
45
43
  "husky": "^9.1.7",
46
- "lint-staged": "^17.4.1",
44
+ "lint-staged": "^17.5.0",
47
45
  "markdownlint": "^0.41.1",
48
- "mocha": "^11.8.0",
46
+ "mocha": "^12.0.0",
49
47
  "prettier": "^3.9.6",
50
48
  "ts-api-utils": "^2.5.0",
51
49
  "tsx": "^4.23.13",
52
50
  "typescript": "^6.0.3",
53
- "typescript-eslint": "^8.68.0"
51
+ "typescript-eslint": "^8.69.0"
54
52
  },
55
53
  "engines": {
56
54
  "node": ">=21.0.0"