@dfinity/eslint-config-oisy-wallet 0.1.8 → 0.1.10

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/README.md CHANGED
@@ -106,6 +106,34 @@ module.exports = {
106
106
  };
107
107
  ```
108
108
 
109
+ Or in `eslint.config.ts`, adding an object with the `rules` property:
110
+
111
+ ```typescript
112
+ import { default as svelteConfig } from "@dfinity/eslint-config-oisy-wallet/svelte";
113
+ import { default as vitestConfig } from "@dfinity/eslint-config-oisy-wallet/vitest";
114
+
115
+ export default [
116
+ ...vitestConfig,
117
+ ...svelteConfig,
118
+ {
119
+ rules: {
120
+ // Disable a built-in rule
121
+ "no-console": "off",
122
+ "vitest/expect-expect": "off",
123
+
124
+ // Disable a local custom rule
125
+ "local/use-nullish-checks": "off",
126
+
127
+ // Customize severity or options
128
+ "@typescript-eslint/no-unused-vars": [
129
+ "warn",
130
+ { argsIgnorePattern: "^_" },
131
+ ],
132
+ },
133
+ },
134
+ ];
135
+ ```
136
+
109
137
  Note: To override local rules, make sure you have the `eslint-local-rules.cjs` file at the root as described above.
110
138
 
111
139
  ## 🛠️ TypeScript Support
@@ -30,9 +30,9 @@ export const eslintRules = [
30
30
 
31
31
  rules: {
32
32
  "@typescript-eslint/consistent-type-imports": "error",
33
+ "@typescript-eslint/no-import-type-side-effects": "error",
33
34
  "@typescript-eslint/no-inferrable-types": "error",
34
35
  "@typescript-eslint/no-unnecessary-type-assertion": "error",
35
-
36
36
  "@typescript-eslint/no-unused-vars": [
37
37
  "warn",
38
38
  {
@@ -41,15 +41,12 @@ export const eslintRules = [
41
41
  caughtErrorsIgnorePattern: "^_",
42
42
  },
43
43
  ],
44
-
45
44
  "@typescript-eslint/prefer-nullish-coalescing": "error",
46
45
  "@typescript-eslint/prefer-reduce-type-parameter": "error",
46
+
47
47
  "arrow-body-style": ["warn", "as-needed"],
48
48
  curly: "error",
49
-
50
- // TODO: Disabled for now to allow the migration of ESLint v9 in OISY, as the rule is not yet enforced.
51
- // It should also be introduced as an optional rule.
52
- // "func-style": "error",
49
+ "func-style": "error",
53
50
 
54
51
  "local-rules/prefer-object-params": "warn",
55
52
 
@@ -58,30 +55,28 @@ export const eslintRules = [
58
55
  // "local-rules/use-nullish-checks": "warn",
59
56
 
60
57
  "local-rules/use-option-type-wrapper": "warn",
58
+
61
59
  "import/no-duplicates": ["error", { "prefer-inline": true }],
62
60
  "import/no-relative-parent-imports": "error",
61
+
63
62
  "object-shorthand": "error",
63
+ "prefer-destructuring": "error",
64
64
  "no-console": ["error", { allow: ["error", "warn"] }],
65
65
  "no-continue": "warn",
66
66
  "no-delete-var": "error",
67
67
  "no-else-return": ["warn", { allowElseIf: false }],
68
68
  "no-unused-vars": "off",
69
69
  "no-useless-rename": "error",
70
+ "prefer-arrow-callback": "error",
70
71
 
71
- // TODO: Disabled for now to allow the migration of ESLint v9 in OISY, as the rule is not yet enforced.
72
- // It should also be introduced as an optional rule.
73
- // "prefer-arrow-callback": "error",
74
-
75
- // TODO: Disabled for now to allow the migration of ESLint v9 in OISY, as the rule is not yet enforced.
76
- // It should also be introduced as an optional rule.
77
- // "prefer-arrow/prefer-arrow-functions": [
78
- // "error",
79
- // {
80
- // disallowPrototype: true,
81
- // singleReturnOnly: false,
82
- // classPropertiesAllowed: false,
83
- // },
84
- // ],
72
+ "prefer-arrow/prefer-arrow-functions": [
73
+ "error",
74
+ {
75
+ disallowPrototype: true,
76
+ singleReturnOnly: false,
77
+ classPropertiesAllowed: false,
78
+ },
79
+ ],
85
80
 
86
81
  "prefer-template": "error",
87
82
  "require-await": "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfinity/eslint-config-oisy-wallet",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Shared ESLint configurations from the Oisy Wallet team",
6
6
  "repository": {
@@ -43,6 +43,7 @@
43
43
  "format": "prettier . --write",
44
44
  "format:check": "prettier --check .",
45
45
  "lint": "eslint .",
46
+ "lint:fix": "eslint --fix .",
46
47
  "test": "vitest --run"
47
48
  },
48
49
  "keywords": [
@@ -38,7 +38,7 @@ const inferReturnType = (node) => {
38
38
  };
39
39
 
40
40
  const checkReturnType = ({ node, context }) => {
41
- const returnType = node.returnType;
41
+ const { returnType } = node;
42
42
 
43
43
  if (!returnType) {
44
44
  const inferredType = inferReturnType(node);
@@ -13,7 +13,7 @@ module.exports = {
13
13
  },
14
14
  create: (context) => {
15
15
  const checkForMoreThanOneParameter = (node) => {
16
- const parent = node.parent;
16
+ const { parent } = node;
17
17
 
18
18
  // Check if it is a callback for looping methods
19
19
  if (
@@ -43,6 +43,7 @@ module.exports = {
43
43
  "reduce",
44
44
  "reduceRight",
45
45
  "slice",
46
+ "some",
46
47
  "splice",
47
48
  "toLocaleString",
48
49
  "toSpliced",
package/vitest.mjs CHANGED
@@ -11,8 +11,12 @@ export default [
11
11
 
12
12
  "vitest/no-alias-methods": ["error"],
13
13
  "vitest/no-duplicate-hooks": ["error"],
14
+ "vitest/no-test-return-statement": ["error"],
14
15
  "vitest/padding-around-all": ["error"],
15
16
  "vitest/prefer-comparison-matcher": ["error"],
17
+ "vitest/prefer-each": ["error"],
18
+ "vitest/prefer-equality-matcher": ["error"],
19
+ "vitest/prefer-expect-resolves": ["error"],
16
20
  "vitest/prefer-hooks-in-order": ["error"],
17
21
  "vitest/prefer-hooks-on-top": ["error"],
18
22
  "vitest/prefer-to-be-falsy": ["error"],
@@ -20,6 +24,7 @@ export default [
20
24
  "vitest/prefer-to-be-truthy": ["error"],
21
25
  "vitest/prefer-to-contain": ["error"],
22
26
  "vitest/prefer-to-have-length": ["error"],
27
+ "vitest/require-top-level-describe": ["error"],
23
28
  },
24
29
  },
25
30
  languageOptions(),