添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

I'm doing migrate of tslint on eslint and get many parsing errors. I used a mixed config for js and ts files. If it is a problem not in my config I create a new issue with another parsing errors

What code were you trying to parse?

export type SyncJsonFile = ({
  path,
  newContent,
}: {
  path: string;
  newContent: any;
}) => Promise<void>;

What did you expect to happen?
Do not show errors

What actually happened?

  6:7  error  Parsing error: Unexpected token, expected ":"
  5 | export type SyncJsonFile = ({
> 6 |   path,
    |       ^
  7 |   newContent,
  8 | }: {
  9 |   path: string;

Config

export const typescriptConfig = {
  extends: ['plugin:@typescript-eslint/eslint-recommended'],
  overrides: [
      parser: '@typescript-eslint/parser',
      extends: [
        'plugin:@typescript-eslint/recommended',
        'prettier/@typescript-eslint',
        'plugin:import/typescript',
      plugins: ['@typescript-eslint'],
      files: ['*.ts', '*.tsx'],
      rules: {},

Versions

package version

Looking at the link you sent, that is because it's switching to babel parser, which doesn't understand typescript syntax by default.

If you manage to find a repro case, will gladly reopen this issue.

This is not an issue with our parser. I cannot reproduce this with our parser
This is the base babel-eslint parser not working correctly without any config.
ESLint is not applying different parsers to different files, hence babel-eslint is throwing an error.

Why are you mixing and matching parser? You should just be using our parser for everything.

Why are you mixing and matching parser? You should just be using our parser for everything.

Thanks for your answer. I will test with parsers @typescript-eslint/parser for js files. But the main case used a babel-eslint it custom syntactic. In my project use mixed files: Babel(js) and TS. Before that, I used tslint for ts and eslint for js.

I have spent more time to debug eslint combine config and resolved the problem of move js config with separate file

https://github.com/Tom910/eslint-extends-error
Thanks for spend time