eslint-plugin-flawless 1.2.0 → 1.2.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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as plugin, t as PLUGIN_NAME } from "./plugin-K2GOCG3Z.mjs";
1
+ import { n as plugin, t as PLUGIN_NAME } from "./plugin-DfRbpogP.mjs";
2
2
  //#region src/configs/index.ts
3
3
  const configs = { recommended: {
4
4
  plugins: { [PLUGIN_NAME]: plugin },
package/dist/oxlint.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as plugin, t as PLUGIN_NAME } from "./plugin-K2GOCG3Z.mjs";
1
+ import { n as plugin, t as PLUGIN_NAME } from "./plugin-DfRbpogP.mjs";
2
2
  import { definePlugin } from "@oxlint/plugins";
3
3
  //#region src/oxlint.ts
4
4
  /**
@@ -14,7 +14,7 @@ import * as core from "@eslint-react/core";
14
14
  import { getStaticTOMLValue } from "toml-eslint-parser";
15
15
  //#region package.json
16
16
  var name = "eslint-plugin-flawless";
17
- var version = "1.2.0";
17
+ var version = "1.2.1";
18
18
  var repository = {
19
19
  "url": "git+https://github.com/christopher-buss/eslint-plugin-flawless.git",
20
20
  "type": "git"
@@ -5201,16 +5201,21 @@ const purity = createFlawlessRule({
5201
5201
  });
5202
5202
  //#endregion
5203
5203
  //#region src/rules/react-namespace/imports.ts
5204
+ /** Matches a bare npm scope (`@rbxts`) with no package segment. */
5205
+ const SCOPE_PATTERN = /^@[^/]+$/;
5204
5206
  /**
5205
- * Whether a module specifier refers to the configured React import source. Matches
5206
- * the exact source or any subpath (`@rbxts/react` and `@rbxts/react/jsx-runtime`).
5207
+ * Whether a module specifier refers to the configured React package. Matches the
5208
+ * exact package or any subpath (`@rbxts/react` and `@rbxts/react/jsx-runtime`),
5209
+ * but never a sibling package (`@rbxts/react-roblox`), because the `/` boundary
5210
+ * excludes it.
5207
5211
  *
5208
5212
  * @param value - The `source.value` of an import declaration.
5209
5213
  * @param importSource - The configured React import source.
5210
5214
  * @returns True when the specifier resolves to the React package.
5211
5215
  */
5212
5216
  function matchesSource(value, importSource) {
5213
- return value === importSource || value.startsWith(`${importSource}/`);
5217
+ const reactPackage = resolveReactPackage(importSource);
5218
+ return value === reactPackage || value.startsWith(`${reactPackage}/`);
5214
5219
  }
5215
5220
  /**
5216
5221
  * Collects the import declarations in a program that come from the React source.
@@ -5339,6 +5344,19 @@ function findNamedSpecifier(declarations, name) {
5339
5344
  };
5340
5345
  return null;
5341
5346
  }
5347
+ /**
5348
+ * Resolves the React package the `react-x` `importSource` setting points at. The
5349
+ * setting may be a package (`react`, `@rbxts/react`) or a bare npm scope
5350
+ * (`@rbxts`, as Roblox configs set it). A scope names no package, so treating it
5351
+ * as one claims every sibling (`@rbxts/react-roblox`, `@rbxts/flux`) as React;
5352
+ * the React package under a scope is `<scope>/react`.
5353
+ *
5354
+ * @param importSource - The configured `react-x` import source.
5355
+ * @returns The React package name to match against.
5356
+ */
5357
+ function resolveReactPackage(importSource) {
5358
+ return SCOPE_PATTERN.test(importSource) ? `${importSource}/react` : importSource;
5359
+ }
5342
5360
  function isNamedSpecifier(specifier) {
5343
5361
  return specifier.type === AST_NODE_TYPES.ImportSpecifier;
5344
5362
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-flawless",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Your ESLint plugin description",
5
5
  "keywords": [
6
6
  "eslint",