uicrooks / shopify-theme-lab

Shopify theme development environment using Liquid, Vue and Tailwind CSS. Built on top of Shopify CLI 🧪
https://uicrooks.github.io/shopify-theme-lab-docs/
MIT License
743 stars 132 forks source link

[Bug]: ESLint extension on VS Code can not find the config file #142

Open haotan19 opened 2 years ago

haotan19 commented 2 years ago

Operating system

Windows 10

Node.js version

14.16.0

Shopify CLI version

2.7.2

Browsers

Chrome

Version

4 (Current)

Modifications

No response

Details

Problem: It seems ESLint extension can not detect the .config/.eslintrc.js ESLint error is not showing up in the VS Code with ESLint extension. But the yarn fix:js work just fine.


Steps:

  1. Clone & yarn the project
  2. Create a component under src/vue/components/render
  3. Use Ctrl+Shift+Uto open OUTPUT in VS Code, select the ESLint output, and it said:
    [Info  - 10:38:15 AM] ESLint server is starting
    [Info  - 10:38:16 AM] ESLint server running in node v14.16.0
    [Info  - 10:38:16 AM] ESLint server is running.
    [Info  - 10:38:17 AM] ESLint library loaded from: D:\_shopify\concept-themes\Nov-14-theme\node_modules\eslint\lib\api.js
    [Warn  - 10:38:22 AM] 
    No ESLint configuration (e.g .eslintrc) found for file: d:\_shopify\concept-themes\Nov-14-theme\src\vue\components\render\mouse-target.vue
    File will not be validated. Consider running 'eslint --init' in the workspace folder Nov-14-theme
    Alternatively you can disable ESLint by executing the 'Disable ESLint' command.

Notice

haotan19 commented 2 years ago

Possible fix:

Create a .vscode/settings.json file:

{
    "eslint.options": {
        "configFile": "[Your eslintrc.js file path]",
    },
}

My working example:

{
    "eslint.options": {
        "configFile": ".config/.eslintrc.js",
    },
}
haotan19 commented 2 years ago

I created a PR #143 , hope this helps!