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

gatsby app gives eslint errors but not the others #4300

Closed
iangregsondev opened this issue Dec 15, 2020 · 4 comments
Closed

gatsby app gives eslint errors but not the others #4300

iangregsondev opened this issue Dec 15, 2020 · 4 comments

Comments

@iangregsondev
Copy link

Current Behavior

My IDE and also running eslint from the command line gives issues on the gatsby app.

I have 2 apps, 1 called server and 1 called web

They were both created with the latest NX using the command line

The eslint's look the same.

but I get messages in the IDE and also on the commnad line

/Users/ian/Development/Work/documentation-cms/apps/web/src/pages/404.tsx
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/pages/404.tsx.
The file must be included in at least one of the projects provided

/Users/ian/Development/Work/documentation-cms/apps/web/src/pages/index.tsx
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/pages/index.tsx.
The file must be included in at least one of the projects provided

/Users/ian/Development/Work/documentation-cms/apps/web/src/pages/page-2.tsx
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/pages/page-2.tsx.
The file must be included in at least one of the projects provided

/Users/ian/Development/Work/documentation-cms/apps/web/src/pages/using-typescript.tsx
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/pages/using-typescript.tsx.
The file must be included in at least one of the projects provided

/Users/ian/Development/Work/documentation-cms/apps/web/src/templates/product.tsx
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/templates/product.tsx.
The file must be included in at least one of the projects provided

here is an eslint from server and it works well

{ "extends": "../../.eslintrc.json", "ignorePatterns": ["!**/*"], "rules": {} }

and from the web (gatsby)

{
  "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"],
  "ignorePatterns": ["!**/*", "public", ".cache"],
  "overrides": [
    {
      "files": ["*.tsx", "*.ts"],
      "rules": {
        "@typescript-eslint/camelcase": "off"
      }
    }
  ]
}

I tried copying the eslint from the server to the web to see if it fixes it but it does not.

The root eslint is like this

{
  "root": true,
  "ignorePatterns": ["**/*"],
  "plugins": ["@nrwl/nx"],
  "overrides": [
    {
      "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
      "rules": {
        "@nrwl/nx/enforce-module-boundaries": [
          "error",
          {
            "enforceBuildableLibDependency": true,
            "allow": [],
            "depConstraints": [
              { "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] }
            ]
          }
        ]
      }
    },
    {
      "files": ["*.ts", "*.tsx"],
      "extends": ["plugin:@nrwl/nx/typescript"],
      "parserOptions": { "project": "./tsconfig.*?.json" },
      "rules": {}
    },
    {
      "files": ["*.js", "*.jsx"],
      "extends": ["plugin:@nrwl/nx/javascript"],
      "rules": {}
    }
  ]
}

and my tsconfig root

{
  "compileOnSave": false,
  "compilerOptions": {
    "rootDir": ".",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "module": "esnext",
    "typeRoots": ["node_modules/@types"],
    "lib": ["es2017", "dom"],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "baseUrl": ".",
    "paths": {
      "@workspace/server/feature-serve-content": ["libs/server/feature-serve-content/src/index.ts"]
    }
  },
  "exclude": ["node_modules", "tmp"]
}

server tsconfig

{
  "extends": "../../tsconfig.base.json",
  "files": [],
  "include": [],
  "references": [
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.spec.json"
    }
  ]
}

and web (gatsby)

{
  "extends": "../../tsconfig.base.json",
  "compilerOptions": {
    "jsx": "react",
    "allowJs": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "types": ["node", "jest"]
  },
  "files": [
    "../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
    "../../node_modules/@nrwl/react/typings/image.d.ts"
  ],
  "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
}

Expected Behavior

The web project should not complain about an issue.

Environment

>  NX  Report complete - copy this into the issue template

  nx : Not Found
  @nrwl/angular : Not Found
  @nrwl/cli : 10.4.4
  @nrwl/cypress : 10.4.4
  @nrwl/eslint-plugin-nx : 10.4.4
  @nrwl/express : Not Found
  @nrwl/jest : 10.4.4
  @nrwl/linter : 10.4.4
  @nrwl/nest : 10.4.4
  @nrwl/next : Not Found
  @nrwl/node : 10.4.4
  @nrwl/react : 10.4.4
  @nrwl/schematics : Not Found
  @nrwl/tao : 10.4.4
  @nrwl/web : 10.4.4
  @nrwl/workspace : 10.4.4
  typescript : 4.0.5

@iangregsondev
Copy link
Author

I should mention as well, I thought it maybe to do with TSX files as I have none of these on the server obviously. SO I created a normal TS file inside the web project and same error.

@vsavkin vsavkin added the scope: react Issues related to React support for Nx label Dec 16, 2020
@nikparo
Copy link

nikparo commented Jan 31, 2021

Do you happen to be using symlinks in your project? I've been tracking down a similar issue (not gatsby though), and just opened an issue with typescript-eslint: typescript-eslint/typescript-eslint#2987

@jaysoo jaysoo added scope: gatsby and removed scope: react Issues related to React support for Nx labels Feb 19, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants