vim-prettier icon indicating copy to clipboard operation
vim-prettier copied to clipboard

.eslintrc is ignored

Open lushkovsky-s opened this issue 3 years ago • 0 comments

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

lushkovsky-s avatar Feb 14 '22 17:02 lushkovsky-s