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

.eslintrc.js does not have suggestions #124

Closed
dbaeumer opened this issue Aug 31, 2016 · 20 comments
Closed

.eslintrc.js does not have suggestions #124

dbaeumer opened this issue Aug 31, 2016 · 20 comments
Assignees
Labels
feature-request Request for new features or functionality

Comments

@dbaeumer
Copy link
Member

From @isidorn on August 30, 2016 13:34

Refs #11100

  1. Simple repo, initiazlie eslint, .eslintrc.js gets created
  2. Open .eslintrc.js and triggere intelli-sense -> no suggestions
  3. As found while discussing with @dbaeumer the issue here is that this file is .js and not .json
  4. I would expect suggestions to help me set this file up

Copied from original issue: microsoft/vscode#11213

@dbaeumer dbaeumer self-assigned this Aug 31, 2016
@dbaeumer
Copy link
Member Author

Might be hard to achieve since we need to tell the tsserver about a d.ts eslint file under the cover. On top of this we would need to maintain such a file.

@knownasilya
Copy link

Any movement on this? Not getting any linting based on this file.

@dbaeumer
Copy link
Member Author

No movement so far.

@dbaeumer dbaeumer added the feature-request Request for new features or functionality label Nov 6, 2017
@dbaeumer dbaeumer added this to the Backlog milestone Nov 6, 2017
@golopot
Copy link

golopot commented May 8, 2019

There is intellisense in .eslintrc or .eslintrc.json, but not in .eslintrc.js.

@kiprasmel
Copy link

kiprasmel commented Jul 23, 2019

Up - still needed!

Filename .eslintrc is deprecated and .eslintrc.js does NOT have intelliSense.

/cc @dbaeumer

Edit:
I found out that the json version still allows you to have comments etc, so it really doesn't matter anymore I guess.

@tvkit
Copy link

tvkit commented Nov 4, 2019

Yup, there's code assist support for JSON, but conditionals are problematic.

Here's a default vue setup, .eslintrc.js, with ENV conditionals.

module.exports = {
  root: true,
  env: {
    node: true
  },
  extends: ["plugin:vue/essential", "@vue/prettier", "@vue/typescript"],
  rules: {
    "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
  },
  parserOptions: {
    parser: "@typescript-eslint/parser"
  }
};

@tcd
Copy link

tcd commented Jan 29, 2020

Any update on this?
Still looking around for a solution but it seems like this is a/the proper issue to follow.

@dbaeumer
Copy link
Member Author

As I was trying to explain this is something that needs to come from the TS / JS server. Let me ping someone in the TS team if there is any way to inject a d.ts for a specific file.

@dbaeumer
Copy link
Member Author

@DanielRosenwasser is there any way I can teach the TypeScript server to check a certain file using a specific d.ts. file. For example by using some sort of meta comment in the file ?

slimlime pushed a commit to slimlime/autocomplete-tester that referenced this issue Mar 20, 2020
…pletion for key values like TSLint IntelliSense. See microsoft/vscode-eslint#124. There is IntelliSense for {.eslintrc.json}. Requires TS server .d.ts injection
@cdbattags
Copy link

Any more updates on this?

@dbaeumer
Copy link
Member Author

dbaeumer commented Apr 3, 2020

@DanielRosenwasser any updates on comment #124 (comment)

@DanielRosenwasser
Copy link
Member

Sorry, I didn't see the original question. Today I think your best bet would be to install @types/eslint and use a JSDoc annotation to get completions.

/**
 * @type {import("eslint").Linter.Config}
 */
const config = {
  // ...
}
module.exports = config;

@dbaeumer
Copy link
Member Author

dbaeumer commented Apr 6, 2020

@DanielRosenwasser THANKS!!

Will close the issue then since there is nothing ESLint needs to do here.

@dbaeumer dbaeumer closed this as completed Apr 6, 2020
@cdbattags
Copy link

I don't think this suggestion is ideal. You're saying add a JSDoc to every TypeScript file in my repo?

@cdbattags
Copy link

Ahhh, no, just the config JavaScript?

Interesting, lemme give this a try within the hour

@dbaeumer
Copy link
Member Author

dbaeumer commented Apr 6, 2020

@cdbattags correct.

@jonaskuske
Copy link

@cdbattags Just to the .eslintrc.js file. Or why do you need ESLint types/autocompletion in every single file?

@cdbattags
Copy link

Might I open/add a different ticket for the long term?

Ideally I don't want to have to remember to add this annotation to each new repo/config.

I don't mind attempting the work on this.

@dbaeumer
Copy link
Member Author

dbaeumer commented Apr 6, 2020

IMO this should be handled by the eslint init command. There is nothing I in the ESLint extension can do about this.

@pikeas
Copy link

pikeas commented May 15, 2020

@DanielRosenwasser The JSDoc import snippet doesn't seem to work. Intellisense works for .eslintrc.json and works for JS syntax generally in .eslintrc.js.

@vscodebot vscodebot bot locked and limited conversation to collaborators May 21, 2020
@dbaeumer dbaeumer removed this from the Backlog milestone Dec 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

10 participants