@dfinity/eslint-config-oisy-wallet 0.2.4 → 0.3.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.
@@ -83,7 +83,6 @@ export const eslintRules = [
83
83
  "newlines-between": "never",
84
84
  },
85
85
  ],
86
- "import/no-duplicates": ["error", { "prefer-inline": true }],
87
86
  "import/no-relative-parent-imports": "error",
88
87
 
89
88
  "object-shorthand": "error",
@@ -91,6 +90,7 @@ export const eslintRules = [
91
90
  "no-console": ["error", { allow: ["error", "warn"] }],
92
91
  "no-continue": "warn",
93
92
  "no-delete-var": "error",
93
+ "no-duplicate-imports": "error",
94
94
  "no-else-return": ["warn", { allowElseIf: false }],
95
95
  "no-restricted-imports": [
96
96
  "error",
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  "no-svelte-store-in-api": require("./rules/no-svelte-store-in-api.cjs"),
3
- "use-option-type-wrapper": require("./rules/use-option-type-wrapper.cjs"),
3
+ "use-option-type-wrapper": require("./rules/use-nullish-type-wrapper.cjs"),
4
4
  "prefer-object-params": require("./rules/prefer-object-params.cjs"),
5
5
  "no-relative-imports": require("./rules/no-relative-imports.cjs"),
6
6
  "explicit-non-void-return-type": require("./rules/explicit-non-void-return-type.cjs"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfinity/eslint-config-oisy-wallet",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Shared ESLint configurations from the Oisy Wallet team",
6
6
  "repository": {
@@ -44,7 +44,8 @@
44
44
  "format:check": "prettier --check .",
45
45
  "lint": "eslint .",
46
46
  "lint:fix": "eslint --fix .",
47
- "test": "vitest --run"
47
+ "test": "vitest --run",
48
+ "update:peer": "npm update $(node -e \"const p=require('./package.json');console.log(Object.keys(p.peerDependencies).filter(d=>/eslint|prettier/.test(d)).join(' '))\")"
48
49
  },
49
50
  "keywords": [
50
51
  "eslint",
@@ -70,7 +71,6 @@
70
71
  "@typescript-eslint/eslint-plugin": "^8.56.0",
71
72
  "@vitest/eslint-plugin": "^1.6.9",
72
73
  "eslint": "^9.39.2",
73
- "eslint-config-love": "^151.0.0",
74
74
  "eslint-config-prettier": "^10.1.8",
75
75
  "eslint-plugin-import": "^2.32.0",
76
76
  "eslint-plugin-local-rules": "^3.0.2",
@@ -82,7 +82,8 @@
82
82
  "globals": "^17.3.0",
83
83
  "prettier": "^3.8.1",
84
84
  "prettier-plugin-organize-imports": "^4.3.0",
85
- "typescript": "^5"
85
+ "typescript": "^5",
86
+ "typescript-eslint": "^8.56.0"
86
87
  },
87
88
  "devDependencies": {
88
89
  "@types/node": "^25.3.0",
@@ -2,19 +2,19 @@ module.exports = {
2
2
  meta: {
3
3
  type: "suggestion",
4
4
  docs: {
5
- description: "Enforce use of Option<T> instead of T | null | undefined",
5
+ description: "Enforce use of Nullish<T> instead of T | null | undefined",
6
6
  category: "Best Practices",
7
7
  recommended: false,
8
8
  },
9
9
  messages: {
10
- useOption:
11
- "Use Option<{{ type }}> instead of {{ type }} | null | undefined.",
10
+ useNullish:
11
+ "Use Nullish<{{ type }}> instead of {{ type }} | null | undefined.",
12
12
  },
13
13
  fixable: "code",
14
14
  schema: [],
15
15
  },
16
16
  create: (context) => {
17
- const checkForOptionType = (node) => {
17
+ const checkForNullishType = (node) => {
18
18
  if (
19
19
  node.typeAnnotation.type === "TSUnionType" &&
20
20
  node.typeAnnotation.types.length === 3 &&
@@ -34,12 +34,12 @@ module.exports = {
34
34
  try {
35
35
  context.report({
36
36
  node,
37
- messageId: "useOption",
37
+ messageId: "useNullish",
38
38
  data: {
39
39
  type: typeText,
40
40
  },
41
41
  fix: (fixer) =>
42
- fixer.replaceText(node.typeAnnotation, `Option<${typeText}>`),
42
+ fixer.replaceText(node.typeAnnotation, `Nullish<${typeText}>`),
43
43
  });
44
44
  } catch (e) {
45
45
  console.error(e);
@@ -52,10 +52,10 @@ module.exports = {
52
52
 
53
53
  return {
54
54
  TSTypeAnnotation: (node) => {
55
- checkForOptionType(node);
55
+ checkForNullishType(node);
56
56
  },
57
57
  TSTypeAliasDeclaration: (node) => {
58
- checkForOptionType(node);
58
+ checkForNullishType(node);
59
59
  },
60
60
  };
61
61
  },