Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type definitions that are necessary to not produce type errors should be marked #93

Open
JumpLink opened this issue Sep 26, 2022 · 2 comments

Comments

@JumpLink
Copy link
Collaborator

The Idea is use ESLint's no-restricted-syntax for that.

See also #87

@HeavenVolkoff
Copy link
Contributor

Here is an implementation for the rule targetting Gio.Cancellable.connect:

{
  "eslintConfig": {
    "env": {
      "node": false,
      "es2021": true,
      "browser": false,
      "commonjs": false,
      "shared-node-browser": false
    },
    "rules": {
      "no-restricted-syntax": [
        "warn",
        {
          "selector": "CallExpression[callee.property.name='connect'][arguments.length=2][arguments.0.value='cancelled'][arguments.1.type='FunctionExpression']",
          "message": "Calling .connect('cancelled', () => {}) on Gio.Cancellable instances is wrong, see https://gjs-docs.gnome.org/gio20~2.66p/gio.cancellable#method-connect"
        },
        {
          "selector": "CallExpression[callee.property.name='connect'][arguments.length=2][arguments.0.value='cancelled'][arguments.1.type='ArrowFunctionExpression']",
          "message": "Calling .connect('cancelled', () => {}) on Gio.Cancellable instances is wrong, see https://gjs-docs.gnome.org/gio20~2.66p/gio.cancellable#method-connect"
        }
      ]
   }
}

This issue should depend on #94, right?

@JumpLink
Copy link
Collaborator Author

@HeavenVolkoff We do not need to depend this on #94, I think we can just add the option to generate a eslint config. Or what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants