question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Allow specifying parser per file extension

See original GitHub issue

Tell us about your environment

  • ESLint Version: ^3.x.x
  • Node Version: latest
  • npm Version: latest

What parser (default, Babel-ESLint, etc.) are you using? babel-eslint & typescript-eslint

Proposal It would be beneficial to include the ability for eslint to determine which parser to use based on file extension so that eslint can be run against a multi-language codebase in a single pass. By extension this would also benefit text editors that can’t currently specify multiple configs so that a single config can be used to check the entire project.

Right now, I am running eslint once for JS(X), and again for Typescript each using a different parser since the ts-parser doesn’t support most stage-X ecma features and the babel-parser doesn’t support TS syntax.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
kaicataldocommented, May 4, 2017

This does seem useful to me now that we’re actively supporting more parsers (TypeScript, Babel, and now Vue!).

One idea: the parser option could accept an object that maps the parser to a filetype and its parser options:

{
  "parser": {
    "typescript-eslint-parser": {
      "filetypes": [".ts"],
      "parserOptions": {}
    },
    "vue-eslint-parser": {
      "filetypes": [".vue", ".js"],
      "parserOptions": {}
    }
  }
}

Curious what other team members think!

1reaction
mightyiamcommented, Oct 8, 2017

Great. Now I know how to deprecate an npm package.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature Request] Parse content & Extract Pages based on ...
I want to know every "Supplier" & "Products" & "Contact" in the PDF file. ... *Adding RegEx support would allow the user to...
Read more >
File type associations | IntelliJ IDEA Documentation - JetBrains
Configure the IDE to recognize different file types and open files of certain types in IntelliJ IDEA by default.
Read more >
argparse — Parser for command-line options, arguments and ...
ArgumentParser parses arguments through the parse_args() method. This will inspect the command line, convert each argument to the appropriate type and then ...
Read more >
Configuring ESLint - ESLint - Pluggable JavaScript Linter
Configuration Comments - use JavaScript comments to embed configuration information directly into a file. · Configuration Files - use a JavaScript, JSON, or...
Read more >
babel/parser
The Babel parser (previously Babylon) is a JavaScript parser used in Babel ... Setting this option to true allows them anywhere where a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found