@backstage/eslint-plugin 0.1.0 → 0.1.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @backstage/eslint-plugin
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - cbd09db1c0: Fixing a bug that we should check internal dependencies too
8
+
3
9
  ## 0.1.0
4
10
 
5
11
  ### Minor Changes
@@ -34,6 +34,7 @@ const getPackages = require('./getPackages');
34
34
  * @property {'value' | 'type'} kind
35
35
  * @property {string} path
36
36
  * @property {import('./getPackages').ExtendedPackage} package
37
+ * @property {string} packageName
37
38
  */
38
39
 
39
40
  /**
@@ -160,6 +161,7 @@ module.exports = function visitImports(context, visitor) {
160
161
  kind: info.kind,
161
162
  path: subPath,
162
163
  package: pkg,
164
+ packageName,
163
165
  });
164
166
  }
165
167
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/eslint-plugin",
3
3
  "description": "Backstage ESLint plugin",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -22,7 +22,7 @@
22
22
  "minimatch": "^5.1.2"
23
23
  },
24
24
  "devDependencies": {
25
- "@backstage/cli": "^0.22.2",
25
+ "@backstage/cli": "^0.22.3",
26
26
  "eslint": "^8.33.0"
27
27
  }
28
28
  }
@@ -151,11 +151,18 @@ module.exports = {
151
151
  }
152
152
 
153
153
  return visitImports(context, (node, imp) => {
154
- if (imp.type !== 'external') {
154
+ // We leave checking of type imports to the repo-tools check,
155
+ // and we skip builtins and local imports
156
+ if (
157
+ imp.kind === 'type' ||
158
+ imp.type === 'builtin' ||
159
+ imp.type === 'local'
160
+ ) {
155
161
  return;
156
162
  }
157
- // We leave checking of type imports to the repo-tools check
158
- if (imp.kind === 'type') {
163
+
164
+ // We skip imports for the package itself
165
+ if (imp.packageName === localPkg.packageJson.name) {
159
166
  return;
160
167
  }
161
168
 
@@ -236,5 +236,16 @@ ruleTester.run(RULE, rule, {
236
236
  ),
237
237
  ],
238
238
  },
239
+ {
240
+ code: `import '@internal/foo'`,
241
+ filename: joinPath(FIXTURE, 'packages/bar/src/index.ts'),
242
+ errors: [
243
+ ERR_UNDECLARED(
244
+ '@internal/foo',
245
+ 'dependencies',
246
+ joinPath('packages', 'bar'),
247
+ ),
248
+ ],
249
+ },
239
250
  ],
240
251
  });