@ng-native/eslint-plugin 0.26.1 → 0.28.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.
Files changed (2) hide show
  1. package/index.mjs +15 -3
  2. package/package.json +2 -2
package/index.mjs CHANGED
@@ -151,6 +151,16 @@ function buildsForDesktop(context) {
151
151
  return platformsAbove(dirname(filename)).some((os) => DESKTOP_PLATFORMS.has(os));
152
152
  }
153
153
 
154
+ /**
155
+ * Whether the project a file is in lists iOS or Android in the nearest `app.json`'s
156
+ * `expo.platforms`. A desktop-only app lists desktop OSes alone. Read where the project lists a
157
+ * desktop OS, since with none listed it builds for both phones, as Expo does by default.
158
+ */
159
+ function buildsForPhone(context) {
160
+ const filename = context.physicalFilename ?? context.filename;
161
+ return platformsAbove(dirname(filename)).some((os) => os === 'ios' || os === 'android');
162
+ }
163
+
154
164
  function platformsAbove(directory) {
155
165
  const file = join(directory, 'app.json');
156
166
  const stat = statSync(file, { throwIfNoEntry: false });
@@ -207,7 +217,7 @@ const noDomEvents = {
207
217
  'routerLink listens for a DOM click and never navigates on a device. Use nativeRouterLink from @ng-native/router, on a <pressable>.',
208
218
  event: '({{name}}) is a DOM event and never fires on a device. Use {{instead}}.',
209
219
  desktop:
210
- '({{name}}) fires only on macOS, and expo.platforms in app.json lists no desktop OS, so it never fires here. Use {{instead}}.',
220
+ '({{name}}) fires only on a desktop OS, and expo.platforms in app.json lists no desktop OS, so it never fires here. Use {{instead}}.',
211
221
  global:
212
222
  '({{target}}:{{name}}) never fires: there is no {{target}} on a device. Use @ng-native/device for app-wide events.',
213
223
  },
@@ -277,12 +287,14 @@ const desktopOnlyEvents = {
277
287
  },
278
288
  messages: {
279
289
  event:
280
- '({{name}}) fires only on macOS: iOS and Android never send it. Where it has to work there too, use {{instead}} as well.',
290
+ '({{name}}) fires only on a desktop OS: iOS and Android never send it. Where it has to work there too, use {{instead}} as well.',
281
291
  },
282
292
  schema: [],
283
293
  },
284
294
  create(context) {
285
- if (isDomComponent(context) || !buildsForDesktop(context)) return {};
295
+ if (isDomComponent(context) || !buildsForDesktop(context) || !buildsForPhone(context)) {
296
+ return {};
297
+ }
286
298
  const check = (where, name) => {
287
299
  const event = name.split('.')[0];
288
300
  const known = DOM_EVENTS.get(event);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/eslint-plugin",
3
- "version": "0.26.1",
3
+ "version": "0.28.0",
4
4
  "description": "ESLint rules for Angular Native: the DOM events, HTML controls and browser APIs that compile but do nothing on a device.",
5
5
  "keywords": [
6
6
  "angular",
@@ -17,7 +17,7 @@
17
17
  "./package.json": "./package.json"
18
18
  },
19
19
  "dependencies": {
20
- "@ng-native/metro": "0.26.1"
20
+ "@ng-native/metro": "0.28.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "angular-eslint": "^22.0.0",