gst-plugins-rs/net/webrtc/gstwebrtc-api/.eslintrc.json
Piotr Brzeziński 35a238b66f gstwebrtc-api: Improve JSDocs, add TypeScript type definitions
* Moves some parts of the docs around to make them better parseable by
JSDoc (e.g. @classdesc moved to the constructor gets rid of duplicated
doc page for the entire class)

* Gets rid of unnecessary manual assignment of methods/properties
example: @method GstWebRTCAPI#createConsumerSession
Due to a bug in JSDoc, it doesn't automatically pick up docs in classes
marked with 'export default class ...'. Just making the export separate
is enough to fix this. I suppose this bug was why every documented part
was manually assigned to each class, and this is no longer necessary.

* Removes forced GstWebRTCAPI namespace from docs
I'm not sure why things were left this way, but at least since
563eff1193 our classes aren't actually in
any namespace (well, maybe apart from SessionState?), you can import
them one by one and no such namespace is present anywhere. I removed
that, kind of as a byproduct of the point above.

* Removes external: from type references
This is problematic because JSDoc handles this fine, but any IDE I've
tried couldn't parse those references correctly from the JSDocs, and
neither could the TypeScript compiler when autogenerating type
definitions. After removing the external: prefix, all tooling is picking
those types up fine, but JSDoc's docs end up losing links when refering
to said types. I left the definitions in index.js, so that they still
show up in the sidebar and can be easily referred to.

* Adds TypeScript type definitions (d.ts)
Those are autogenerated by running `npx tsc` in the main dir and then
manually corrected by 1) removing all undocumented ('private') functions
and 2) writing definitions for the Listener interfaces which TS can't
automatically infer from JSDocs. This makes it much easier to use our
library in TypeScript-based projects.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2049>
2025-03-14 07:42:40 +00:00

65 lines
1.5 KiB
JSON

{
"root": true,
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"env": {
"browser": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"getter-return": "error",
"no-await-in-loop": "error",
"no-console": "off",
"no-extra-parens": "off",
"no-template-curly-in-string": "error",
"consistent-return": "error",
"curly": "error",
"eqeqeq": "error",
"no-eval": "error",
"no-extra-bind": "error",
"no-invalid-this": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-multi-spaces": "error",
"no-return-assign": "error",
"no-return-await": "error",
"no-self-compare": "error",
"no-throw-literal": "error",
"no-unused-expressions": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-return": "error",
"no-void": "error",
"no-shadow": "error",
"block-spacing": "error",
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"camelcase": "error",
"comma-dangle": "error",
"eol-last": "error",
"indent": [
"error",
2
],
"linebreak-style": "error",
"new-parens": "error",
"no-lonely-if": "error",
"no-multiple-empty-lines": "error",
"no-trailing-spaces": "error",
"quotes": "error",
"semi": "error",
"jsdoc/no-undefined-types": "warn"
},
"plugins": [
"jsdoc"
]
}