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.

Getting ESLint errors about missing files

See original GitHub issue

I’m trying to add this plugin to my project, I followed the standard configuration in the documentation:

image

But am getting the following error in VSCode’s ESLint output:

[Info  - 9:40:12 AM] ESLint server is starting
[Info  - 9:40:12 AM] ESLint server running in node v12.14.1
[Info  - 9:40:12 AM] ESLint server is running.
[Info  - 9:42:43 AM] ESLint library loaded from: /Users/peterp/x/redwoodjs/example-invoice/node_modules/eslint/lib/api.js
[Info  - 9:42:56 AM] ENOTDIR: not a directory, stat '/Users/peterp/x/redwoodjs/example-invoice/web/src/index.js/0_/Users/peterp/x/redwoodjs/example-invoice/web/src/index.js' Occurred while linting /Users/peterp/x/redwoodjs/example-invoice/web/src/index.js/0_/Users/peterp/x/redwoodjs/example-invoice/web/src/index.js:1
[Info  - 9:42:56 AM] ENOTDIR: not a directory, stat '/Users/peterp/x/redwoodjs/example-invoice/web/src/pages/InvoicePage/subcomponents/InvoiceCell/InvoiceCell.js/0_document.graphql' Occurred while linting /Users/peterp/x/redwoodjs/example-invoice/web/src/pages/InvoicePage/subcomponents/InvoiceCell/InvoiceCell.js/0_document.graphql:0

I’ve pushed up a branch here: https://github.com/redwoodjs/example-invoice/pull/39/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:23 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
lavigneercommented, Feb 24, 2021

@therealgilles since the filename used for the generated chunks in this plugin always uses “document.graphql” (see https://github.com/dotansimha/graphql-eslint/blob/master/packages/plugin/src/processors/code-files.ts#L42), you can make a rule specific for these generated chunks without affecting your other “.graphql” files (assuming none of them are called “document.graphql”). I’ve done this in my eslint config which uses this parser to turn off the eol rule that was breaking for these generated chunks.

Here’s a snippet of what I have which seems to work:

{
    "files": ["*.gql", "*.graphql"],
    "parser": "@graphql-eslint/eslint-plugin",
    "plugins": ["@graphql-eslint"],
    "rules": {
        "@graphql-eslint/naming-convention": [
            "error",
            {
                "ObjectTypeDefinition": "PascalCase",
                "FieldDefinition": "camelCase",
                "EnumValueDefinition": "UPPER_CASE",
                "InputValueDefinition": "camelCase",
                "FragmentDefinition": "camelCase",
                "leadingUnderscore": "allow"
            }
        ],
        "@graphql-eslint/require-deprecation-reason": "error",
        "@graphql-eslint/no-case-insensitive-enum-values-duplicates": "error"
    }
},
{
    "files": ["*document.graphql"],
    "rules": {
        "eol-last": "off"
    }
},

I suspect if you adjusted your above config as follows it should work ok.

[
  {
    "files": ["*.tsx", "*.ts", "*.jsx", "*.js"],
    "processor": "@graphql-eslint/graphql"
  },
  {
    "files": ["*.graphql"],
    "parser": "@graphql-eslint/eslint-plugin",
    "plugins": ["@graphql-eslint"],
    "rules": {
      "@graphql-eslint/no-anonymous-operations": "error"
    }
  },
  {
    "files": ["*document.graphql"],
    "rules": {
      "prettier/prettier": "off"
    }
  }
]

3reactions
dotansimhacommented, Dec 19, 2020

Fixed in https://github.com/dotansimha/graphql-eslint/pull/225 Thank you @peterp @ilyavolodin @EmrysMyrddin @lavigneer @jgoux @huw 😃

Available @graphql-eslint/eslint-plugin@0.5.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting ESLint errors about missing files · Issue #88 - GitHub
I'm trying to add this plugin to my project, I followed the standard configuration in the documentation: But am getting the following error...
Read more >
1 Answer - 1 - Stack Overflow
Missing file extension "tsx" for "./reducer" error after using eslint-config-airbnb · reactjs · eslint · prettier · eslint-config-airbnb.
Read more >
Ignoring Code - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
The Three Easiest Ways to Fix the "Missing File Extension 'tsx ...
The Three Easiest Ways to Fix the “Missing File Extension 'tsx'” Error ; 3.1 Install eslint-import-resolver-typescript ; 3.2 Add TypeScript to the ...
Read more >
VS Code tips — Quickly fix all linter errors in a file ... - YouTube
Today's VS Code extension tip: ESLint fix all actions Quickly fix all linter problems for a given ESLint rule or fix all auto...
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