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 is ignored #323

Open
lushkovsky-s opened this issue Feb 14, 2022 · 0 comments
Open

.eslintrc is ignored #323

lushkovsky-s opened this issue Feb 14, 2022 · 0 comments

Comments

@lushkovsky-s
Copy link

I'm using NVIM v0.6.1, the plugin has been added using this code in ~/.config/nvim/init.vim:

Plug 'prettier/vim-prettier', {
  \ 'do': 'yarn install --frozen-lockfile --production',
  \ 'branch': 'release/0.x'
  \ }

In general everything works well (:Prettier do apply fixes on code), but the project-specific configuration .eslintrc is not take into account, e.g. instead of import { useState } from "react", I'm getting import {useState} from 'react'
In the exact same project using VS Code prettier works excellent (also it's the same correct when using ./node_modules/.bin/prettier --write src/.

.eslintrc:

{
  "extends": ["react-app", "plugin:prettier/recommended"],
  "rules": {
    "@typescript-eslint/consistent-type-imports": "error",
    "prettier/prettier": [
      "error",
      {
        "endOfLine": "auto"
      }
    ]
  }
}

What I've tried:

  • Specifying the required rules explicitly (e.g. "spaceBeforeBlocks": "always" and "jsxQuotes": "prefer-double"
  • Adding let g:prettier#autoformat_config_files = ['.eslintrc']
  • Adding let g:prettier#exec_cmd_path = ".../path/to/my/project/node_modules/.bin/prettier"
  • Specifying format rules in a way like let g:prettier#config#tab_width = 4. This made the expected affect, but not all the settings are available in this way + I need to change the configuration project to project
  • Putting a copy of .eslinrc into ~/.config/nvim/

OS: macOS 11.5.1
Prettier: 2.3.2

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

1 participant