@dfinity/eslint-config-oisy-wallet 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -11,7 +11,7 @@ A shareable ESLint configuration library for Oisy Wallet projects, supporting bo
11
11
  </div>
12
12
 
13
13
  > [!NOTE]
14
- > This configuration is currently compatible with ESLint 8.
14
+ > This configuration is currently compatible with ESLint 9 and ESLint 10.
15
15
 
16
16
  ## 🖥️ Installation
17
17
 
@@ -2,8 +2,8 @@ import localRules from "eslint-plugin-local-rules";
2
2
  import preferArrow from "eslint-plugin-prefer-arrow";
3
3
  import { join } from "node:path";
4
4
  import { existsSync } from "node:fs";
5
- import { fixupPluginRules, includeIgnoreFile } from "@eslint/compat";
6
- import _import from "eslint-plugin-import";
5
+ import { includeIgnoreFile } from "@eslint/compat";
6
+ import _import from "eslint-plugin-import-x";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { nonNullish } from "@dfinity/utils";
9
9
 
@@ -46,7 +46,7 @@ export const eslintRules = [
46
46
  plugins: {
47
47
  "local-rules": localRules,
48
48
  "prefer-arrow": preferArrow,
49
- import: fixupPluginRules(_import),
49
+ import: _import,
50
50
  },
51
51
 
52
52
  rules: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfinity/eslint-config-oisy-wallet",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Shared ESLint configurations from the Oisy Wallet team",
6
6
  "repository": {
@@ -67,12 +67,12 @@
67
67
  "@dfinity/utils": "*",
68
68
  "@eslint/compat": "^2.0.2",
69
69
  "@eslint/eslintrc": "^3.3.3",
70
- "@eslint/js": "^9.39.2",
70
+ "@eslint/js": "^9.39.2 || ^10.0.0",
71
71
  "@typescript-eslint/eslint-plugin": "^8.56.0",
72
72
  "@vitest/eslint-plugin": "^1.6.9",
73
- "eslint": "^9.39.2",
73
+ "eslint": "^9.39.2 || ^10.0.0",
74
74
  "eslint-config-prettier": "^10.1.8",
75
- "eslint-plugin-import": "^2.32.0",
75
+ "eslint-plugin-import-x": "^4.16.2",
76
76
  "eslint-plugin-local-rules": "^3.0.2",
77
77
  "eslint-plugin-n": "^17.24.0",
78
78
  "eslint-plugin-prefer-arrow": "^1.2.3",
@@ -10,7 +10,7 @@ module.exports = {
10
10
  },
11
11
  create: (context) => ({
12
12
  ImportDeclaration: (node) => {
13
- const filePath = context.getFilename();
13
+ const filePath = context.filename;
14
14
 
15
15
  const {
16
16
  source: { value },
@@ -148,9 +148,7 @@ module.exports = {
148
148
  return false;
149
149
  }
150
150
 
151
- const initialScope = sourceCode?.getScope
152
- ? sourceCode.getScope(node)
153
- : context.getScope();
151
+ const initialScope = sourceCode.getScope(node);
154
152
 
155
153
  const typeAnn = findVariableTypeAnnotation({
156
154
  scope: initialScope,
@@ -249,7 +247,7 @@ module.exports = {
249
247
  fix: (fixer) =>
250
248
  fixer.replaceText(
251
249
  node,
252
- `${replacementFn}(${sourceCode ? sourceCode.getText(fixNode) : context.getSourceCode().getText(fixNode)})`,
250
+ `${replacementFn}(${sourceCode.getText(fixNode)})`,
253
251
  ),
254
252
  });
255
253
  };
@@ -28,7 +28,7 @@ module.exports = {
28
28
  const typeText =
29
29
  type.type === "TSTypeReference" && type.typeName && type.typeName.name
30
30
  ? type.typeName.name
31
- : context.getSourceCode().getText(type);
31
+ : context.sourceCode.getText(type);
32
32
 
33
33
  if (type) {
34
34
  try {