green-code-initiative / ecoCode-javascript

Reduce the environmental footprint of your JS/TS software programs
https://ecocode.io
GNU General Public License v3.0
18 stars 17 forks source link

Extend the no-torch rule to plain HTML5 Web APIs #48

Open AMorgaut opened 2 months ago

AMorgaut commented 2 months ago

Solution you'd like

La règle no-torch devrait detecter l'utilisation de la contrainte torch de l'API HTML5 MediaTrackConstraints (torch)

const mediaStream = await navigator.mediaDevices.getUserMedia({video: true});
const [track] = mediaStream.getVideoTracks();
try { 
  await track.applyConstraints({ advanced: [
    { torch: on }
  ] });
  // Do something with the track such as using the Image Capture API.
} catch((e) {
  // The constraints could not be satisfied by the available devices.
}

Is your feature request related to a problem?

La règle no-torch repose actuellement sur une lib React Native. Telle quelle, cette version devrait avoir un lable react + potentiellement un label react-native.

Alternatives you've considered

No response

Additional Information

No response