eslint-plugin-ziloen 0.0.108 → 0.0.110

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.cjs CHANGED
@@ -7,7 +7,7 @@ const createEslintRule = utils.ESLintUtils.RuleCreator((ruleName) => ruleName);
7
7
 
8
8
  const RULE_NAME$1 = "generic-spacing";
9
9
  const messageId = "genericSpacingMismatch";
10
- function spacingAround(node, context) {
10
+ function removeSpaceAround(node, context) {
11
11
  const params = node.params;
12
12
  if (!params.length)
13
13
  return;
@@ -24,6 +24,13 @@ function spacingAround(node, context) {
24
24
  messageId,
25
25
  *fix(fixer) {
26
26
  yield fixer.replaceTextRange([start, startNode.range[0]], "");
27
+ },
28
+ loc: {
29
+ start: {
30
+ column: node.loc.start.column + 1,
31
+ line: node.loc.start.line
32
+ },
33
+ end: startNode.loc.start
27
34
  }
28
35
  });
29
36
  }
@@ -62,8 +69,11 @@ const genericSpacing = createEslintRule({
62
69
  create(context) {
63
70
  const sourceCode = context.sourceCode;
64
71
  return {
65
- TSTypeParameterDeclaration: (node) => spacingAround(node, context),
66
- TSTypeParameterInstantiation: (node) => spacingAround(node, context),
72
+ // type T<"K, S"> = any
73
+ TSTypeParameterDeclaration: (node) => removeSpaceAround(node, context),
74
+ // type T = Record<"K, S">
75
+ TSTypeParameterInstantiation: (node) => removeSpaceAround(node, context),
76
+ // type T<"K = any", "S = any"> = any
67
77
  TSTypeParameter(node) {
68
78
  if (!node.default)
69
79
  return;
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ const createEslintRule = ESLintUtils.RuleCreator((ruleName) => ruleName);
5
5
 
6
6
  const RULE_NAME$1 = "generic-spacing";
7
7
  const messageId = "genericSpacingMismatch";
8
- function spacingAround(node, context) {
8
+ function removeSpaceAround(node, context) {
9
9
  const params = node.params;
10
10
  if (!params.length)
11
11
  return;
@@ -22,6 +22,13 @@ function spacingAround(node, context) {
22
22
  messageId,
23
23
  *fix(fixer) {
24
24
  yield fixer.replaceTextRange([start, startNode.range[0]], "");
25
+ },
26
+ loc: {
27
+ start: {
28
+ column: node.loc.start.column + 1,
29
+ line: node.loc.start.line
30
+ },
31
+ end: startNode.loc.start
25
32
  }
26
33
  });
27
34
  }
@@ -60,8 +67,11 @@ const genericSpacing = createEslintRule({
60
67
  create(context) {
61
68
  const sourceCode = context.sourceCode;
62
69
  return {
63
- TSTypeParameterDeclaration: (node) => spacingAround(node, context),
64
- TSTypeParameterInstantiation: (node) => spacingAround(node, context),
70
+ // type T<"K, S"> = any
71
+ TSTypeParameterDeclaration: (node) => removeSpaceAround(node, context),
72
+ // type T = Record<"K, S">
73
+ TSTypeParameterInstantiation: (node) => removeSpaceAround(node, context),
74
+ // type T<"K = any", "S = any"> = any
65
75
  TSTypeParameter(node) {
66
76
  if (!node.default)
67
77
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-ziloen",
3
- "version": "0.0.108",
3
+ "version": "0.0.110",
4
4
  "author": "ziloen",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ziloen/eslint-config",
@@ -10,15 +10,15 @@
10
10
  "dist"
11
11
  ],
12
12
  "dependencies": {
13
- "@typescript-eslint/utils": "^6.7.0",
13
+ "@typescript-eslint/utils": "^6.7.5",
14
14
  "typescript": "^5.2.2"
15
15
  },
16
16
  "devDependencies": {
17
- "@types/node": "^20.6.0",
18
- "@typescript-eslint/rule-tester": "^6.7.0",
19
- "rimraf": "^5.0.1",
17
+ "@types/node": "^20.8.4",
18
+ "@typescript-eslint/rule-tester": "^6.7.5",
19
+ "rimraf": "^5.0.5",
20
20
  "unbuild": "^2.0.0",
21
- "vitest": "^0.34.4"
21
+ "vitest": "^0.34.6"
22
22
  },
23
23
  "scripts": {
24
24
  "build": "rimraf dist && unbuild",