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

No query type 'lint' defined #64

Open
tststs opened this issue Nov 21, 2015 · 6 comments
Open

No query type 'lint' defined #64

tststs opened this issue Nov 21, 2015 · 6 comments

Comments

@tststs
Copy link
Contributor

tststs commented Nov 21, 2015

Hey,

with every request to the server, i get this error message.
Do i miss something?

.tern-project:

{
  "ecmaVersion": 6,
  "libs": [
    "browser"
  ],
  "loadEagerly": [
    "app/js/**/*.js"
  ],
  "plugins": {
    "complete_strings": {},
    "es_modules": {},
    "lint": {
      "config": {}
    },
    "doc_comment": {
      "fullDocs": true
    }
  }
}

post:

  lint: (file, text) ->
    @post(JSON.stringify
      query:
        type: 'lint'
        file: file,
        files: [
          type: 'full'
          name: file
          text: text
        ]
    )

Thanks and greetings,
tststs

@angelozerr
Copy link
Owner

@tststs if I remember, this problem comes from when you do npm install tern-lint and the version of tern that you use in not the same than version of tern-lint. So you have that:

  • tern
  • tern-lint
    • node_modules
      • tern

Try to remove the tern-lint/node_modules/tern folder in this case. I don't know how to manage that (with package.json). Any feedback are welcome!

@tststs
Copy link
Contributor Author

tststs commented Nov 22, 2015

It indeed works. But i don't think it's a good solution to rm the tern dir every time atom-ternjs is installed or updated.
The same issue occurs for tern-node-express and other tern-* plugins when used with atom-ternjs as a plugin. Maybe i miss something.

Is there any way to bypass the behaviour?
E.g. have a look here:

https://github.com/tststs/atom-ternjs/blob/es6-tern-wrapper/lib/atom-ternjs-server.js#L289

If i require tern-lint or tern-node-express the plugin is not being registered.

@angelozerr
Copy link
Owner

It indeed works. But i don't think it's a good solution to rm the tern dir every time atom-ternjs is installed or updated.

I agree with you, but I don't know how to fix this problem. I think it's a problem with npm install and package.json https://github.com/angelozerr/tern-lint/blob/master/package.json#L16

@tststs
Copy link
Contributor Author

tststs commented Nov 23, 2015

Ok, i think i have found a solution for the problem. I now use npm shrinkwrap.

First i create the npm-shrinkwrap.json with npm shrinkwrap in my atom-ternjs folder.
Then i remove the tern dependency for tern-lint within that file.

    "tern-lint": {
      "version": "0.5.0",
      "from": "tern-lint@>=0.5.0 <0.6.0",
      "resolved": "https://registry.npmjs.org/tern-lint/-/tern-lint-0.5.0.tgz",
      "dependencies": {
        "acorn": {
          "version": "2.6.4",
          "from": "acorn@>=2.4.0 <3.0.0",
          "resolved": "https://registry.npmjs.org/acorn/-/acorn-2.6.4.tgz"
        }
      }
    },

npm install will now ignore the dependency for tern inside the package.json of the tern-lint package.

bildschirmfoto 2015-11-23 um 17 47 11

Greetings,
tststs

@angelozerr
Copy link
Owner

Thanks @tststs for the info.

@angelozerr
Copy link
Owner

@tststs I have perhaps an idea (not tested) to fix this problem. Instead of doing:

require("tern/lib/infer")

We could do:

try {
  require("../tern/lib/infer")
}
catch(e) {
  require("tern/lib/infer")
}

The first time, we try to use the tern from the parent node_modules and if it's not available we try to use tern from the child node_modules.

What do you think about that?

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