@dfinity/eslint-config-oisy-wallet 0.1.2 → 0.1.4
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 +24 -0
- package/configs/eslint.rules.mjs +2 -0
- package/package.json +1 -1
- package/svelte.mjs +20 -1
package/README.md
CHANGED
|
@@ -55,6 +55,30 @@ module.exports = require("@dfinity/eslint-config-oisy-wallet/eslint-local-rules"
|
|
|
55
55
|
> [!NOTE]
|
|
56
56
|
> This is necessary because the `eslint-plugin-local-rules` plugin we use for custom rules requires a file located at the root and does not offer any customizable location option.
|
|
57
57
|
|
|
58
|
+
## 🔧 Overriding or Disabling Rules
|
|
59
|
+
|
|
60
|
+
You can override or disable any of the rules provided by this configuration — including custom **local rules** — just like you would with any ESLint config.
|
|
61
|
+
|
|
62
|
+
In your `.eslintrc.js`, simply add a `rules` section:
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
module.exports = {
|
|
66
|
+
extends: ["@dfinity/eslint-config-oisy-wallet/svelte"],
|
|
67
|
+
rules: {
|
|
68
|
+
// Disable a built-in rule
|
|
69
|
+
"no-console": "off",
|
|
70
|
+
|
|
71
|
+
// Disable a local custom rule
|
|
72
|
+
"local/use-nullish-checks": "off",
|
|
73
|
+
|
|
74
|
+
// Customize severity or options
|
|
75
|
+
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Note: To override local rules, make sure you have the `eslint-local-rules.cjs` file at the root as described above.
|
|
81
|
+
|
|
58
82
|
## 🛠️ TypeScript Support
|
|
59
83
|
|
|
60
84
|
If your project uses TypeScript, make sure you have a `tsconfig.json` file in your project root.
|
package/configs/eslint.rules.mjs
CHANGED
|
@@ -65,11 +65,13 @@ export const eslintRules = [
|
|
|
65
65
|
"local-rules/use-option-type-wrapper": "warn",
|
|
66
66
|
"import/no-duplicates": ["error", { "prefer-inline": true }],
|
|
67
67
|
"import/no-relative-parent-imports": "error",
|
|
68
|
+
"object-shorthand": "error",
|
|
68
69
|
"no-console": ["error", { allow: ["error", "warn"] }],
|
|
69
70
|
"no-continue": "warn",
|
|
70
71
|
"no-delete-var": "error",
|
|
71
72
|
"no-else-return": ["warn", { allowElseIf: false }],
|
|
72
73
|
"no-unused-vars": "off",
|
|
74
|
+
"no-useless-rename": "error",
|
|
73
75
|
|
|
74
76
|
// TODO: Disabled for now to allow the migration of ESLint v9 in OISY, as the rule is not yet enforced.
|
|
75
77
|
// It should also be introduced as an optional rule.
|
package/package.json
CHANGED
package/svelte.mjs
CHANGED
|
@@ -13,6 +13,7 @@ export default [
|
|
|
13
13
|
...svelte.configs["flat/recommended"],
|
|
14
14
|
...svelte.configs["flat/prettier"],
|
|
15
15
|
languageOptions([".svelte"]),
|
|
16
|
+
|
|
16
17
|
{
|
|
17
18
|
files: ["**/*.svelte"],
|
|
18
19
|
languageOptions: {
|
|
@@ -26,7 +27,6 @@ export default [
|
|
|
26
27
|
|
|
27
28
|
{
|
|
28
29
|
files: ["**/*.svelte"],
|
|
29
|
-
|
|
30
30
|
rules: {
|
|
31
31
|
"import/order": [
|
|
32
32
|
"error",
|
|
@@ -38,6 +38,25 @@ export default [
|
|
|
38
38
|
],
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
|
+
|
|
42
|
+
{
|
|
43
|
+
rules: {
|
|
44
|
+
"svelte/block-lang": [
|
|
45
|
+
"error",
|
|
46
|
+
{
|
|
47
|
+
enforceScriptPresent: true,
|
|
48
|
+
enforceStylePresent: true,
|
|
49
|
+
script: ["ts"],
|
|
50
|
+
style: ["scss", "postcss"],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
"svelte/no-extra-reactive-curlies": ["error"],
|
|
54
|
+
"svelte/shorthand-attribute": ["error"],
|
|
55
|
+
"svelte/shorthand-directive": ["error"],
|
|
56
|
+
"svelte/spaced-html-comment": ["error"],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
|
|
41
60
|
{
|
|
42
61
|
files: ["scripts/**/*.mjs", "scripts/**/*.ts"],
|
|
43
62
|
|